Opened 10 years ago
Closed 8 years ago
#2445 closed defect (fixed)
r.mask -r removal not working in GRASS 7.1 svn r.62210
Reported by: | baharmon | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.2.0 |
Component: | Raster | Version: | svn-trunk |
Keywords: | r.mask | Cc: | |
CPU: | Unspecified | Platform: | MSWindows 8 |
Description
r.mask -r doesn't seem to work.
Attachments (1)
Change History (16)
comment:1 by , 10 years ago
Component: | Default → Raster |
---|---|
Keywords: | r.mask added |
comment:2 by , 10 years ago
comment:3 by , 10 years ago
Platform: | Unspecified → MSWindows 8 |
---|
comment:4 by , 10 years ago
I'm using Windows 8.1. There was no error message.
r.mask -r Raster MASK removed (Thu Oct 09 17:34:34 2014) Command finished (0 sec)
The map display however still shows the mask and the there is the red 'MASK' tag in the lower right corner of the display. After re-rendering there is still the mask.
follow-up: 6 comment:5 by , 10 years ago
It's because the mask was created from raster map 'mask' (lowercase). So on Windows, there is I guess no way how to distinguish it. Wontfix? Should we put it in r.mask manual?
follow-up: 7 comment:6 by , 10 years ago
Replying to annakrat:
Wontfix?
No. If a map is recognised as a mask by Rast__check_for_auto_masking()
, then r.mask -r
should remove it.
On Windows, remove("MASK") will remove a file named "MASK", "mask", "Mask", "MaSK" or any other variation (you can't have more than one of those in any given directory).
Does g.remove type=rast pattern=MASK
remove the file? If not, that's a bug in g.remove. Indeed, this appears to be the problem.
Looking at source:grass/trunk/lib/gis/ls_filter.c#L151, regcomp() should probably be using REG_ICASE on Windows (and also on Unix if GISDBASE is on a case-insensitive filesystem, but that's easier said than done).
IOW, this bug is a consequence of replacing g.remove with g.mremove; the former doesn't care about case, the latter does.
comment:7 by , 10 years ago
Replying to glynn:
Replying to annakrat:
Wontfix?
No. If a map is recognised as a mask by
Rast__check_for_auto_masking()
, thenr.mask -r
should remove it.On Windows, remove("MASK") will remove a file named "MASK", "mask", "Mask", "MaSK" or any other variation (you can't have more than one of those in any given directory).
Does
g.remove type=rast pattern=MASK
remove the file? If not, that's a bug in g.remove. Indeed, this appears to be the problem.
I haven't tested specifically this command but r.mask is using it for removing the mask.
comment:9 by , 8 years ago
Could anyone test this on Windows, i.e. create a raster file named mask (lowercase) and then attempt 'g.remove type=rast pattern=MASK -f' and 'g.remove -i type=rast pattern=MASK' ?
And if the first doesn't work, but the second does could the following lines in r.mask:
grass.run_command('g.remove', flags='f', quiet=True, type='raster', name='MASK')
be replaced by
grass.run_command('g.remove', flags='fi', quiet=True, type='raster', name='MASK')
if we are in Windows ?
follow-up: 11 comment:10 by , 8 years ago
Confirmed on Win7.
g.remove type=rast pattern=MASK -f does not remove a map "mask" on Windows, while g.remove -fi type=rast pattern=MASK does.
by , 8 years ago
Attachment: | rmask_windows.diff added |
---|
patch to make removal of 'MASK' raster map case insensitive on Windows
comment:11 by , 8 years ago
Replying to sbl:
Confirmed on Win7.
g.remove type=rast pattern=MASK -f does not remove a map "mask" on Windows, while g.remove -fi type=rast pattern=MASK does.
Ok. I've attached a patch that AFAICT should check for Windows and then make the g.remove call case insensitive.
Please test.
Moritz
follow-up: 14 comment:13 by , 8 years ago
comment:14 by , 8 years ago
comment:15 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I check on Linux, no problem:
Which operating system are you using? And: what is the error?