[GRASS-user] making fcell raster maps using climate data

Pierre Roudier pierre.roudier at gmail.com
Tue May 31 00:35:06 EDT 2011


Hi Bulent,

No problem, but please always copy the list, so that:
- others can offer an alternative solution (as I said, I'm highly
biased towards R)
- our discussion can be searchable by everybody for further reference

> I have spent a good portion of today working on this project and I got as
> far as reorganizing the data. It seems that any step after this is beyond my
> knowledge of GRASS, such as generating an interpolation grid (quoting you):
> # Generate an interpolation grid (the same for each raster to be generated)
> resolution <- 5 # your resolution

This just sets the resolution of the grid I want to generate to 5m.

> grid <- expand.grid(x = seq(min(df$UTM_E), max(df$UTM_E), by =
> resolution), y = seq(min(df$UTM_N), max(df$UTM_N), by = resolution))
> grid <- points2grid(grid)

This is a quick and dirty way to generate a grid (raster) on which
interpolate your points. If you got a polygon (shapefile) of your
study area, you'd better use it to generate an interpolation grid. See
?spsample for that.

> I understand that I should define the geographic extents –hence creating an
> interpolation grid– of the data I will interpolate from this weather
> station. However, I am not sure if the statements below are the commands
> that I should type in the Terminal of Grass (they seem to be R commands):
> [ grid <- expand.grid(x = seq(min(df$UTM_E), max(df$UTM_E), by =
> resolution), y = seq(min(df$UTM_N), max(df$UTM_N), by = resolution))
> grid <- points2grid(grid) ]
> and
> [ make_map <- function(data, grid)  ]

This is R code, indeed. What you need to do is to open a R session
from within GRASS. Just type R on your GRASS command line. Then you'll
be in a R session that is in GRASS :) Make sure you check out the
spgrass6 package to interface your R session with your GRASS session.

HTH,

Pierre

-- 
Scientist
Landcare Research, New Zealand


More information about the grass-user mailing list