[GRASS-user] Importing multiple files with r.in.xyz

Hanlie Pretorius hanlie.pretorius at gmail.com
Wed Aug 11 08:10:45 EDT 2010


My apologies for my ignorance, but how do I get this to run in Linux?
Am using Ubuntu 10.04 and GRASS 6.4RC6.

I entered the following into the GRASS text window and am testing it
with a list of two files (I removed the region settings because the
files all have the same region, which I have already set):
-----
GRASS 6.4.0RC6 (world_wgs84):~ > cat lieb_files_test.txt
3B42.000201.12.6.nc.lieb.txt
3B42.000201.15.6.nc.lieb.txt
GRASS 6.4.0RC6 (world_wgs84):~ > cat lieb_files_test.txt | while read line; do
>  echo $line+" being processed"
> raster=${$line:(-12)} # cut ".nc.lieb.txt" from raster name
> r.in.xyz --overwrite input=$line output=raster method="mean" type="FCELL" fs=, x=2 y=1 z=3
>
-----

As you can see, when I press enter after the r.in.xyz line, I just get
another prompt.

Am I supposed to save it to a separate file and run this as a script?
If so, where should I put this script?


2010/8/10, Saber Razmjooei <razmjooeis at faunalia.co.uk>:
>
> cat list_of_files.txt | while read line; do
>     echo $line+"Being processed" # or whaterver you want to do with the
> $line variable
>  raster=$line
>  r.in.xyz -s -g input=$line output=$line > tmpRegion
> myregion= ""`head -n 1 tmpRegion`"
> g.region $myregion
> r.in.xyz --overwrite input=$line output=$line fs=,
> done
>
> and your list_of_files.txt is
> raster1
> raster2
> .....
>
> Hope that helps
> Saber


More information about the grass-user mailing list