Re: [gdal-dev] Creating NetCDF dataset with sub datasets

2024-03-12 Thread Pierre Chatelier via gdal-dev
My investigation, might be an issue for the github : band->SetMetadataItem("NETCDF_VARNAME", "foo"); will generate a netCDF band name of "foo1" because there must be a non-null papszExtraDimNames for some reason (netcdfdatasetp.cpp:9630) However -in order for "papszExtraDimNames" to be

Re: [gdal-dev] Creating NetCDF dataset with sub datasets

2024-03-12 Thread Pierre Chatelier via gdal-dev
Le 12/03/2024 à 13:48, Even Rouault a écrit : Le 12/03/2024 à 13:33, Pierre Chatelier a écrit : But I can't figure out how to customize the , which is Band1, Band2, Band3... I tried GDALRasterBand::SetDescription(), but without success Looking at netcdfdataset.cpp line 9625, the netCDF

Re: [gdal-dev] Creating NetCDF dataset with sub datasets

2024-03-12 Thread Even Rouault via gdal-dev
Le 12/03/2024 à 13:33, Pierre Chatelier a écrit : But I can't figure out how to customize the , 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

Re: [gdal-dev] Creating NetCDF dataset with sub datasets

2024-03-12 Thread Pierre Chatelier via gdal-dev
But I can't figure out how to customize the , 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

Re: [gdal-dev] Creating NetCDF dataset with sub datasets

2024-03-12 Thread Pierre Chatelier via gdal-dev
Ok, I can confirm that -creating a dataset with bands with the netCDF driver works -saving the dataset will write the expected "SUBDATASETS" domain with "SUBDATASET__NAME=NETCDF:"":"" But I can't figure out how to customize the , which is Band1, Band2, Band3... I tried

Re: [gdal-dev] Creating NetCDF dataset with sub datasets

2024-03-12 Thread Even Rouault via gdal-dev
Pierre, Le 12/03/2024 à 12:51, Pierre Chatelier a écrit : Ok, I can confirm that -creating a dataset with bands with the netCDF driver works -saving the dataset will write the expected "SUBDATASETS" domain with "SUBDATASET__NAME=NETCDF:"":"" But I can't figure out how to customize the ,

Re: [gdal-dev] Creating NetCDF dataset with sub datasets

2024-03-07 Thread Even Rouault via gdal-dev
Hi, If your input dataset has multiple bands, each band will be written as a separate netCDF variable, and thus read as multiple subdatasets. The constraint is that as your input is a single raster, all bands must share the same georeferencing. If you want to write multiple independent

[gdal-dev] Creating NetCDF dataset with sub datasets

2024-03-07 Thread Pierre Chatelier via gdal-dev
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