Opened 12 years ago

Closed 12 years ago

#4402 closed defect (fixed)

Issue with netcdf driver and srs units

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

Description

In 1.8.x the netcdf driver scales the inputs for the geotransform to find the extents if the units of the srs are in something other than meters. With new features in 1.9dev, the linear unit of the srs is set when writing. If the netcdf file is warped, the gt is scales manually, then the scale is applied again when the new file is created, meaning the extents are multiplied by 1000 (for kilometers) and then the linear units of the srs are set to km. This may cause 'double scaling' if the app using the file respects the UNIT tag in the srs. I suggest the removal of the manual scaling and set the linear unit in the srs appropriately. Currently the linear unit is not set on read, but only on write.

This is hard for me to explain. Attached is a patch to remove the manual scaling code, and I suggest etienne decide what to do as he is more familiar with the current state of the driver. I am not totally comfortable committing a change since I haven't worked on the driver for a while and it has changed a lot.

Attachments (2)

netcdf_gt_scale_4402.patch (2.6 KB ) - added by Kyle Shannon 12 years ago.
4402_autotest.patch (517 bytes ) - added by Kyle Shannon 12 years ago.
autotest patch for failing test

Download all attachments as: .zip

Change History (7)

by Kyle Shannon, 12 years ago

Attachment: netcdf_gt_scale_4402.patch added

comment:1 by Kyle Shannon, 12 years ago

Autotest fails with patch, attached another patch to return expected failure until the ticket is closed and perhaps the autotest is replaced with another that checks the fix.

by Kyle Shannon, 12 years ago

Attachment: 4402_autotest.patch added

autotest patch for failing test

comment:2 by etourigny, 12 years ago

finalizing a fix for this and also for ticket #3324 - the problem there is due to double scaling of units.

comment:3 by etourigny, 12 years ago

r23611 : fix handling of UNITS import and export (bugs #4402 and #3324)

modified the autotest to look for UNITS=km and test for adjusted GT.

Kyle, is this good for you?

many thanks

comment:4 by Kyle Shannon, 12 years ago

Etienne, Based on my gdalinfo reports and a gdalwarp test, looks good to me, thanks for getting that in. Wish I could've helped a little more. I would say close it.

kss

comment:5 by etourigny, 12 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.