[GRASS-dev] Avoid the addition of @mymapset in output map name

Roberto Marzocchi roberto.marzocchi at gmail.com
Thu May 31 06:08:12 PDT 2018


2018-05-29 14:09 GMT+02:00 Markus Metz <markus.metz.giswork a gmail.com>:

> Hi Roberta,
>
> On Tue, May 29, 2018 at 1:41 PM, Moritz Lennert <
> mlennert a club.worldonline.be> wrote:
> >
> > Hi Roberta,
> >
> > Le Tue, 29 May 2018 13:16:48 +0200,
> > Roberta Fagandini <robifagandini a gmail.com> a écrit :
> >
> > > Hi all!
> > > I'm working on the GUI of my module for clouds and shadows detection
> > > in Sentinel 2 images  (GSoC 2018 project) and I have some trouble
> > > with the automatic addition of the mapset name in the output maps.
> > > I have several input bands imported in GRASS that I convert into float
> > > value and rescale using r.mapcalc, each output map should be
> > > automatically named with the inputs band name and a suffix (e.g.
> > > input: nir - output: nir_float).
> > > When I run the script using the GUI I have an error due to the @mapset
> > > automatically added to the output map name (e.g. nir a mymapset_float).
> > >
> > > At the moment, I solved the problem with a replace() function but I'm
> > > not sure this can be the best solution, do you have any hint?
> >
> > A classic solution that you will find in many scripts is using split():
> >
> > mapname_without_mapset = mapname_with_mapset.split('@')[0]
>
> there is find_file() in lib/python/script/core.py with returns a
> dictionary of keys/values including the name without mapset
>
> Markus M
>

With find_file it should work also for maps in different mapset.
Roberta can you test it?

R



>
> >
> > Moritz
> > _______________________________________________
> > grass-dev mailing list
> > grass-dev a lists.osgeo.org
> > https://lists.osgeo.org/mailman/listinfo/grass-dev
>
>
> _______________________________________________
> grass-dev mailing list
> grass-dev a lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-dev
>
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20180531/5d65a600/attachment-0001.html>


More information about the grass-dev mailing list