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

Carlos "Guâno" Grohmann carlos.grohmann at gmail.com
Tue Jul 3 10:18:48 EDT 2007


I said it worked but I shouldn't.
the @mapset is not a problem when the maps are used by some command,
like r.mapcalc, bu it is a problem because the default output map (if
you don't give a name) will be based on the input, like:
input : in_map
output : in_map_roughness_3x3

so I need to get rid of the @mapset, or else it will be set to

in_map at mapset_roughness_3x3

and r.mapcalc will fail.


Carlos

On 7/3/07, Carlos Guâno Grohmann <carlos.grohmann at gmail.com> wrote:
> I just copied the stuff from r.shaded.relief..
>
>
>
> On 7/3/07, Glynn Clements <glynn at gclements.plus.com> wrote:
> >
> > "Carlos \"Guâno\" Grohmann" wrote:
> >
> > > 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.
> >
> > Why do you actually need to use g.findfile? In most cases, you should
> > just pass the map name directly to the command, and let the command
> > handle the checking.
> >
> > Also, if you use g.parser and the options have the appropriate
> > "gisprompt" setting, g.parser will perform the relevant checks, so
> > there's no need to repeat them.
> >
> > --
> > Glynn Clements <glynn at gclements.plus.com>
> >
>
>
> --
> +-----------------------------------------------------------+
>               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
>


-- 
+-----------------------------------------------------------+
              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