[gdal-dev] Re: discussion on improvements to the NetCDF driver
and CF-1 convention
Hendy Sumanto
hsumanto at vpac.org
Thu Sep 1 01:21:57 EDT 2011
>>2)
>>I assume your file is in a projected CRS?
Yes, it projected CRS.
>>In any case, the current implementation is not 100% CF compliant. GDAL can read them (through custom tags), but other software cannot.
>>I have submitted a patch to fix geographic CRS only.
I have tried your patch for fixing geographic CRS, it does add back the coordinate variables: lat and lon in the epsg4326-patch.nc
>>Please add this information to existing bug #2893 (which I have renamed tonetcdf driver does not read and write CF-1.0 coordinate system properly for projected CRS),
>>along with your file (which was stripped by the mailing list)
I have added this information to ticket #2893, so that the projection coordinate variables: x and y will be added into netcdf file.
>>BTW, there is a nifty CF compliance checker (python script and online checker) which I have added to the wiki. Please test your file with it. It's possible that lambert_conformal_conic:standard_parallel_1 is valid >>CF, it needs to be tested.
I have tested both files with the CF compliance checker, both files pass the checking
but as soon I tried to view the grid dataset (the GDAL netCDF) in Gridviewer in NetCDF Tools (4.2), it won't be recognized as grid because
the Gridviewer having problem finding projection coordinate variables: x and y (we don't have them) and i suspect it is also having problem with standard_parallel_1 and standard_parallel_2 attributes,
but as soon as I added the projection coordinate variables: x and y and also fix
lambert_conformal_conic:standard_parallel_1 = -18.f ;
lambert_conformal_conic:standard_parallel_2 = -36.f ;
to
lambert_conformal_conic:standard_parallel = -18.f,-36.f ;
the grid dataset is viewable and recognized as gridded dataset by Gridviewer in NetCDF Tools (4.2).
Regards,
Hendy
===========================
BEFORE geographic CRS PATCH
===========================
netcdf epsg4326 {
dimensions:
x = 8990 ;
y = 6284 ;
variables:
char GDAL_Geographics ;
GDAL_Geographics:Northernmost_Northing = -36.4865439284304 ;
GDAL_Geographics:Southernmost_Northing = -38.4371430324099 ;
GDAL_Geographics:Easternmost_Easting = 147.286731249335 ;
GDAL_Geographics:Westernmost_Easting = 144.496170150548 ;
GDAL_Geographics:spatial_ref = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4326\"]]" ;
GDAL_Geographics:GeoTransform = "144.4961701505481 0.0003104072412443472 0 -36.48654392843041 0 -0.0003104072412443472 " ;
GDAL_Geographics:grid_mapping_name = "Geographics Coordinate System" ;
GDAL_Geographics:long_name = "Grid_latitude" ;
byte Band1(y, x) ;
Band1:grid_mapping = "GDAL_Geographics" ;
Band1:long_name = "GDAL Band Number 1" ;
// global attributes:
:Conventions = "CF-1.0" ;
}
===========================
AFTER geographic CRS PATCH
===========================
netcdf epsg4326-patch {
dimensions:
lon = 8990 ;
lat = 6284 ;
variables:
char crs ;
crs:grid_mapping_name = "latitude_longitude" ;
crs:longitude_of_prime_meridian = 0. ;
crs:semi_major_axis = 6378137. ;
crs:inverse_flattening = 298.257223563 ;
double lat(lat) ;
lat:standard_name = "latitude" ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
double lon(lon) ;
lon:standard_name = "longitude" ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
byte Band1(lat, lon) ;
Band1:grid_mapping = "crs" ;
Band1:long_name = "GDAL Band Number 1" ;
// global attributes:
:Conventions = "CF-1.0" ;
:AREA_OR_POINT = "Area" ;
}
----- Original Message -----
From: Hendy Sumanto <hsumanto at vpac.org>
To: gdal-dev at lists.osgeo.org
Cc:
Sent: Wednesday, August 31, 2011 1:23:54 AM
Subject: Fwd: [gdal-dev] Re: discussion on improvements to the NetCDF driver and CF-1 convention
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
Regards,
Hendy
_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Hendy Sumanto
Software Developer
Victorian Partnership for Advanced Computing (VPAC)
Innovation Powered by Advanced Computing
http://www.vpac.org
t: +61 3 9020 0191 (TC)
t: +61 3 9647 5437 (FB)
f: +61 3 9646 7787
More information about the gdal-dev
mailing list