[GRASS-stats] wish: less verbose messages in rgrass7

Rainer M Krug Rainer at krugs.de
Thu Sep 10 00:31:09 PDT 2015


Markus Neteler <neteler at osgeo.org> writes:

> Hi,
>
> today we used "rgrass7" on Windows (and I made some tests on Linux, too).

Hi Markus,

thanks for reporting.

>
> I was wondering about a few warnings which might be suppressed to avoid
> user confusion:
>
>
> ######## Windows: calling GRASS 7.1 from R session
>
>> library(rgrass7)
> Loading required package: sp
> Loading required package: XML
> GRASS GIS interface loaded with GRASS version: (GRASS not running)
> Warning messages:
> 1: package ‘rgrass7’ was built under R version 3.2.2
> 2: package ‘sp’ was built under R version 3.2.2
> 3: package ‘XML’ was built under R version 3.2.2
>
>> initGRASS(gisBase = "C:/OSGeo4W/apps/grass/grass-7.1.svn",
> + gisDbase = "C:/Users/marissa/GRASSdata/",
> + location = "CA", mapset = "Aegypti")
> Error in initGRASS(gisBase = "C:/OSGeo4W/apps/grass/grass-7.1.svn",
> gisDbase = "C:/Users/marissa/GRASSdata/",  :
>   A GISRC file already exists; to override, set override=TRUE
>
>
> ==> the last sentence is not quite clear. Perhaps change to

I agree with the first part of the sentence.

>
> "A GISRC file already exists (the GRASS GIS mapset is already in use); to
> override, set override=TRUE"

I don't think this is true. I have regularly to use #override=TRUE# even
though I definitely use the mapset. I rather think that the GISRC is not
cleaned up after finishing in grass in R. 

This raises the question: if GISRC is created, should it be deleted,
i.e. should there be a function

  closeGRASS()

which is doing the cleanup (or is it done and not working in my cases)?

Rather change it to:

--8<---------------cut here---------------start------------->8--- "A
GISRC file already exists.
The GRASS GIS mapset might be already in use or the file has not been
deleted.
To override, set override=TRUE"
--8<---------------cuthere---------------end--------------->8---


>
>
>> initGRASS(gisBase = "C:/OSGeo4W/apps/grass/grass-7.1.svn",
> + gisDbase = "C:/Users/marissa/GRASSdata/",
> + location = "CA", mapset = "Aegypti",
> + override=TRUE)
> gisdbase    C:/Users/marissa/GRASSdata/
> location    CA
> mapset      Aegypti
> rows        265
> columns     230
> north       452000
> south       -608000
> west        -376000
> east        544000
> nsres       4000
> ewres       4000
> projection  +proj=aea +lat_1=34 +lat_2=40.5 +lat_0=0 +lon_0=-120 +x_0=0
> +y_0=-4000000 +no_defs +a=6378137 +rf=298.257222101
> +towgs84=0.000,0.000,0.000 +to_meter=1
> Warning message:
> In dir.create(gisDbase) : 'C:\Users\marissa\GRASSdata' already exists
>
> ==> the last warning is not clear to me. If I set override=TRUE, I refer to
> the mapset's gislock, hence the dir.create(gisDbase should not be done at
> all. Is it a bug?

Strange.

I just looked in the code of initGRASS() and all dir.create(gisDbase) are
in

,----
| if (!file.exists(gisDbase)) dir.create(gisDbase)
`----

statements. Maybe I am missing something? Could you set

--8<---------------cut here---------------start------------->8---
option(warn=2)
--8<---------------cut here---------------end--------------->8---

before running the code again and give a traceback?


>
>
> ############## Linux
>
>> ncdata <- readRAST("elevation")
> WARNING: 'cellhd/elevation' was found in more mapsets (also found in
>          <PERMANENT>)
> WARNING: Using <elevation at user1>
> WARNING: 'cellhd/elevation' was found in more mapsets (also found in
>          <PERMANENT>)
> WARNING: Using <elevation at user1>
> WARNING: 'cellhd/elevation' was found in more mapsets (also found in
>          <PERMANENT>)
> WARNING: Using <elevation at user1>
>
> ==> these warning make probably sense in a GRASS session but IMHO here
> less. They could be suppressed with --q in the respective GRASS module
> call.

Agreed - but very useful for debugging.

--q could could be added into the options of the rgrass7 package?

>
>
> Creating BIL support files...
> Exporting raster as floating values (bytes=4)
>  100%
> Warning messages:
> 1: In execGRASS("r.info", flags = "g", map = vname[i], intern = TRUE,  :
>   The command:
> r.info -g map=elevation
> produced at least one warning during execution:
> WARNING: 'cellhd/elevation' was found in more mapsets (also found in
>          <PERMANENT>)
> WARNING: Using <elevation at user1>
> WARNING: 'cellhd/elevation' was found in more mapsets (also found in
>          <PERMANENT>)
> WARNING: Using <elevation at user1>
> WARNING: 'cellhd/elevation' was found in more mapsets (also found in
>          <PERMANENT>)
> WARNING: Using <elevation at user1>
>
> ==> here it is, I suggest to use r.info --q

This should be optional - for debugging, these warnings might be crucial.

>
> 2: In execGRASS("r.info", flags = "r", map = vname[i], intern = TRUE,  :
>   The command:
> r.info -r map=elevation
> produced at least one warning during execution:
> WARNING: 'cellhd/elevation' was found in more mapsets (also found in
>          <PERMANENT>)
> WARNING: Using <elevation at user1>
> WARNING: 'cellhd/elevation' was found in more mapsets (also found in
>          <PERMANENT>)
> WARNING: Using <elevation at user1>
> WARNING: 'cellhd/elevation' was found in more mapsets (also found in
>          <PERMANENT>)
> WARNING: Using <elevation at user1>
>
> ==> same thing

No - If I use execGRASS() I know grass (hopefully...) and I can specify
--q if I want it.
The execGRASS must not add any flags or arguments which make the
commands differ from the GRASS versions.

>
> 3: In execGRASS("r.out.bin", flags = rOutBinFlags, input = vname[i],  :
>   The command:
> r.out.bin -b -f input=elevation
> output=/home/neteler/grassdata/nc_spm_08_grass7/user1/.tmp/pgis_north/elevation
> bytes=4 null=54
> produced at least one warning during execution:
> WARNING: 'cellhd/elevation' was found in more mapsets (also found in
>          <PERMANENT>)
> WARNING: Using <elevation at user1>
> WARNING: 'cellhd/elevation' was found in more mapsets (also found in
>          <PERMANENT>)
> WARNING: Using <elevation at user1>
> WARNING: 'cellhd/elevation' was found in more mapsets (also found in
>          <PERMANENT>)
> WARNING: Using <elevation at user1>
>
> ==> same thing

Should be using a new rgrass7 option for --q.

Cheers,

Rainer

>
> Creating BIL support files...
> Exporting raster as floating values (bytes=4)
>  100%
>
> thanks
> Markus
> _______________________________________________
> grass-stats mailing list
> grass-stats at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-stats

-- 
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:      Rainer at krugs.de

Skype:      RMkrug

PGP: 0x0F52F982
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 480 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-stats/attachments/20150910/39bbc751/attachment.pgp>


More information about the grass-stats mailing list