[Gdal-dev] Another NetCDF driver bug fix

Joaquim Luis jluis at ualg.pt
Fri Oct 19 14:39:39 EDT 2007


Frank Warmerdam wrote:
> Paavo Jumppanen has proposed some substantial upgrades to the netcdf
> driver ...   too comprehensive for me to make a quick analysis.  Perhaps
> you could try integrating them in a local build and test them to see if
> they seem appropriate?
>
>   http://trac.osgeo.org/gdal/ticket/1808
>

Frank,
The Jumppanen update has one, lets say, compatibility issue which is 
gdalinfo
doesn't report the full contents even if the file has only one dataset. 
Example:
C:\>gdalinfo somb.grd
Driver: netCDF/Network Common Data Format
Files: somb.grd
Size is 512, 512
Coordinate System is `'
Metadata:
  NC_GLOBAL#Conventions=COARDS, CF-1.0
  NC_GLOBAL#title=somb.grd
  NC_GLOBAL#history=grdmath -R-15/15/-15/15 -I0.5 X Y HYPOT DUP 2 MUL PI 
MUL 8 D
IV COS EXCH NEG 10 DIV EXP MUL -F = somb.grd
  NC_GLOBAL#GMT_version=GMT4.2
  NC_GLOBAL#node_offset=1
Subdatasets:
  SUBDATASET_1_NAME=NETCDF:"somb.grd":z
  SUBDATASET_1_DESC=[60x60] z (32-bit floating-point)
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  512.0)
Upper Right (  512.0,    0.0)
Lower Right (  512.0,  512.0)
Center      (  256.0,  256.0)

Only this change is sufficient to break my Matlab gdalread mex file.

I have now clean patches for both the header decoding of GMT produced grids
and the fix reported by Mario Cruz.
However, there is still one problem that requires a more extended solution.
The way the driver is, it expects files written "upside down"  (the 
first row is the top row)
which is the contrary of what GMT does (it writes the first row as the 
bottom row).
That is why GMT grids are imported flipped up-down.

Both ways of writting the grids are valid, but the driver must detect it 
(easy) and act accordingly.

Do you want me to send you my patched version (based on trunk version)?

Joaquim





More information about the Gdal-dev mailing list