[GRASS-dev] [GRASS GIS] #3857: r.mapcalc unable to rename null and cell files
GRASS GIS
trac at osgeo.org
Fri May 31 21:21:40 PDT 2019
#3857: r.mapcalc unable to rename null and cell files
----------------------+-------------------------
Reporter: Hygsson | Owner: grass-dev@…
Type: defect | Status: new
Priority: major | Milestone: 7.6.2
Component: Raster | Version: unspecified
Resolution: | Keywords: r.mapcalc
CPU: x86-64 | Platform: MSWindows 7
----------------------+-------------------------
Comment (by hellik):
Replying to [ticket:3857 Hygsson]:
> **Note:** This works on Ubuntu without any problems.
>
> While using GRASS GIS 7.6.1 on 64-bit Windows 7, I encountered a problem
with r.mapcalc. For a simple stochastic simulation of watershed, I used a
following script (here it is recreated for Spearfish dataset).
>
> {{{
> g.region raster=elevation.dem at PERMANENT
> r.surf.random --overwrite output=frequency min=0 max=0
> for (( n=1 ; n<21 ; n=$n+1 ))
> do
> r.surf.random --overwrite output=errors min=-15 max=15
> r.mapcalc "terrain = elevation.dem at PERMANENT + errors at PERMANENT"
--overwrite
> r.watershed --overwrite elevation=terrain at PERMANENT
accumulation=accum$n
> r.reclass --overwrite input=accum$n at PERMANENT output=flow$n
rules=C:/Users/Hygsson/Desktop/test/reclass.rules
> r.mapcalc "frequency = flow$n + frequency" --overwrite
> done
> }}}
>
> reclass.rules file has a following content:
>
> {{{
> -500 thru 654 = 0
> * = 1
> }}}
>
> I tried to do it step by step without using the script. **The problem
arises with this step:**
>
> {{{
> r.mapcalc "frequency = flow$n + frequency" --overwrite
> }}}
>
> I get this output for each iteration of the loop. Only numbers behind
'unknown/' are different.
>
> {{{
> WARNING: Unable to rename null file
>
'C:\Users\Hygsson\Documents\grassdata\Spearfish60_grass7\PERMANENT\.tmp/unknown\22368.1'
> to
>
'C:\Users\Hygsson\Documents\grassdata\Spearfish60_grass7\PERMANENT\cell_misc\frequency\nullcmpr':
> File exists
> WARNING: Unable to rename cell file
>
'C:\Users\Hygsson\Documents\grassdata\Spearfish60_grass7\PERMANENT\.tmp/unknown\22368.0'
> to
>
'C:\Users\Hygsson\Documents\grassdata\Spearfish60_grass7\PERMANENT\fcell\frequency':
> File exists
> }}}
>
> The desired 'frequency' raster is created, but obviously in a wrong
manner, having only one value.
{{{
r.mapcalc "frequency = flow$n + frequency" --overwrite
}}}
it is an operating system issue/feature/limitation of MS windows, that you
are not able to read and write the same file at the same time.
therefore it's not a winGRASS bug.
as Vaclav already mentioned, it may work in linux, but it's not garanteed
that it always work in every linux.
so I tend to a ''won't fix'' of the ticket.
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3857#comment:2>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list