[Gdal-dev] patch for 1.4.x : frmts/netcdf (NC_GLOBAL#{spatial_ref/GeoTransform})

Rob Cermak cermak at sfos.uaf.edu
Mon May 14 14:55:26 EDT 2007


Greetings,

Recent events have us looking the the direct access Netcdf driver
(frmts/netcdf).  We discovered that the spatial_ref and GeoTransform
global tags are ignored for non-complient CF-1.0 files.

Patch: http://ak.aoos.org/data/patch/frmts_netcdf_global_georef.patch

WRF data file, if needed:
http://137.229.130.18/data/forecasts/AEFF/WRF/CIPWS12km/200705/14/00/wrfout_d01_2007-05-16_00.nc
  (sorry about the size! 14 MB)

1.4.1:
gdalinfo NETCDF:"wrfout_d01_2007-05-16_00.nc":T2
  NC_GLOBAL#spatial_ref=+proj=stere +lon_0=-147.300003052 +lat_0=90
+lat_ts=60.2000007629 +a=6378273 +rf=298.279405043 +x_0=0 +y_0=0
  NC_GLOBAL#GeoTransform=-541931.561016 12045.5692702 0 -3610575.06283 0
12025.6894815
  T2#FieldType=104
  T2#MemoryOrder=XY
  T2#description=TEMP at 2 M
  T2#units=K
  T2#stagger=
  T2#coordinates=XLONG XLAT
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,   72.0)
Upper Right (   90.0,    0.0)
Lower Right (   90.0,   72.0)
Center      (   45.0,   36.0)
Band 1 Block=90x1 Type=Float32, ColorInterp=Undefined
  NoData Value=9.96920996838687e+36
  Metadata:
    NETCDF_VARNAME=T2
    NETCDF_DIMENSION_Time=1
GDAL: GDALClose(NETCDF:wrfout_d01_2007-05-16_00.nc:T2)
GDAL: GDALDeregister_GTiff() called.

With the above patch:
  NC_GLOBAL#spatial_ref=+proj=stere +lon_0=-147.300003052 +lat_0=90
+lat_ts=60.2000007629 +a=6378273 +rf=298.279405043 +x_0=0 +y_0=0
  NC_GLOBAL#GeoTransform=-541931.561016 12045.5692702 0 -3610575.06283 0
12025.6894815
  T2#FieldType=104
  T2#MemoryOrder=XY
  T2#description=TEMP at 2 M
  T2#units=K
  T2#stagger=
  T2#coordinates=XLONG XLAT
Corner Coordinates:
Upper Left  ( -541931.561,-3610575.063)
Lower Left  ( -541931.561,-2744725.420)
Upper Right (  542169.673,-3610575.063)
Lower Right (  542169.673,-2744725.420)
Center      (     119.056,-3177650.241)
Band 1 Block=90x1 Type=Float32, ColorInterp=Undefined
  NoData Value=9.96920996838687e+36
  Metadata:
    NETCDF_VARNAME=T2
    NETCDF_DIMENSION_Time=1
GDAL: GDALClose(NETCDF:wrfout_d01_2007-05-16_00.nc:T2)
GDAL: GDALDeregister_GTiff() called.

Rob
-- 
Alaska Ocean Observing System
Data Manager
907-474-7948




More information about the Gdal-dev mailing list