Re: GeoTIFF max/min values

Steve Ansari wrote:

Yuan,

I'm not using greyscale. I've printed out the max and min values from the section of GeotiffWriter.java that sets the tag values to verify that the correct max/min values are calculated. It appears that they are.

     MAMath.MinMax dataMinMax = grid.getMinMaxSkipMissingData( data);
     float min = (float) (dataMinMax.min);
     float max = (float) (dataMinMax.max);
System.out.println(min+","+max); geotiff.addTag( new IFDEntry(Tag.SMinSampleValue, FieldType.FLOAT).setValue( min)); geotiff.addTag( new IFDEntry(Tag.SMaxSampleValue, FieldType.FLOAT).setValue( max));

Thanks,
Steve

Steve,
I know why now. It is because of the missing value -999.0. When we calculated the min and max, we skipped the missing value, and Arcmap does not look at the min/max tags, or finds the confliction of tags and data value and takes actual data value -999.0.

Yuan









Yuan Ho wrote:

Steve Ansari wrote:

Hi John,
I did have one other question...

I've been exporting GeoTIFFs from NetCDF files using the ucar.nc2.geotiff.GeotiffWriter class. When I load the images in ESRI ArcMap the default max and min values are incorrect. Ex)
High : 3.40282e+038
Low : 1.17549e-038



Steve,
Is the output file greyscale? Otherwise the min and max value should be stored in these two tags: Tag.SMinSampleValue and Tag.SMaxSampleValue. Let me know how do you get these High and Low values, and what are the values of above two tags.

Yuan


The actual data values are ok and the image is correctly geolocated. It seems that there may be max/min header or tag information that may be missing.

Thanks,
Steve