Opened 16 years ago

Closed 16 years ago

#2413 closed defect (fixed)

GDALComputeRasterMinMax() computes the two values GDALComputeRasterMinMax() take in account the 'nodata value'

Reported by: pigreco Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL_Raster Version: 1.5.1
Severity: normal Keywords: EHDR
Cc:

Description

Seems that the function GDALComputeRasterMinMax() computes the two values not excluding the 'nodata value'.
For example, using this DEM dataset:

# gdalinfo E020N40.DEM[[BR]]
  .... <cut>...
  Band 1 Block=4800x1 Type=UInt16, ColorInterp=Undefined
  Min=-9999.000''' Max=5825.000
  Minimum=-9999.000, Maximum=5825.000, Mean=-2347.600, StdDev=4873.500
  NoData Value=-9999

i.e. the 'nodata value' is equal to the minimum value.

From the file gdal_misc.cpp, line 626, i see:

   if( bGotNoDataValue && dfValue == dfNoDataValue )
      continue;

In this specific case the data type is 'unsigned int' so:

  • why the minimum value is negative?
  • what happens when you confront -9999 with -9999.000?

Change History (2)

comment:1 by pigreco, 16 years ago

Version: unspecified1.5.1

comment:2 by warmerdam, 16 years ago

Component: defaultGDAL_Raster
Keywords: EHDR added
Resolution: fixed
Status: newclosed

The EHdr driver checks for an .STX (statistics file) and uses that if available. That contains -9999 as the minimum. So this is pretty much a defect in the dataset.

Note: See TracTickets for help on using tickets.