[gdal-dev] Creating NetCDF dataset with sub datasets

Pierre Chatelier pierre at chachatelier.fr
Tue Mar 12 05:33:24 PDT 2024


>
>> 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.


Sounds good, doesn't work.
Actually, band->SetMetadataItem("NETCDF_VARNAME","somename...") does not 
raise any error and I tracked with a debugger that it goes down to  
GDALMultiDomainMetadata::SetMetadataItem() and really calls 
CPLStringList::AddNameValue(),

but when reading the saved dataset file created by the netCDF driver, 
SUBDATASET_<i>_NAME are still "netcdf:<file>:Band1, Band2..."

I am still investigating to see if it might be related to the wrong 
domain, but so far I can't tell.

Pierre


More information about the gdal-dev mailing list