Opened 13 years ago
Closed 12 years ago
#4221 closed enhancement (fixed)
Support Create() method for NetCDF driver so that gdalwarp can be used on a netcdf file
Reported by: | pds | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | normal | Keywords: | NetCDF, Create, IO |
Cc: | etourigny |
Description
We'd like to be able to use gdalwarp functionality with NetCDF files as an output, which requires supporting the Create() and IWriteBlock() methods for the NetCDF driver.
The NetCDF C API supports creating a file with empty variables, then later updating an existing file, and random-access writing, all prerequisites for the Create() method in GDAL.
This should likely involve refactoring the GDAL driver so common functionality is shared between the Create() and CreateCopy() methods.
Change History (9)
comment:1 by , 13 years ago
Cc: | added |
---|
comment:2 by , 12 years ago
comment:4 by , 12 years ago
Etienne, you might want to check the correctness of the first part of the following fix :
r23461 /trunk/gdal/frmts/netcdf/netcdfdataset.cpp: Fix compiler warnings about wrong enum comparison, and uninitialized variable
comment:5 by , 12 years ago
Fix is fine, thanks. It worked before by chance, because NC_BYTE and GDT_Byte have the same value.
r23463: Added autotest for Create() and CreateCopy() a band with unsigned byte data and fix to PIXELTYPE metadata when calling Create().
comment:6 by , 12 years ago
In GDAL Byte data is unsigned by default and uses PIXELTYPE=SIGNEDBYTE metadata to specify signed byte, following
http://trac.osgeo.org/gdal/wiki/rfc14_imagestructure
Byte data in netcdf is by default signed, and the following conventions are used by the driver to specify unsigned byte
- valid_range: http://www.unidata.ucar.edu/software/netcdf/docs/netcdf/Attribute-Conventions.html
- _Unsigned : http://www.unidata.ucar.edu/software/netcdf/docs/BestPractices.html
- NC_UBYTE for NC4 format
comment:7 by , 12 years ago
Using gdalwarp on a large dataset with -co COMPRESS=DEFLATE option (which forces NC4C format) does not work (takes a very long time). This is probably due to wrong chunksize, which was optimized for CreateCopy(). Exporting without compression works, so use that for now.
comment:8 by , 12 years ago
r23635 : properly enable chunking in netCDFDataset::DefVarDeflate() (#4404 and #4221)
comment:9 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Re-factored the driver and added a Create() function, commited to trunk (r23456), and autotests (r23457).
Significant changes brought by this commit: