[gdal-dev] how to create NETCDF with several 3D variables?

Chris Barker chris.barker at noaa.gov
Mon Jul 23 10:07:07 PDT 2012


On Mon, Jul 23, 2012 at 7:50 AM, Anton Korosov <anton.korosov at nersc.no> wrote:

> how to create a NetCDF file with several variables that have more than two
> dimensions?

I"m sure you can get this to work, but...

netcdf has a pretty different data model than GDAL -- I suspect you'll
be fighting that regularly. You may be better off workign with a more
native netcdf driver. If you are at all familiar with Python, the
"netCDF4" python module is great:

http://netcdf4-python.googlecode.com/svn/trunk/docs/netCDF4-module.html

( you can read stuff in other formats with GDAL, and write with
netcdf4, if that makes sense )

you may want to give it a try.

-Chris


> I have to save time series of several fields (sst, chlorophyll, etc) in one
> file.
>
> I found that in order to create one 3D variable I can add
> NETCDF_DIM_EXTRA, NETCDF_DIM_time_DEF, NETCDF_DIM_time_VALUES to the
> metadata in a VRT file. Then I use 'gdal_translate -of NetCDF' or
> gdal.GetDriverByName('NetCDF').CreateCopy() to generate a .nc file.
>
> However I cannot make several 3D variables!
>
> Here are two VRTs. One works fine (one variable: 'sst', 3 dimentions: time,
> x, y). Another one produces two variables (chl, sst)  but time dimension is
> not added!
> Is it possible to do it in theory?
>
> I use the latest release of GDAL 2.0dev
>
> With best regards and great thanks for the developers of the fantastic
> NetCDF driver!
>
> Anton
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev



-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov


More information about the gdal-dev mailing list