[GRASS-user] Odd r.mask behaviour (v6.4.2 and v6.4.3)

I’m getting odd results from using r.mask. The expected behaviour is that when applied it masks off all rasters in the working mapset, however what I’m getting is it only masks off the raster used as a mask.

This doesn’t happen when I create a mask using a different raster, this behaves as expected and masks all rasters in the current mapset.

Detail:

Working mask: reclass of another raster

Not working mask: subset of above, created by applying a mask and using mapcalc (newmap=oldmap).

Any help greatly appreciated!

Mike

On Wed, Feb 25, 2015 at 9:58 AM, Michael Spencer <spencer.mike.r@gmail.com>
wrote:

I'm getting odd results from using r.mask. The expected behaviour is that
when applied it masks off all rasters in the working mapset, however what
I'm getting is it only masks off the raster used as a mask.

This doesn't happen when I create a mask using a different raster, this
behaves as expected and masks all rasters in the current mapset.

Detail:

Working mask: reclass of another raster
Not working mask: subset of above, created by applying a mask and using
mapcalc (newmap=oldmap).

Could you post the actual commands you used?

Thanks,

Anna

Any help greatly appreciated!
Mike

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

No problem.

The working mask is based on a DEM (http://www.ordnancesurvey.co.uk/business-and-government/products/terrain-50.html), created with:

r.reclass input=DEM@Permanent output=DEM_reclass@Permanent rules=elev.txt

elev.txt
0 thru 150 = 0
150 thru 300 = 150
300 thru 450 = 300
450 thru 600 = 450
600 thru 750 = 600
750 thru 900 = 750
900 thru 1050 = 900
1050 thru 1200 = 1050
1200 thru 1500 = 1200

The none working mask uses a raster based on the above, created using:

in A mapset

r.mask -o input=viewshed maskcasts=‘*’

r.mapcalc ‘subset=DEM_reclass@Permanent’

Strictly speaking, this step was done via spgrass6 as I have 145 subsets to apply:
lapply(st[,1], function(i){

Which site?

print(i)

Mask to LOS

system(paste0(“r.mask -o input=”, i, " maskcats=‘*’"))

Reclass via mapcalc

system(paste0(“r.mapcalc '”, i, “_elev=Terrain50_SSGB@PERMANENT’”))
})

However, The rasters I want to mask exist in B mapset and I understand the mask and rasters to be applied to need to be in the same mapset, so I have:

g.copy rast=‘subset@A’,subset

prior to applying the mask

···

On Wed, Feb 25, 2015 at 3:20 PM, Anna Petrášová <kratochanna@gmail.com> wrote:

On Wed, Feb 25, 2015 at 9:58 AM, Michael Spencer <spencer.mike.r@gmail.com> wrote:

I’m getting odd results from using r.mask. The expected behaviour is that when applied it masks off all rasters in the working mapset, however what I’m getting is it only masks off the raster used as a mask.

This doesn’t happen when I create a mask using a different raster, this behaves as expected and masks all rasters in the current mapset.

Detail:

Working mask: reclass of another raster

Not working mask: subset of above, created by applying a mask and using mapcalc (newmap=oldmap).

Could you post the actual commands you used?

Thanks,

Anna

Any help greatly appreciated!

Mike


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

I’ve narrowed the problem down to creating a masked copy using r.mapcalc. The LOS output works fine, but the LOS with elevation values does not. Is there another way to create this? Or can I apply a mask based on the area of one raster and the value of another?

Ta,

Mike

···

On Wed, Feb 25, 2015 at 3:56 PM, Michael Spencer <spencer.mike.r@gmail.com> wrote:

No problem.

The working mask is based on a DEM (http://www.ordnancesurvey.co.uk/business-and-government/products/terrain-50.html), created with:

r.reclass input=DEM@Permanent output=DEM_reclass@Permanent rules=elev.txt

elev.txt
0 thru 150 = 0
150 thru 300 = 150
300 thru 450 = 300
450 thru 600 = 450
600 thru 750 = 600
750 thru 900 = 750
900 thru 1050 = 900
1050 thru 1200 = 1050
1200 thru 1500 = 1200

The none working mask uses a raster based on the above, created using:

in A mapset

r.mask -o input=viewshed maskcasts=‘*’

r.mapcalc ‘subset=DEM_reclass@Permanent’

Strictly speaking, this step was done via spgrass6 as I have 145 subsets to apply:
lapply(st[,1], function(i){

Which site?

print(i)

Mask to LOS

system(paste0(“r.mask -o input=”, i, " maskcats=‘*’"))

Reclass via mapcalc

system(paste0(“r.mapcalc '”, i, “_elev=Terrain50_SSGB@PERMANENT’”))
})

However, The rasters I want to mask exist in B mapset and I understand the mask and rasters to be applied to need to be in the same mapset, so I have:

g.copy rast=‘subset@A’,subset

prior to applying the mask

On Wed, Feb 25, 2015 at 3:20 PM, Anna Petrášová <kratochanna@gmail.com> wrote:

On Wed, Feb 25, 2015 at 9:58 AM, Michael Spencer <spencer.mike.r@gmail.com> wrote:

I’m getting odd results from using r.mask. The expected behaviour is that when applied it masks off all rasters in the working mapset, however what I’m getting is it only masks off the raster used as a mask.

This doesn’t happen when I create a mask using a different raster, this behaves as expected and masks all rasters in the current mapset.

Detail:

Working mask: reclass of another raster

Not working mask: subset of above, created by applying a mask and using mapcalc (newmap=oldmap).

Could you post the actual commands you used?

Thanks,

Anna

Any help greatly appreciated!

Mike


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user