KEA/GDAL error

50 views
Skip to first unread message

Nathan Thomas

unread,
Jan 24, 2017, 8:24:28 PM1/24/17
to RSGISLib Support
Hi Pete,

I wrote a long message here about an error when converting some raw (DN) JERS-1 data (ENVI) to KEA. After some playing around I then discovered the following:


The following doesn't work:


gdal_translate -of KEA /Users/nmthomas/Downloads/S02W080_96_MOS/S02W080_96_sl_HH /Users/nmthomas/Downloads/S02W080_96_MOS/S02W080_96_sl_HH.kea


The following does work (add '_test' to the output filename). 


gdal_translate -of KEA /Users/nmthomas/Downloads/S02W080_96_MOS/S02W080_96_sl_HH /Users/nmthomas/Downloads/S02W080_96_MOS/S02W080_96_sl_HH_test.kea


I checked the file info with gdalinfo and it says the first is still an ENVI and the second is a KEA. When using '-of GTiff' it correctly identifies the output as a tif without having to add '_test.tif'' (e.g. gdal_translate -of GTiff /Users/nmthomas/Downloads/S02W080_96_MOS/S02W080_96_sl_HH /Users/nmthomas/Downloads/S02W080_96_MOS/S02W080_96_sl_HH.tif)


Im guessing something is not being done correctly when renaming the file??


Thanks, Nathan

Nathan Thomas

unread,
Jan 24, 2017, 8:27:39 PM1/24/17
to RSGISLib Support

Nathan Thomas

unread,
Jan 24, 2017, 8:30:32 PM1/24/17
to RSGISLib Support
FYI - someone else noticed this error too and we are both using the development version of RSGISLib as proj4 was renamed and was causing an error - has this been fixed in the new release?

Daniel Clewley

unread,
Jan 25, 2017, 1:50:10 AM1/25/17
to Nathan Thomas, RSGISLib Support
Hi Nathan,

This is a bit of a weird one. Just renaming the file after running gdal_translate also works as does saving to a different directory, anything so there isn’t a .hdr file in the same directory with the same name.

I think it is because GDAL isn’t recognising the KEA extension but is finding a .hdr file so tries to read using the ENVI driver.

This is due to the GDAL / KEA build (which we don’t do anymore) rather than RSGISLib so probably best to open an issue on the KEA conda-forge page (https://github.com/conda-forge/kealib-feedstock) I also keep an eye on this repo. I’m assuming it is specific to the conda-forge build as I haven’t noticed it before.

Thanks,

Dan

--
You received this message because you are subscribed to the Google Groups "RSGISLib Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rsgislib-suppo...@googlegroups.com.
To post to this group, send email to rsgislib...@googlegroups.com.
Visit this group at https://groups.google.com/group/rsgislib-support.
For more options, visit https://groups.google.com/d/optout.

Pete Bunting [pfb]

unread,
Jan 25, 2017, 2:57:24 AM1/25/17
to Dan Clewley, Nathan Thomas, RSGISLib Support, Sam Gillingham
Hi Nathan, 

I have not had the issue as you have described it before but I have had problems with files of different formats where the file name is the same other than the extension - particularly with ENVI files. 

If just converting format I tend to put the file type into the file name (e.g., input_kea.kea, input_env.env, input_hfa.img, input_tif.tif). I would suggest this is good practice, gdal sometimes produces errors/warnings messages about this. When you do gdal_translate is that no message along the way?

However, as you say it is working with TIF so it does sounds like it is fixable somewhere, maybe (most likely) it is the ENVI driver incorrectly identifying it? The ENVI driver will use any file with any (or no) extension as the binary file but because TIF is so common they might well have that specific catch for those files. 

I think the problem here is the ENVI files don’t have a specific extension, just a header and therefore the GDAL driver struggles to find the binary, in this case picking up the KEA file instead. Therefore, when using ENVI files (I would recommend just not using them, as they cause other issues with rounding projection values etc as well) make sure they are uniquely named. I don’t think this is a ‘bug’ but a ‘feature’ of the ENVI driver. 

Hope that helps, 

Pete

****************************************************
* Dr Pete Bunting
* Reader in Remote Sensing
* Earth Observation and Ecosystem Dynamics Group
* Department of Geography and Earth Sciences
* Aberystwyth University
* Aberystwyth
* Ceredigion
* SY23 3DB
* UK

* Ph: +44 (0) 1970 622615
* Mob: +44 (0) 7917 842743
* Email: p...@aber.ac.uk
* ORCID: http://orcid.org/0000-0002-7435-0148
****************************************************
"Please consider the environment before printing this email or any documents attached”


--------------------------------------------------------------------
Un o’r 4 prifysgol uchaf yn y DU a’r orau yng Nghymru am fodlonrwydd myfyrwyr.
(Arolwg Cenedlaethol y Myfyrwyr 2016)
www.aber.ac.uk

Top 4 UK university and best in Wales for student satisfaction
(National Student Survey 2016)
www.aber.ac.uk

Nathan Thomas

unread,
Jan 25, 2017, 2:35:18 PM1/25/17
to Pete Bunting [pfb], Dan Clewley, RSGISLib Support, Sam Gillingham
Thanks both,

I can’t access the googlegroup right now, so ill respond here for the time being.

What you’re both suggesting makes sense, it’s just strange that it’s not something I’ve come across before - I don’t get any messages when I run GDAL so it’s a silent error. I’ve converted a fair amount of radar data over the past few years, so it’s strange that it’s happening now. Now I know a way around it, it’s not a big problem - just a bit inconvenient at the time. Having said that I will open an issue on the KEA condo-forge page, as it may lead to confusion for a new user if it is left ‘unfixed’.

Thanks, Nathan

Nathan M Thomas
CalTech Postdoc at JPL
Radar Science and Engineering
4800 Oak Grove Dr.
300-356A
Pasadena, CA 91109


Pete Bunting [pfb]

unread,
Jan 25, 2017, 2:40:04 PM1/25/17
to Nathan Thomas, Dan Clewley, RSGISLib Support, Sam Gillingham
Hi Nathan, 

I think this issue should be for the GDAL issues list rather than conda-forge. I would suggest it is with the ENVI driver. I am exam marking at the moment but when I get a chance I’ll have a look at the ENVI driver and try to submit a fix. 

Cheers, Pete

****************************************************
* Dr Pete Bunting
* Reader in Remote Sensing
* Earth Observation and Ecosystem Dynamics Group
* Department of Geography and Earth Sciences
* Aberystwyth University
* Aberystwyth
* Ceredigion
* SY23 3DB
* UK

* Ph: +44 (0) 1970 622615
* Mob: +44 (0) 7917 842743
* Email: p...@aber.ac.uk
* ORCID: http://orcid.org/0000-0002-7435-0148
****************************************************
"Please consider the environment before printing this email or any documents attached”

Reply all
Reply to author
Forward
0 new messages