[gdal-dev] Writing multi-bands vs multi-datasets
Even Rouault
even.rouault at spatialys.com
Sun Oct 10 14:48:12 PDT 2021
Joaquim,
https://github.com/OSGeo/gdal/pull/4634 should hopefully help
Even
Le 10/10/2021 à 22:26, Joaquim Manuel Freire Luís a écrit :
>
> Hi,
>
> I have a Julia version of gdal_translate (that ends up calling
> GDALDatasetRasterIOEx) that works in saving a MxNxP array, but not the
> way I wanted.
>
> It creates a multi-subdatasets file, whilst what I wished is to write
> a multi-band file.
>
> For example, the file written with this Julia function looks like below
>
> How can I write a multi-band instead of a multi-datasets?
>
> I’ve been looking at the docs of GDALDatasetRasterIOEx but can’t see
> any way of picking one or the other.
>
> Joaquim
>
> gdalinfo cube_rad.nc
>
> Driver: netCDF/Network Common Data Format
>
> Files: cube_rad.nc
>
> Size is 512, 512
>
> Metadata:
>
> NC_GLOBAL#Conventions=CF-1.5
>
> NC_GLOBAL#GDAL=GDAL 3.4.0dev, released 2021/99/99
>
> NC_GLOBAL#history=Sun Oct 10 13:01:06 2021: GDAL CreateCopy(
> cube_rad.nc, ... )
>
> Subdatasets:
>
> SUBDATASET_1_NAME=NETCDF:"cube_rad.nc":Band1
>
> SUBDATASET_1_DESC=[1567x1519] Band1 (32-bit floating-point)
>
> SUBDATASET_2_NAME=NETCDF:"cube_rad.nc":Band2
>
> SUBDATASET_2_DESC=[1567x1519] Band2 (32-bit floating-point)
>
> …
>
> Saving the same data (or similar) from a Matlab code that I wrote long
> ago to stack grids, shows
>
> gdalinfo evi_cube.nc
>
> Driver: netCDF/Network Common Data Format
>
> Files: evi_cube.nc
>
> Size is 37, 59
>
> Origin = (580140.000000000000000,4418550.000000000000000)
>
> Pixel Size = (30.000000000000000,-30.000000000000000)
>
> Metadata:
>
> …
>
> latitude#actual_range={4416795,4418535}
>
> latitude#long_name=latitude
>
> latitude#units=degrees_north
>
> longitude#actual_range={580155,581235}
>
> longitude#long_name=longitude
>
> longitude#units=degrees_east
>
> NC_GLOBAL#Conventions=COARDS
>
> NC_GLOBAL#description=File written from Matlab
>
> NC_GLOBAL#node_offset=0
>
> NC_GLOBAL#Source_Software=Mirone
>
> NC_GLOBAL#title=Grid created by Mirone
>
> NETCDF_DIM_EXTRA={time}
>
> NETCDF_DIM_time_DEF={67,6}
>
> NETCDF_DIM_time_VALUES={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67}
>
> z#actual_range={-856.4703369140625,176.8457641601562}
>
> z#long_name=z
>
> z#units=unknown
>
> z#_FillValue=-nan(ind)
>
> Corner Coordinates:
>
> Upper Left ( 580140.000, 4418550.000)
>
> Lower Left ( 580140.000, 4416780.000)
>
> Upper Right ( 581250.000, 4418550.000)
>
> Lower Right ( 581250.000, 4416780.000)
>
> Center ( 580695.000, 4417665.000)
>
> Band 1 Block=37x59 Type=Float32, ColorInterp=Undefined
>
> NoData Value=nan
>
> Unit Type: unknown
>
> Metadata:
>
> actual_range={-856.4703369140625,176.8457641601562}
>
> long_name=z
>
> NETCDF_DIM_time=1
>
> NETCDF_VARNAME=z
>
> units=unknown
>
> _FillValue=-nan(ind)
>
> Band 2 Block=37x59 Type=Float32, ColorInterp=Undefined
>
> NoData Value=nan
>
> Unit Type: unknown
>
> Metadata:
>
> actual_range={-856.4703369140625,176.8457641601562}
>
> long_name=z
>
> NETCDF_DIM_time=2
>
> NETCDF_VARNAME=z
>
> units=unknown
>
> _FillValue=-nan(ind)
>
> …
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211010/9bd1c627/attachment-0001.html>
More information about the gdal-dev
mailing list