Opened 13 years ago

Closed 12 years ago

#4244 closed defect (fixed)

disable PAM in netcdf driver

Reported by: etourigny Owned by: etourigny
Priority: normal Milestone:
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords:
Cc: warmerdam

Description

The netcdf driver creates duplicate geotransform, projection, metadata and novalue information in auxiliary PAM file.

This is unnecessary as these values are already available in the netcdf file itself.

Moreover, it has the unpleasant side effect of loading geotransform and projection information that may not be valid, if it was modified by an external program or through other mecanisms.

For illustration purposes, loss of sync between the PAM data and the netcdf file can be reproduced with the attached file (which is a lat/lon file with no datum). Geo-referencing is not copied over to the new netcdf file (due to another bug, which will be fixed), but is kept in the PAM file:

$ gdalinfo trmm-cp.nc 
...
Coordinate System is `'
Origin = (-80.000000000000000,-10.000000000000000)
Pixel Size = (0.250000000000000,-0.250000000000000)
Metadata:
...

$ gdal_translate -of netcdf trmm.nc trmm-cp.nc

$ gdalinfo trmm-cp.nc 
...
Coordinate System is `'
Origin = (-80.000000000000000,-10.000000000000000)
Pixel Size = (0.250000000000000,-0.250000000000000)
Metadata:
...

$ cat trmm-cp.nc.aux.xml 
<PAMDataset>
  <GeoTransform> -8.0000000000000000e+01,  2.5000000000000000e-01,  0.0000000000000000e+00, -1.0000000000000000e+01,  0.0000000000000000e+00, -2.5000000000000000e-01</GeoTransform>
...

$ rm trmm-cp.nc.aux.xml ; gdalinfo trmm-cp.nc 
Coordinate System is `'
Metadata:

PAM support for netcdf was implemented in r7553 .

Support for fetching geotransform, projection, metadata and nodata from PAM was silently introduced in r13698 and r13699 for bug#2196, which is unrelated to PAM.
This has been done quite some time ago, but can Frank recall why this was done?

I propose the following:

1) Remove the support for fetching geotransform, projection, metadata and nodata from PAM (reverting the PAM-related changes in r13698)
2) Prevent these variables from being written to PAM, as they are not necessary 3) optional - do not write PAM when creating a new netcdf

1) is easy but how can I go about with 2) ?

I honestly don't see any regression issues that these changes can cause.

Attachments (1)

trmm.nc (8.7 KB ) - added by etourigny 13 years ago.

Download all attachments as: .zip

Change History (6)

by etourigny, 13 years ago

Attachment: trmm.nc added

comment:1 by etourigny, 13 years ago

Fixed in trunk (r23090), leaving this bug open for now.

I have temporarily disabled PAM in the netcdf driver, in a non-disruptive way, by adding the GPF_DISABLED flag in the Open() function.

Should someone object, or have an issue related to this change, please report here. I will most try to re-enable PAM support when things have settled.

comment:2 by etourigny, 13 years ago

Summary: netcdf driver should not use PAM to fetch and save fundamental informationdisable PAM in netcdf driver

comment:3 by etourigny, 13 years ago

Resolution: fixed
Status: newclosed

comment:4 by etourigny, 12 years ago

Resolution: fixed
Status: closedreopened

comment:5 by etourigny, 12 years ago

Resolution: fixed
Status: reopenedclosed

in trunk (r23799): enable PAM for band histogram and statistics (#4244)

SerializetoXML() has been overriden in netCDFDataset and netCDFRasterBand so that not all metadata is unnecessarily copied.

ticket #4245 remains open as there should be a better mechanism to save to PAM only metadata which is not already present in the file, or to define which should be saved.

Note: See TracTickets for help on using tickets.