[GRASS-dev] Adding a suffix for output raster map names

Anna Petrášová kratochanna at gmail.com
Fri Nov 14 07:11:23 PST 2014


On Fri, Nov 14, 2014 at 9:40 AM, Nikos Alexandris <nik at nikosalexandris.net>
wrote:

> Using the following in a python script's header
>
> #%option
> #% key: outputsuffix
> #% key_desc: suffix string
> #% type: string
> #% description: Suffix for the Pan-Sharpened image(s)
> #% required: yes
> #% answer: hpf
> #%end
>
> and somewhere in the script the following
>
> run("g.rename", rast=(tmp_msx_hpf,"%s.%s" % (msx, outputsuffix)))
>
> works fine in the command line. Testing the modules wx-GUI (G70), doesn't
> play nice. For exampe,
> the following WARNING (error) appears:
>
> WARNING: Illegal filename <12DEC02053035.blue at python_scripting.hpf>.
> Character <@> not allowed.
> WARNING: <12DEC02053035.blue at python_scripting.hpf> is an illegal file name
>
> The "suffix" is added after the Mapset's name(string). Is there no option
> to "fix" this? Should I "fix" this in my code directly, i.e. take the
> string, split-off the Mapset-part, put in the suffix and add the Mapset's
> name in the end?
>

I would say you have to expect that your input map may have mapset, test
it, split if necessary and add suffix to the map name, but you might not
need to add the mapset again to the name.

Anna

>
> Thank you, Nikos
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20141114/d5867ddc/attachment.html>


More information about the grass-dev mailing list