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

Etienne Tourigny etourigny.dev at gmail.com
Mon Jul 23 10:05:49 PDT 2012


Hi

glad you like the driver.  Interesting that you were able to create a
3d file like that! I had thought of it but never tested. Those
NETCDF_DIM_* metadata I added to be able to deal with 3d variables in
a clean manner.

I'm afraid you cannot combine several variables (or subdatasets as
gdal calls them) inside one netcdf file with the driver. You should
use other tools for that.  You could, for example, use 'cdo merge
ifile1.nc ifile2.nc ofile.nc'.

See https://code.zmaw.de/projects/cdo/

Etienne
On Mon, Jul 23, 2012 at 11:50 AM, Anton Korosov <anton.korosov at nersc.no> wrote:
> Dear list,
>
> how to create a NetCDF file with several variables that have more than two
> dimensions?
> 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


More information about the gdal-dev mailing list