<p dir="ltr">Siebe,</p>
<p dir="ltr">There are many ways to aggregate. What do you want? Just one band summing each pixel stack?</p>
<p dir="ltr">Best regards,</p>
<div class="gmail_quote">On Jun 14, 2013 3:55 AM, "Siebe Bosch" <<a href="mailto:siebe@hydroconsult.nl">siebe@hydroconsult.nl</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Hi List,<br>
<br>
The question was originally mine. Thanks to Paul for posting it.<br>
Here's what I did (calling GDAL tools from <a href="http://VB.NET" target="_blank">VB.NET</a>):<br>
<ol>
<li>Warping the NetCDF-file to match my desired co-ordinate
system and crop the image.<br>
<br>
outputFile = OutputDir & "\" & Str(OrderNum).Trim
& "_NSL_" & Str(i).Trim & ".nc"<br>
myArgs = " -of NetCDF -dstnodata -999 -te " & Xmin & "
" & Ymin & " " & Xmax & " " & Ymax &
" -tr 1000 1000 -s_srs " & Chr(34) & "+proj=stere
+x_0=0 +y_0=0 +lat_0=90 +lon_0=0 +lat_ts=60 +a=6378.388
+b=6356.906" & Chr(34) & " -t_srs " & Chr(34)
& "EPSG:28992" & Chr(34) & " " & myPath &
" " & outputFile<br>
ProcessCollection.Add(Process.Start(GDALToolsDir &
"\bin\gdalwarp.exe", myArgs))<br>
<br>
</li>
<li>Translating the 24 bands to .ASC<br>
<br>
outputFile = myPath.Replace(".nc", ".asc")<br>
myArgs = "-of AAIGrid -sds " & myPath & " " &
outputFile 'exports all 24 subdatasets<br>
ProcessCollection.Add(Process.Start(GDALToolsDir &
"\bin\gdal_translate.exe", myArgs))<br>
</li>
</ol>
<br>
Now this results in 24 ASC rasters: outputFile.asc1,
outputFile.asc2, outputFile.asc3 etc. through outputFile.asc24.<br>
<br>
By itself this is absolutely great because it gives me access to
each band. <br>
My question however is still: how can I (1.) aggregate the values
for all 24 bands into one band and (2.) write it to an .ASC<br>
<br>
Thanks,<br>
Siebe<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
On 14-06-13 08:04, Paul Meems wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>Hi Even,<br>
<br>
</div>
I've just tried and I get this result:<br>
Warning 1: dimension #2 (x) is not a Longitude/X
dimension.<br>
Warning 1: dimension #1 (y) is not a Latitude/Y
dimension.<br>
Input file size is 257, 329<br>
ERROR 6: AAIG driver doesn't support 24 bands. Must be
1 band.<br>
<br>
</div>
So you are right, it doesn't work.<br>
<br>
</div>
I don't need an ASCII grid, a different format is also OK.
But I do need all bands combined/aggregated.<br>
</div>
Do you have a different suggestion?<br>
<br>
</div>
Or should I read (using Python or similar) each band/pixel and
manual aggregate them?<br>
<br>
<div>
<div>
<div class="gmail_extra">Thanks,
<div><br>
<br>
Paul<br>
<br>
<div style="font-size:13.3px;font-family:Verdana,Arial,Helvetica,sans-serif">
<div style="border:1px solid #e5e5e5;background-color:#f8f8f8;padding:0.8em 0.8em 0.3em 0.8em">
<div style="margin:0 0 8px 0">
<p style="margin:0">
<span><b><img style="float:left;margin-left:5px;margin-right:5px" src="http://www.bontepaarden.nl/bontepaarden/images/newButton.png" alt="" height="120" width="160">Paul
Meems </b><br>
<span>Release manager, configuration manager</span><br>
<span>and forum moderator of MapWindow GIS.</span><br>
<a href="http://www.mapwindow.org/" target="_blank"><span>www.mapwindow.org</span></a><br>
<br>
<span>Owner of MapWindow.nl - Support for</span><br>
<span>Dutch speaking users.</span><br>
<a href="http://www.mapwindow.nl/" target="_blank"><span>www.mapwindow.nl</span></a><br>
</span></p>
<p style="margin:0"><b><br>
</b></p>
</div>
</div>
<img height="1" width="1"></div>
</div>
<br>
<br>
<div class="gmail_quote">2013/6/13 Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@mines-paris.org" target="_blank">even.rouault@mines-paris.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Le jeudi 13 juin 2013 15:54:42, Etienne Tourigny a
écrit :<br>
<div>> that should be a simple as<br>
><br>
> gdal_translate -of AAIGrid <a href="http://in.nc" target="_blank">in.nc</a> out.asc<br>
<br>
</div>
Except that AAIGrid only supports 1-band datasets. I
can't think of a ASCII<br>
based format that supports multi-band datasets.<br>
<div>
<div><br>
><br>
> On Thu, Jun 13, 2013 at 8:32 AM, Paul Meems
<<a href="mailto:bontepaarden@gmail.com" target="_blank">bontepaarden@gmail.com</a>>
wrote:<br>
> > Hi list,<br>
> ><br>
> > I have a netCDF file with 24 bands.<br>
> > I want to create a new (ASCII) grid with
the bands aggregated.<br>
> > Is this possible using the gdal tools or
with an existing python script?<br>
> ><br>
> > Thanks,<br>
> ><br>
> > Paul<br>
> ><br>
> >
_______________________________________________<br>
> > gdal-dev mailing list<br>
> > <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
> > <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
<br>
</div>
</div>
<span><font color="#888888">--<br>
Geospatial professional services<br>
<a href="http://even.rouault.free.fr/services.html" target="_blank">http://even.rouault.free.fr/services.html</a><br>
</font></span></blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></pre>
</blockquote>
<br>
<br>
<pre cols="72">--
---------------------------------------
Hydroconsult
Lulofsstraat 55, unit 47
2521 AL Den Haag
The Netherlands
web: <a href="http://www.hydroconsult.nl" target="_blank">http://www.hydroconsult.nl</a>
e-mail: <a href="mailto:siebe@hydroconsult.nl" target="_blank">siebe@hydroconsult.nl</a>
phone: <a href="tel:%2B31%280%2970%20250%200580" value="+31702500580" target="_blank">+31(0)70 250 0580</a>
mobile: <a href="tel:%2B31%280%296%2017%20682%20689" value="+31617682689" target="_blank">+31(0)6 17 682 689</a>
fax: <a href="tel:%2B31%280%2984%20728%208946" value="+31847288946" target="_blank">+31(0)84 728 8946</a>
---------------------------------------</pre>
</div>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div>