[gdal-dev] how to create NETCDF with several 3D variables?
Etienne Tourigny
etourigny.dev at gmail.com
Mon Jul 23 11:09:11 PDT 2012
Chris is right - the netcdf driver in gdal was designed to read netcdf
data and create netcdf files from other formats, not write complex
files.
Anything else is a hack - better to use other tools if you want to
combine bands, variables, etc.
Etienne
On Mon, Jul 23, 2012 at 2:07 PM, Chris Barker <chris.barker at noaa.gov> wrote:
> 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
> _______________________________________________
> 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