Hello,
I have a script which imports and processes my data but so far I failed to
export them again.
I looked into Dylans blog concerning batch projection [1] but this did not
help so far.
The problems is within this statement:
for out in *index* ; do
r.out.arc --q in=$out out=${out}_results 2>/dev/null ; done
I tried it as well with 'for out in * ; do' but only the corresponding rasters
of files in my current folder are then exported. Hence this statement asks
for files outside GRASS and not of the current mapset?
Any idea how to export certain rasters in my current mapset?
TIA, Martin
If '*index*' is meant to refer to grass rasters, then you need to say
something like:
for out in `g.list rast` ; do
if [ `echo $out | grep index` ] ; then
# process $out
fi
done
If the raster name should begin with 'index' and not just contain the
string, you can say
if [ `echo $out | grep '^index'` ] ; then
You can use the -i option to grep if you want it to be case-insensitive.
If would be nice if we could pass a file glob pattern to g.list and
have it do the subsetting.
Bruce
On Sun, Aug 24, 2008 at 4:53 AM, Martin Wegmann
<wegmann@biozentrum.uni-wuerzburg.de> wrote:
Hello,
I have a script which imports and processes my data but so far I failed to
export them again.
I looked into Dylans blog concerning batch projection [1] but this did not
help so far.
The problems is within this statement:
for out in *index* ; do
r.out.arc --q in=$out out=${out}_results 2>/dev/null ; done
I tried it as well with 'for out in * ; do' but only the corresponding rasters
of files in my current folder are then exported. Hence this statement asks
for files outside GRASS and not of the current mapset?
Any idea how to export certain rasters in my current mapset?
TIA, Martin
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
--
Bruce Raup
http://cires.colorado.edu/~braup/
Hi,
2008/8/24 Bruce Raup <brauplists@gmail.com>:
If '*index*' is meant to refer to grass rasters, then you need to say
something like:
for out in `g.list rast` ; do
if [ `echo $out | grep index` ] ; then
# process $out
fi
done
you don't need to call `grep` here, just use "pattern" option of g.mlist
g.mlist rast pattern=*index*
Martin
--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *
On Sonntag, 24. August 2008 17:13:17 Martin Landa wrote:
Hi,
2008/8/24 Bruce Raup <brauplists@gmail.com>:
> If '*index*' is meant to refer to grass rasters, then you need to say
> something like:
>
> for out in `g.list rast` ; do
> if [ `echo $out | grep index` ] ; then
> # process $out
> fi
> done
you don't need to call `grep` here, just use "pattern" option of g.mlist
g.mlist rast pattern=*index*
thanks - this worked:
for x in "`g.mlist pattern='*.asc' sep= `" ; do ....
Martin
On Montag, 25. August 2008 19:05:20 Martin Wegmann wrote:
On Sonntag, 24. August 2008 17:13:17 Martin Landa wrote:
> Hi,
>
> 2008/8/24 Bruce Raup <brauplists@gmail.com>:
> > If '*index*' is meant to refer to grass rasters, then you need to say
> > something like:
> >
> > for out in `g.list rast` ; do
> > if [ `echo $out | grep index` ] ; then
> > # process $out
> > fi
> > done
>
> you don't need to call `grep` here, just use "pattern" option of g.mlist
>
> g.mlist rast pattern=*index*
thanks - this worked:
for x in "`g.mlist pattern='*.asc' sep= `" ; do ....
well I was too fast with this statement - it still does not work.
When I do:
for rast in "`g.mlist pattern'*.asc' sep=" "`"; do
echo "$rast.test"; done
I get:
name1.asc name2.asc name3.asc.test
but I need:
name1.asc.test name2.asc.test name3.asc.test
any idea how to achieve that?
Martin
2008/8/26 Martin Wegmann <wegmann@biozentrum.uni-wuerzburg.de>:
> > for out in `g.list rast` ; do
> > if [ `echo $out | grep index` ] ; then
> > # process $out
> > fi
> > done
>
> you don't need to call `grep` here, just use "pattern" option of g.mlist
>
> g.mlist rast pattern=*index*
thanks - this worked:
for x in "`g.mlist pattern='*.asc' sep= `" ; do ....
well I was too fast with this statement - it still does not work.
When I do:
for rast in "`g.mlist pattern'*.asc' sep=" "`"; do
echo "$rast.test"; done
I get:
name1.asc name2.asc name3.asc.test
but I need:
name1.asc.test name2.asc.test name3.asc.test
any idea how to achieve that?
for rast in `g.mlist pattern='*.asc'`; do echo "${rast}.test"; done
Martin
--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *
On Dienstag, 26. August 2008 17:13:18 Martin Landa wrote:
2008/8/26 Martin Wegmann <wegmann@biozentrum.uni-wuerzburg.de>:
>> > > for out in `g.list rast` ; do
>> > > if [ `echo $out | grep index` ] ; then
>> > > # process $out
>> > > fi
>> > > done
>> >
>> > you don't need to call `grep` here, just use "pattern" option of
>> > g.mlist
>> >
>> > g.mlist rast pattern=*index*
>>
>> thanks - this worked:
>>
>> for x in "`g.mlist pattern='*.asc' sep= `" ; do ....
>
> well I was too fast with this statement - it still does not work.
>
> When I do:
>
> for rast in "`g.mlist pattern'*.asc' sep=" "`"; do
> echo "$rast.test"; done
>
> I get:
>
> name1.asc name2.asc name3.asc.test
>
> but I need:
>
> name1.asc.test name2.asc.test name3.asc.test
>
> any idea how to achieve that?
for rast in `g.mlist pattern='*.asc'`; do echo "${rast}.test"; done
great thanks - the 'pattern= ' to default solved it
Martin
--
**********************************************************************
University of Wuerzburg
Institute of Geography
Department of Remote Sensing
Remote Sensing and Biodiversity Unit
Am Hubland
97074 Wuerzburg, Germany
@
German Aerospace Center (DLR)
German Remote Sensing Data Center (DFD)
Phone: +49-(0)931-888-4797
Fax: +49-(0)931-888-4961
Email: martin.wegmann@uni-wuerzburg.de
**********************************************************************
Martin Wegmann wrote:
When I do:
for rast in "`g.mlist pattern'*.asc' sep=" "`"; do
echo "$rast.test"; done
I get:
name1.asc name2.asc name3.asc.test
but I need:
name1.asc.test name2.asc.test name3.asc.test
any idea how to achieve that?
Don't put double quotes around lists (e.g. the result of the g.mlist
command within the backticks above).
If you do:
for rast in "..."; do
you will only get one iteration, regardless of what's inside the
quotes, as a quoted string is a single "word".
--
Glynn Clements <glynn@gclements.plus.com>