Pierre,

Le 12/03/2024 à 12:51, Pierre Chatelier a écrit :
Ok, I can confirm that
-creating a dataset with <n> bands with the netCDF driver works
-saving the dataset will write the expected "SUBDATASETS" domain with "SUBDATASET_<i>_NAME=NETCDF:"<file>":"<band name>"

But I can't figure out how to customize the <band name>, which is Band1, Band2, Band3...
I tried GDALRasterBand::SetDescription(), but without success

Looking at netcdfdataset.cpp line 9625, the netCDF variable name for a band is extracted from the NETCDF_VARNAME band metadata item of the source band.


Also, is there a reason why AddBand() is not supported by the netCDF driver ? I expected it to be able to add bands on demand as new "netcdf variables".

I guess that could be implemented. There would be a subtlety however:

- if CreateCopy() has been invoked with NETCDF_DIM_EXTRA_xxx, NETCDF_DIM_xxx_DEF metadata items, to ask for bands to be modeled as a dimension (for example the time dimension of a 3D variable), that would require the band dimension to be created as UNLIMITED however at dataset creation.

- otherwise for 2D variables, yes, implementing AddBand() should be relatively straighforward ... hopefully ... (please don't sue me, if it is not. The netCDF driver has its peculiarities...)

Even

--
http://www.spatialys.com
My software is free, but my time generally not.

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to