<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<p>Joaquim,</p>
<p><a class="moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/pull/4634">https://github.com/OSGeo/gdal/pull/4634</a> should hopefully help</p>
<p>Even<br>
</p>
<div class="moz-cite-prefix">Le 10/10/2021 à 22:26, Joaquim Manuel
Freire Luís a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:VI1PR04MB3966F137C5BCA46D7001B416A6B49@VI1PR04MB3966.eurprd04.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">It creates a
multi-subdatasets file, whilst what I wished is to write a
multi-band file.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">For example, the file
written with this Julia function looks like below<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">How can I write a
multi-band instead of a multi-datasets?
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I’ve been looking at the
docs of GDALDatasetRasterIOEx but can’t see any way of
picking one or the other.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Joaquim<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">gdalinfo cube_rad.nc<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Driver: netCDF/Network
Common Data Format<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Files: cube_rad.nc<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Size is 512, 512<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Metadata:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
NC_GLOBAL#Conventions=CF-1.5<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> NC_GLOBAL#GDAL=GDAL
3.4.0dev, released 2021/99/99<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> NC_GLOBAL#history=Sun
Oct 10 13:01:06 2021: GDAL CreateCopy( cube_rad.nc, ... )<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Subdatasets:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
SUBDATASET_1_NAME=NETCDF:"cube_rad.nc":Band1<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
SUBDATASET_1_DESC=[1567x1519] Band1 (32-bit floating-point)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
SUBDATASET_2_NAME=NETCDF:"cube_rad.nc":Band2<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
SUBDATASET_2_DESC=[1567x1519] Band2 (32-bit floating-point)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">…<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Saving the same data (or
similar) from a Matlab code that I wrote long ago to stack
grids, shows<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">gdalinfo evi_cube.nc<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Driver: netCDF/Network
Common Data Format<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Files: evi_cube.nc<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Size is 37, 59<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Origin =
(580140.000000000000000,4418550.000000000000000)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Pixel Size =
(30.000000000000000,-30.000000000000000)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Metadata:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">…<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
latitude#actual_range={4416795,4418535}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
latitude#long_name=latitude<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
latitude#units=degrees_north<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
longitude#actual_range={580155,581235}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
longitude#long_name=longitude<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
longitude#units=degrees_east<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
NC_GLOBAL#Conventions=COARDS<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
NC_GLOBAL#description=File written from Matlab<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
NC_GLOBAL#node_offset=0<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
NC_GLOBAL#Source_Software=Mirone<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> NC_GLOBAL#title=Grid
created by Mirone<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
NETCDF_DIM_EXTRA={time}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
NETCDF_DIM_time_DEF={67,6}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
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}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
z#actual_range={-856.4703369140625,176.8457641601562}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> z#long_name=z<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> z#units=unknown<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> z#_FillValue=-nan(ind)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Corner Coordinates:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Upper Left (
580140.000, 4418550.000)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Lower Left (
580140.000, 4416780.000)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Upper Right (
581250.000, 4418550.000)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Lower Right (
581250.000, 4416780.000)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Center (
580695.000, 4417665.000)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Band 1 Block=37x59
Type=Float32, ColorInterp=Undefined<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> NoData Value=nan<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Unit Type: unknown<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Metadata:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
actual_range={-856.4703369140625,176.8457641601562}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> long_name=z<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> NETCDF_DIM_time=1<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> NETCDF_VARNAME=z<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> units=unknown<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> _FillValue=-nan(ind)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Band 2 Block=37x59
Type=Float32, ColorInterp=Undefined<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> NoData Value=nan<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Unit Type: unknown<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Metadata:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">
actual_range={-856.4703369140625,176.8457641601562}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> long_name=z<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> NETCDF_DIM_time=2<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> NETCDF_VARNAME=z<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> units=unknown<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> _FillValue=-nan(ind)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">…<o:p></o:p></span></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>