[R-sig-Geo] r.neighbors with execGRASS

Roger Bivand Roger.Bivand at nhh.no
Fri Aug 28 23:43:07 CEST 2009


On Fri, 28 Aug 2009, Alexandre VILLERS wrote:

> Goord afternoon,
> 
> I have a bunch of ascii files to smooth and I wanted to start using spgrass6
> (and then looping with GRASS routines).
> So here is a piece of the code I'm using
> 
> loc<-initGRASS("C:/GRASS", home=tempdir(), override=T) 
> execGRASS("r.in.gdal", flags="o",
> parameters=list(input="M:\\MODIS_temp\\PC2000_049.250m_16_days_NDVI.tif",
> output="ref"))  # import of a reference file for the region
> 
> execGRASS("g.region", flags="p", parameters=list(rast="ref")) # define the
> region settings with the characteristics of "ref"
> execGRASS("r.in.gdal", flags="o", parameters=list(input=paste(getwd(), "\\",
> "file1.asc", sep=""), output="temp"))  #import the first ascii file and
> names it "temp"
> execGRASS("r.neighbors", flags="c", parameters=list(input="temp",
> output="tempL", method="average", size=9)     # tries to apply a circular
> r.neighbors function on temp with a width of 9 cells
> 
> Erreur dans doGRASS(cmd, flags = flags, parameters = parameters) :
>   Parameter <size> does not have integer value
> 
> How comes that 9 is not considered as an integer value ? Or did I miss
> something ?

Coerce with as.integer(9), as just 9 may be ambiguous - it may take 
storage mode double. In addition, add the closing parenthesis as Milton 
suggested if it didn't just disappear in copying to the message.

Roger

> 
> Thanks for any hint !
> 
> Alex
> 
> P.S.: execGRASS("r.info", parameters=list(map="temp"))
> 
> +--------------------------------------------------------------------------
> --+
>  | Layer:    temp                           Date: Fri Aug 28 16:46:47
> 2009    |
>  | Mapset:   filecb94b5f                    Login of Creator:
> villers         |
>  | Location:
> filea6d66e1                                                      |
>  | DataBase:
> C:/DOCUME~1/villers/LOCALS~1/Temp/RtmpAg4EG2                     |
>  | Title:     ( temp
> )                                                        |
>  | Timestamp:
> none                                                            |
>  |-------------------------------------------------------------------------
> ---|
>  |                                                                        
?? ?   |
>  |   Type of Map:  raster               Number of Categories:
> 9973            |
>  |   Data Type:   
> CELL                                                       |
>  |   Rows:        
> 1123                                                       |
>  |   Columns:     
> 1205                                                       |
>  |   Total Cells: 
> 1353215                                                    |
>  |        Projection:
> x,y                                                     |
>  |            N:     280626    S:       -124   Res:  
> 250                     |
>  |            E:     301126    W:       -124   Res:  
> 250                     |
>  |   Range of data:    min = -2000  max =
> 9973                                |
>  |                                                                        
?? ?   |
>  |   Data
> Description:                                                        |
>  |    generated by
> RINGDA~1                                                   |
>  |                                                                        
?? ?   |
>  |  
> Comments:                                                                |
>  |    RINGDA~1 -o input="M:/MODIS_temp\PC2000_049.asc"
> output="temp"          |
>  |                                                                        
?? ?   |
>  +-------------------------------------------------------------------------
> ---+
> --
> 
> Alexandre Villers
> PhD Student
> Team "Biodiversity"
> Centre d'Etudes Biologiques de Chizé-CNRS UPR1934
> 79360 Beauvoir sur Niort
> 
> Phone +33 (0)5 49 09 96 13
> Fax   +33 (0)5 49 09 65 26
> 
> 
> __________ Information from ESET Mail Security, version of virus signature
> database 4377 (20090828) __________
> 
> The message was checked by ESET Mail Security.
> http://www.eset.com
> 
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list