[GRASS-stats] readRAST and mapset consistency with gdal plugin

Ahmadou Dicko dicko.ahmadou at gmail.com
Thu Jun 18 03:36:31 PDT 2015


Dear all,

I'm testing the GRASS GDAL pluging using the rgrass7 package and I
have some issues with the readRAST function with the mapset argument.
Inside readRAST we have  a .read_rast_plugin core function to read the
raster using the plugin that supposed to share the same argument as
readRAST.

However, inside .read_rast_plugin, the mapset argument is always NULL,
since we have a mapset argument in readRAST should not the these two
arguments be the same.

To illustrate what I mean

This what we have:
readRAST <- function(..., mapset = NULL, ...) {
  ....
  .read_rast_plugin(..., mapset = NULL, ...)
}


This is what I think we should have:
readRAST <- function(..., mapset = NULL, ...) {
  ....
  .read_rast_plugin(..., mapset = mapset, ...)
}


Here are the steps to reproduce the bug:
I used the nc_basic_spm_grass7 location and user1 mapset.

In GRASS
g.copy raster=elevation at PERMANENT,elevation
g.region raster=elevation

Then we launch R within the GRASS session

library(rgrass7)
r <- readRAST("elevation", plugin = TRUE, mapset = "user1")
/home/ahmadou/GIS/GRASS/grassdata/nc_basic_spm_grass7/user1/cellhd/elevation
has GDAL driver GRASS
and has 1350 rows and 1500 columns
Warning message:
statistics not supported by this driver

### Still have 'user1' in metadata
r <- readRAST("elevation", plugin = TRUE, mapset = "PERMANENT")
/home/ahmadou/GIS/GRASS/grassdata/nc_basic_spm_grass7/user1/cellhd/elevation
has GDAL driver GRASS
and has 1350 rows and 1500 columns
Warning message:
statistics not supported by this driver

With the corrected version we have:

### Now we have 'PERMANENT' in the path (metadata)
r <- readRAST2("elevation", plugin = TRUE, mapset = "PERMANENT")
/home/ahmadou/GIS/GRASS/grassdata/nc_basic_spm_grass7/PERMANENT/cellhd/elevation
has GDAL driver GRASS
and has 1350 rows and 1500 columns
Warning message:
statistics not supported by this driver

I don't have commit right, should I provide a diff file ?

Best,

-- 
Ahmadou H. DICKO
statistician economist (Ingénieur Statisticien Économiste)
PhD candidate in Climate change economics
Faculty of economics and managment - Cheikh Anta Diop University
West African Science Service Center on Climate Change and Adaptated
Land Use (WASCAL)
Center for Development Research (ZEF) - University of Bonn
email : ahmadou.dicko at ucad.edu.sn
twitter : @dickoah
github : github/dickoa
tel : +221 33 827 55 16
portable: +221 77 123 81 69


More information about the grass-stats mailing list