<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">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 VB.NET):<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
cite="mid:CAHNf2YS4kOUMtSPxMa6k+P5KpyrtovuXch3+6y4A4gaCa9jivQ@mail.gmail.com"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
src="imap://siebe@mail.hydroconsult.nl:143/fetch%3EUID%3E.INBOX.Drafts%3E2302?p=mozilla&v=3.9.12&t=1322134056890&u=482737fd0c4ca423"
height="1" width="1"></div>
</div>
<br>
<br>
<div class="gmail_quote">2013/6/13 Even Rouault <span
dir="ltr"><<a moz-do-not-send="true"
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 class="im">> that should be a simple as<br>
><br>
> gdal_translate -of AAIGrid <a
moz-do-not-send="true" 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 class="HOEnZb">
<div class="h5"><br>
><br>
> On Thu, Jun 13, 2013 at 8:32 AM, Paul Meems
<<a moz-do-not-send="true"
href="mailto:bontepaarden@gmail.com">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 moz-do-not-send="true"
href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
> > <a moz-do-not-send="true"
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 class="HOEnZb"><font color="#888888">--<br>
Geospatial professional services<br>
<a moz-do-not-send="true"
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 class="mimeAttachmentHeader"></fieldset>
<br>
<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="http://lists.osgeo.org/mailman/listinfo/gdal-dev">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
---------------------------------------
Hydroconsult
Lulofsstraat 55, unit 47
2521 AL Den Haag
The Netherlands
web: <a class="moz-txt-link-freetext" href="http://www.hydroconsult.nl">http://www.hydroconsult.nl</a>
e-mail: <a class="moz-txt-link-abbreviated" href="mailto:siebe@hydroconsult.nl">siebe@hydroconsult.nl</a>
phone: +31(0)70 250 0580
mobile: +31(0)6 17 682 689
fax: +31(0)84 728 8946
---------------------------------------</pre>
</body>
</html>