[gdal-dev] editing NetCDF size using GDAL in C++ code

Etienne Tourigny etourigny.dev at gmail.com
Thu Feb 6 09:05:33 PST 2014


For a given dataset, all bands have to be of same dimensions in order to be
treated as a single dataset, and not a number of different datasets.

This is documented in the GDAL data model page, right on top [1].

"A dataset (represented by the
GDALDataset<http://www.gdal.org/classGDALDataset.html> class)
is an assembly of related raster bands and some information common to them
all. In particular the dataset has a concept of the raster size (in pixels
and lines) that applies to all the bands. The dataset is also responsible
for the georeferencing transform and coordinate system definition of all
bands."

[1] http://www.gdal.org/gdal_datamodel.html


I'm sorry but I don't understand what you mean by "In the creation of a
NetCDF I treat subsets as bands.".

Is this file myfile.nc created by gdal? If the above explanation is not
satisfactory, please provide the exact steps you are doing.


cheers, Etienne





On Thu, Feb 6, 2014 at 1:05 PM, Benedetta Onori
<benedetta.onori at gmail.com>wrote:

> In the creation of a NetCDF I treat subsets as bands.
> with gdalinfo I get this:
>
> Subdatasets:
>   SUBDATASET_1_NAME=NETCDF:"myfile.nc":Band1
>   SUBDATASET_1_DESC=[10000x1] Band1 (64-bit floating-point)
>   SUBDATASET_2_NAME=NETCDF:"myfile.nc":Band2
>   SUBDATASET_2_DESC=[10000x1] Band2 (64-bit floating-point)
>   SUBDATASET_3_NAME=NETCDF:"myfile.nc":Band3
>   SUBDATASET_3_DESC=[10000x1] Band3 (64-bit floating-point)
>   SUBDATASET_4_NAME=NETCDF:"myfile.nc":Band4
>   SUBDATASET_4_DESC=[10000x1] Band4 (64-bit floating-point)
> <gdal-dev at lists.osgeo.org>
> So it recognizes bands as netcdf subsets, but with Create( ) only one
> size for all bands is possible and not different sizes for different
> bands-subsets.
>
>
>
> 2014-02-06 Etienne Tourigny <etourigny.dev at gmail.com>:
>
> What do you mean by subsets?  Do you mean datasets (known as variables in
>> netcdf terminology)? If so, there is no way the netcdf driver can create a
>> netcdf file with subdatasets, sorry.
>>
>> A workaround is to use gdal to create a file for each subdataset and then
>> merge them with the nco commandline tools (e.g. ncks -A file1.nc file2.nc
>> ).
>>
>> cheers, Etienne
>>
>>
>> On Thu, Feb 6, 2014 at 10:22 AM, Benedetta Onori <
>> benedetta.onori at gmail.com> wrote:
>>
>>> Hi all,
>>> I have a question about NetCDF writing using GDAL.
>>> The netcdf driver doesn't support the option GA_Update used to edit
>>> dataset, but only GA_ReadOnly.
>>> My question is: during the creation of a new netCDF dataset, how can I differentiate
>>> the sizes of different subsets?
>>> (For example the subset 1 must be 100x100, subset 2 100x1, ...etc...)
>>> Thank you for the attention
>>>
>>> Regards
>>>
>>> b.o.
>>>
>>> _______________________________________________
>>> gdal-dev mailing list
>>> gdal-dev at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>>
>>
>>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140206/09c0cfbd/attachment.html>


More information about the gdal-dev mailing list