[Gdal-dev] Computing MinMax on a NETCDF subdataset

Joaquim Luis jluis at ualg.pt
Tue Apr 24 12:21:11 EDT 2007


Frank Warmerdam wrote:
> Joaquim Luis wrote:
>> Hi,
>> In my gdalread MEX file I have this call
>>
>> GDALComputeRasterMinMax(hBand, FALSE, adfMinMax);
>>
>> which, in case of reading a NETCDF file, is returning
>>
>> adfMinMax[0] = 0  and adfMinMax[1] = 0
>> or
>> adfMinMax[0] = -4294967295.0  and adfMinMax[1] = 4294967295.0
>> if I change to
>> GDALComputeRasterMinMax(hBand, TRUE, adfMinMax);
>>
>> Note that I'm using this (example)
>> Z =  gdalread('NETCDF:"D:\SVN\global.nc":z');
>> which is the correct way of using this MEX, confirmed by the fact 
>> that Z has the correct values.
>>
>> For all other formats that I have tested, the min/max is correct.
>>
>> Is this on purpose or a feature?
>
> Joaquim,
>
> This is not expected behavior.  Could you provide the global.nc file 
> for me
> to do some testing with?
Frank,
No need to use the global.nc. I reproduced the same behavior with a GMT 
generated file.

e.g, using GMT's example 5 mexican hat you can use the sombrero.grd for 
testing
grdmath -R-15/15/-15/15 -I0.3 X Y HYPOT DUP 2 MUL PI MUL 8 DIV COS EXCH 
NEG 10 DIV EXP MUL = sombrero.grd

For sanity I rechecked with old format GMT file (e.g grdmath  ... = 
sombrero.grd=cf) and the result was correct

> Perhaps best to file this as a problem bug so I can keep track of it.
Done.

Joaquim




More information about the Gdal-dev mailing list