[GRASS-dev] Understanding g.tempfile and resolving "Illegal filename" issues

Hamish hamish_b at yahoo.com
Thu Nov 14 13:02:50 PST 2013


Nikos wrote:
 > I don't understand how to use g.tempfile. The manual simply refers to (for
> bash): temp1=`g.tempfile pid=$$`
>
> My attempts to use it like that, end up with: "Illegal filename. Character
> </> not allowed."  Checking if the map's "filename" exists,
> returns for example:
>
> --%<---
> ERROR: Raster map
>       </mnemosyne/geo/grassdb/nc_spm_08/landsat/.tmp/Resilience/26834.0>
>       not found in current mapset
> --->%--
>
> I have been through the mailing list and have found past references to the
> same problem. For example
> <http://lists.osgeo.org/pipermail/grass-user/2012-March/063977.html>.
> However, I can't get past the problem.
>
> I tried to use naming conventions such as "i.fusion.hpf.tmp.$$" but I
> still have some problems. I would like to use g.tempfile as it seems
> to be a "cleaner" way(?).

g.tempfile is for actual files like ascii text files, not for map names.

the convention used in the grass scripts for temporary map names is arbitrary,
but e.g. the g.module command might make one called: tmp_gmodule.$$.elev,
for vector maps replace '.' with '_' and bring out your curly brackets. :)

then cleanup is as simple as g.mremove 'tmp_gmodule.$$.*', and if maps
are left behind it's obvious later that they are temporary and where they
came from.

there's no automatic handling, but I don't see where that would save any time.


what problems did you have with "i.fusion.hpf.tmp.$$" ?


Hamish



More information about the grass-dev mailing list