Fwd: [gdal-dev] Re: discussion on improvements to the NetCDF driver and CF-1 convention

Hendy Sumanto hsumanto at vpac.org
Wed Aug 31 00:23:54 EDT 2011

Hi Etienne,

I have a few items which I would like to put as new topics in the wiki entry but I think I better describe them here first before putting any entry or creating tickets.

1. As part of the improvement to the NetCDF driver, is it possible to make request to implement the Create method for the driver so that tool such as gdalwarp can output as NetCDF output.

2. Recently I was trying to serve the NetCDF dataset (which were created by gdal_translate geotiff LANDSAT dataset into NetCDF)
using THREDDS data server. When I try to access it via WMS using viewer such as Godiva2, I was not able to view the dataset correctly.

When I used the netCDF toolsUI to check the NetCDF dataset, it is not recognized as a grid by NetCDF Tools (4.2).  

Looking at this documentation (http://www.unidata.ucar.edu/software/netcdf-java/reference/StandardCoordinateTransforms.html),
in order for grid data to be viewable, the NetCDF dataset must:
a) define x and y projection coordinate variables, using the correct projection units, typically km on the projection plane.
b) define your projection dummy variable which has an attribute "grid_mapping_name"
c) refer to the projection in your data variables with the "grid_mapping" attribute.

Checking on the GDAL netCDF, it only define x and y dimensions but not x and y projection coordinate variables (point a is not followed).

Thus, I wondering whether other people have experienced the same issue as what I am having.

Then I just tried to: 
-generate its CDL by ncdump the GDAL netCDF file into CDL
-and the define x and y projection coordinate variables (as shown below) into the CDL
    double y(y) ;
        y:units = "m" ;
        y:standard_name = "projection_y_coordinate" ;
        y:long_name = "y coordinate of projection" ;
    double x(x) ;
        x:units = "m" ;
        x:standard_name = "projection_x_coordinate" ;
        x:long_name = "x coordinate of projection" ;
-regenerate the netCDF file from the modified CDL using ncgen
-populate the y coordinate variable in the NetCDF file with
        ymin, ymin+resolution, ymin+2*resolution, ...
-populate the x coordinate variable with
        xmin, xmin+resolution, xmin+2*resolution, ...
-if I then serve the modified NetCDF dataset again using THREDDS data server, now it can be viewed correctly.

Note: xmin, ymin are the lower left corner and resolution is the raster pixel size.

Thus, my questions:
i)Is there a specific reason why the current driver do not define the x and y projection coordinate variables but only defining x and y dimensions. 
For the dataset to be viewable using tools such as netCDF toolsUI or when the dataset are served via THREDDS dataset, we might have to add projection coordinate variables and the correct values
into the netCDF file.
ii)For lambert conformal conic projection with more than one standard parallel values, GDAL netCDF file is showing 
lambert_conformal_conic:standard_parallel_1 = -18.f ;
lambert_conformal_conic:standard_parallel_2 = -36.f ;
but the correct one (for the dataset to be viewable using toolsUI or THREDDS) should be
lambert_conformal_conic:standard_parallel = -18.f,-36.f ; 

Could you please please comment on 1, 2(i) and 2(ii)? 

The attached files:
tile.nc - GDAL netCDF file
tile-fixed-new.nc - the one I just tried to fix and can be viewed in netCDF toolsUI or served in THREDDS



More information about the gdal-dev mailing list