[gdal-dev] Creating NetCDF dataset with sub datasets

Pierre Chatelier pierre at chachatelier.fr
Thu Mar 7 00:47:24 PST 2024


Hello,

I just had my first encounter with a NetCDF file. GDAL opens that 
flawlessly, I can identify the subdatasets and open/read them thanks to 
the SUBDATASET_n_NAME, as advertised in 
https://gdal.org/drivers/raster/netcdf.html

However, I am confused by the ability to create such a file with GDAL.
Let's say I have a bunch of images that I want to pack as NetCDF through 
GDAL.
Should I use bands or groups to let GDAL create the sub datasets ? Will 
GDAL create the metadata SUBDATASETS domain for me ?

The NetCDF file I am supposed to create should use HDF for sub datasets. 
No problem for reading (I have compiled GDAL with the HDF support and it 
works, I can open my sample file), but how do I tell GDAL to *write* 
that ? Should I create real datasets with the GDAL HDF driver and then 
gather them into a single one with GDAL NetCDF driver ?

Can you give some hints about what I am supposed to do ?

Pierre


More information about the gdal-dev mailing list