Opened 14 years ago

Closed 13 years ago

#3425 closed enhancement (fixed)

Add new projections from cf-1.4 to netcdf driver

Reported by: Kyle Shannon Owned by: warmerdam
Priority: normal Milestone: 1.9.0
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords: netcdf
Cc:

Description

CF-1.4 has added 4 ogr spatial reference support projections. These have been added. Lambert Cylindrical Equal Area was just added to the current CEA set function. There is a small issue in Mercator, as the osr function SetMercator() takes only the scale factor, where as in CF-1.0 the user may define the scale_factor_at_projection_origin or standard_parallel. at this time standard_parallel is not supported at all( ticket #3324), although I did add the defintion to the header file, along with other grid mapping attributes that were updated. I am trying to chip away at some issues with the netcdf driver to help some issues in my app, but I don't get much feedback on CF convention's relationship with the driver from the list, so I am guessing CF and gdal tags should both be supported.

Attachments (2)

netcdfdataset_kyle.patch (7.2 KB ) - added by Kyle Shannon 14 years ago.
netcdfdataset patch
test.zip (516.8 KB ) - added by etiennesky 13 years ago.
contains 3 test files: tmp3.tif, tmp3.nc and tmp3-2.nc (converted with the fix)

Download all attachments as: .zip

Change History (7)

by Kyle Shannon, 14 years ago

Attachment: netcdfdataset_kyle.patch added

netcdfdataset patch

comment:1 by warmerdam, 14 years ago

Resolution: fixed
Status: newclosed

Kyle,

I have not been deeply involved in the netcdf driver, so I've tried not to comment without knowing the history and intent, but I think that Denis is not following closely any more.

I believe it is desirable to do as good a job of following CF conventions as possible, but the GDAL specific data items are intended to ensure we can losslessly preserve coordinates systems when netcdf's written by gdal are ready by gdal. So we really want both to work as well as practical.

I have committed your patch with only minimal review in trunk (r18854). I hesitate to backport it to 1.7 without more careful review or feedback. It would also be nice to extend the netcdf test suite to better test coordinate system support if you are so inclined. In fact, I'd be prepared to sponsor you for GDAL commit access if you are interested.

comment:2 by Kyle Shannon, 14 years ago

Frank, My work has led me to the NetCDF driver out of need of weather model data. I have been hacking on my svn trunk version and I have gotten it to read tags correctly. I think the way to work on this would be to re-write the FetchCopyParm() so the return value can be validated, and also return more than one value (as in the standard_parallel issue in ticket #3324). What I hope is a step in the right direction is the patch (not really a good patch now that I think about it) for that ticket. The function I added checks the CF tags first, then the gdal tags after that, returning a list of whatever values it finds, or NULL if unsuccessful. I agree that the testing needs to be updated, and I have started that locally as well. There are also a few unsupported tags (all datums are WGS84, even when a sphere is defined). If you think it is proper, I will accept commit access although I wouldn't make any commits until my testing skills are improved. Thanks for the help Frank.

by etiennesky, 13 years ago

Attachment: test.zip added

contains 3 test files: tmp3.tif, tmp3.nc and tmp3-2.nc (converted with the fix)

comment:3 by etiennesky, 13 years ago

Resolution: fixed
Status: closedreopened

CF-1,4 convention states that "lambert_cylindrical_equal_area" should be used as gripd_mapping_name to identify Cylindrical Equal Area projections.

However, the driver uses the "cylindrical_equal_area" name. Other software adhering to the CF-1.4 conventions will not support these files created by GDAL.

Simple fix in netcdfdataset.h:

-    {"cylindrical_equal_area", SRS_PT_CYLINDRICAL_EQUAL_AREA },
+    {"lambert_cylindrical_equal_area", SRS_PT_CYLINDRICAL_EQUAL_AREA },

This works when the netcdf file is read by GDAL, as CEA and LCEA are treated the same, so the projection information is loaded properly.

Added attachment with example files.

comment:4 by Kyle Shannon, 13 years ago

I agree, I will add the fix. Thanks.

comment:5 by Kyle Shannon, 13 years ago

Milestone: 1.8.01.9.0
Resolution: fixed
Status: reopenedclosed

Changed in r22423

Note: See TracTickets for help on using tickets.