[GRASS-dev] how to deal with the @mapset in scripts?

Carlos "Guâno" Grohmann carlos.grohmann at gmail.com
Mon Jul 2 19:04:20 EDT 2007


I went look in r.shade.relief, so I changed

if [ -z `g.findfile elem=cell file="$GIS_OPT_SLOPE" | grep ^file | cut
-f2 -d=` ] ; then
    g.message -e "<$GIS_OPT_SLOPE> does not exist! Aborting."
    exit 1
fi

by
slope=$GIS_OPT_SLOPE

eval `g.findfile element=cell file=$slope`
if [ -z "$name" ] ; then
   g.message -e  "Map <$slope> not found! Aborting."
   exit 1
fi

and now it works fine.

thanks

Carlos



On 7/2/07, Harri Kiiskinen <harkiisk at utu.fi> wrote:
> On Mon, 2007-07-02 at 22:15 +0100, Carlos "Guâno" Grohmann wrote:
> > Helo all,
> >
> > I am writing some scripts, but I can't make them work with the @mapset
> > in the rasters names. any special trick?
> >
> > there is one script attached.
>
> Hello Carlos,
>
> in g.findfile documentation it says, that the mapset has to be set using
> its own option, and then it will look in that mapset for the file. The
> case 'map1 at mapset1' should be done:
>
> g.findfile element=cell mapset=mapset1 file=map1
>
> whereas your script seems to do:
>
> g.findfile element=cell file='map1 at mapset1'
>
> In the latter case, I guess the g.findfile only looks in the current
> mapset, and even thought there might be a file called 'map1' there
> probably isn't a file called 'map1 at mapset1'. I guess you probably need
> to parse the 'map' option of your script and separate the mapname from
> the mapsetname.
>
> Just my theory,
>
> Harri K.
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev
>


-- 
+-----------------------------------------------------------+
              Carlos Henrique Grohmann - Guano
  Visiting Researcher at Kingston University London - UK
  Geologist M.Sc  - Doctorate Student at IGc-USP - Brazil
Linux User #89721  - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------+
_________________
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke




More information about the grass-dev mailing list