[GRASS-user] Export multiple files with r.out.arc

Micha Silver micha at arava.co.il
Thu May 31 09:44:54 PDT 2012


On 05/31/2012 07:23 PM, Daniel Lee wrote:
> I'll have to defer that to the list, I'm not too good at bash scripting:
>
>     Well, yes I was thinking to that but I don't know exactly how to
>     do it. I mean, till now with:
>     g.mlist -r type=rast pattern='fill_mnat'
>     I have managed to see all rasters that I want to export (fill_mnat
>     - is contained in the middle of the name of all files for export).
>     Next I think I have to run something like:
>     for map in g.mlist -r type=rast pattern='fill_mnat' do r.out.arc
>     input=$map output='basemap $map .asc' done but nothing happens. Is
>     this the correct command line?
>
>

Try like this:

RASTS=`g.mlist rast pat="*fill_mnat*"`
for r in $RASTS; do
     echo "Processing raster $r"
     g.region rast=$r
     r.out.asc $r out=$r.asc
done

Note the backticks (`) in the first line.
Also, be aware that some software reads the asc header as cell *centers* 
and some as cell *corners*. GRASS outputs each pixel to the asc file as 
cell corners. If you need it as centers, add a '-c' to the r.out.asc 
command.

> This mail was received via Mail-SeCure System.
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
> This mail was received via Mail-SeCure System.
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20120531/0fb95612/attachment.html>


More information about the grass-user mailing list