readRAST and mapset consistency with gdal plugin

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

readRAST and mapset consistency with gdal plugin

ahmadou dicko
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@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 : [hidden email]
twitter : @dickoah
github : github/dickoa
tel : +221 33 827 55 16
portable: +221 77 123 81 69
_______________________________________________
grass-stats mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-stats
Reply | Threaded
Open this post in threaded view
|

Re: readRAST and mapset consistency with gdal plugin

RKrug
Ahmadou Dicko <[hidden email]> writes:

> 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.

My fault - I forgot the mapset.

I just uploaded a fix - Thanks Ahmadou - exactly as you suggested.

Cheers,

Rainer


>
> 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@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,
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      [hidden email]

Skype:      RMkrug

PGP: 0x0F52F982

_______________________________________________
grass-stats mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-stats

signature.asc (490 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: readRAST and mapset consistency with gdal plugin

ahmadou dicko
Thanks Rainer, everything works as expected.

Cheers,

On Thu, Jun 18, 2015 at 4:33 PM, Rainer M Krug <[hidden email]> wrote:

> Ahmadou Dicko <[hidden email]> writes:
>
>> 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.
>
>
> My fault - I forgot the mapset.
>
> I just uploaded a fix - Thanks Ahmadou - exactly as you suggested.
>
> Cheers,
>
> Rainer
>
>
>>
>> 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@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,
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
>
> Tel :       +33 - (0)9 53 10 27 44
> Cell:       +33 - (0)6 85 62 59 98
> Fax :       +33 - (0)9 58 10 27 44
>
> Fax (D):    +49 - (0)3 21 21 25 22 44
>
> email:      [hidden email]
>
> Skype:      RMkrug
>
> PGP: 0x0F52F982



--
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 : [hidden email]
twitter : @dickoah
github : github/dickoa
tel : +221 33 827 55 16
portable: +221 77 123 81 69
_______________________________________________
grass-stats mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-stats