<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2018-05-29 14:09 GMT+02:00 Markus Metz <span dir="ltr"><<a href="mailto:markus.metz.giswork@gmail.com" target="_blank">markus.metz.giswork@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Roberta,<span class=""><br><br>On Tue, May 29, 2018 at 1:41 PM, Moritz Lennert <<a href="mailto:mlennert@club.worldonline.be" target="_blank">mlennert@club.worldonline.be</a>> wrote:<br>><br>> Hi Roberta,<br>><br>> Le Tue, 29 May 2018 13:16:48 +0200,<br>> Roberta Fagandini <<a href="mailto:robifagandini@gmail.com" target="_blank">robifagandini@gmail.com</a>> a écrit :<br>><br>> > Hi all!<br>> > I'm working on the GUI of my module for clouds and shadows detection<br>> > in Sentinel 2 images  (GSoC 2018 project) and I have some trouble<br>> > with the automatic addition of the mapset name in the output maps.<br>> > I have several input bands imported in GRASS that I convert into float<br>> > value and rescale using r.mapcalc, each output map should be<br>> > automatically named with the inputs band name and a suffix (e.g.<br>> > input: nir - output: nir_float).<br>> > When I run the script using the GUI I have an error due to the @mapset<br>> > automatically added to the output map name (e.g. nir@mymapset_float).<br>> ><br>> > At the moment, I solved the problem with a replace() function but I'm<br>> > not sure this can be the best solution, do you have any hint?<br>><br>> A classic solution that you will find in many scripts is using split():<br>><br>> mapname_without_mapset = mapname_with_mapset.split('@')<wbr>[0]<br><div><br></div></span><div>there is find_file() in lib/python/script/core.py with returns a dictionary of keys/values including the name without mapset</div><div><br></div><div>Markus M</div></div></blockquote><div><br></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">With find_file it should work also for maps in different mapset. </span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Roberta can you test it?</span><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">R</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class=""><div><br></div><div>></div>> Moritz<br>> ______________________________<wbr>_________________<br>> grass-dev mailing list<br>> <a href="mailto:grass-dev@lists.osgeo.org" target="_blank">grass-dev@lists.osgeo.org</a><br>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-dev" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/grass-dev</a><br><br></span></div>
<br>______________________________<wbr>_________________<br>
grass-dev mailing list<br>
<a href="mailto:grass-dev@lists.osgeo.org">grass-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/grass-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/grass-dev</a><br></blockquote></div><br></div></div>