<blockquote style="margin:0 0 0 40px;border:none;padding:0px"><br></blockquote><div>Hi,</div><div><br></div><div>I'm using GDAL 1.9.2 to read a .bil data set that has an accompanying .hdr file which does not include PIXELTYPE. It does have NBITS = 32.</div>
<div><br></div><div>The documentation for the EHdr format mentions</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
This driver does not always do well differentiating between floating point and integer data. The GDAL extension to the .hdr format to differentiate is to add a field named PIXELTYPE with values of either FLOAT, SIGNEDINT or UNSIGNEDINT. In combination with the NBITS field it is possible to described all variations of pixel types.</blockquote>
<div><br></div><div><br></div><div>Unfortunately, the .hdr file includes a negative NODATA value</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
NODATA -9999</blockquote><div><br></div><div>which causes the pixeltype to be guessed wrong due to this code in ehdrdataset.cpp:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<font face="courier new, monospace"> /* -------------------------------------------------------------------- */<br>/* If we have a negative nodata value, let's assume that the */<br>/* pixel type is signed. This is necessary for datasets from */<br>
/* <a href="http://www.worldclim.org/futdown.htm">http://www.worldclim.org/futdown.htm</a> */<br>/* -------------------------------------------------------------------- */<br> if( bNoDataSet && dfNoData < 0 && chPixelType == 'N' )<br>
{<br> chPixelType = 'S';<br> </font>}</blockquote><div><br></div><div><br></div><div>I'm not sure where my user got this particular data set (which can make all the difference) but it's really meant to be</div>
<div>pixeltype FLOAT though it's not explicit as I said.</div><div><br></div><div>Do you have a suggestion besides getting him to rename his .bil files to .flt to cause the code to guess FLOAT instead?</div><div>Is there a way to supply GDAL with a hint in this case, for instance? I could locally modify my GDAL library of course</div>
<div>but if there's another way, I'd prefer it.</div><div><br></div><div>(It's funny: I used to have some hand-written code to read .bil datasets and the like where my default pixel type was FLOAT. Now</div><div>
the user tells me "this used to work" when in actuality I've really cleaned up the code by starting to use GDAL instead. That's</div><div>hard to explain to anyone but a programmer of course.)</div><div>
<br></div><div><br></div><div>Thanks for any suggestions!</div><div><br></div><div>carl</div>