[Gdal-dev] ASCII Grid data type issue
hrz at geodata.soton.ac.uk
hrz at geodata.soton.ac.uk
Wed Aug 17 11:26:04 EDT 2005
Dear List,
I'm working with some Arc/Info ASCII Grid files which (not atypically
for this format) have NODATA values which are integers (i.e. -1 or
-9999). The actual data, however, are floats. My problem arises when
some of these files are interpreted as being of type Int16 instead of
Float32.
Looking at the code (the Open() method in aaigriddataset.cpp), this
seems to be due to the fact that if a decimal place is found in the
first kilobyte or so of code the file is determined to be Float32,
otherwise it is specified as Int16. Many of my files have a large
numer of integer NODATA values in the beginning of the file and are
therefore mistakenly identified as Int16.
My question is whether a solution exists that would not involve
altering the data and setting the NODATA values to floats. It seems
that a bullet-proof algorithm would involve checking the contents of
the entire file until either a decimal point or EOF was reached. If
the data type is known this could be specified as an option somewhere
and the above processing skipped. Is this at all practicable?
Whilst using the python API I tried to alter the DataType property of
the gdal.Band instance but this didn't have the desired result ;)
Thanks in advance for any ideas!
Kind regards,
Homme.
More information about the Gdal-dev
mailing list