[Gdal-dev] ASCII Grid data type issue
Frank Warmerdam
fwarmerdam at gmail.com
Wed Aug 17 12:18:21 EDT 2005
On 8/17/05, hrz at geodata.soton.ac.uk <hrz at geodata.soton.ac.uk> wrote:
> 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?
Homme,
Sort of asking people to edit their files to add an extra header,
I don't know of any way to discover whether the files are really
floating point without scanning the whole thing, which I am loath
to do. There is an open bug report on this issue, I believe.
I would be happy to add logic so that an extra header indicating
type would be honoured, but that won't help people trying to use
the data for the first time, who will end up going through much of the
same pain as you.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Gdal-dev
mailing list