Roger,

Thanks for the help! I can try this tomorrow.

What do the data look like? Do you have temperature and elevation at the 
observation points 
and elevation over 
the grid? <==== This is exactly what I have; but I have a question: the 
elevation values I 
have associated with 
the point locations and temperatures are different from those for the grid 
elevations. The 
point elevation values 
are 'exact' whereas the grid elevations are spatial averages. Does this matter 
in the 
interpolation process -- it 
seems there would be numerical problems?

If temperature is the variable for which you want to interpolate (**YES**), 
then the formula 
argument in the 
gstat() function would be temp ~ elev, data=pointsdata... <==== this looks like 
what I need 
to do...

I'll let you know tomorrow morning when I get to work.

Thanks so much!

Tom



----- Original Message -----
From: Roger Bivand <[EMAIL PROTECTED]>
Date: Thursday, April 27, 2006 4:21 pm
Subject: Re: [R-sig-Geo] Example of universal kriging with R/gstat in GRASS 
needed

> On Thu, 27 Apr 2006, Thomas Adams wrote:
> 
> > List:
> > 
> > I can not seem to work out the syntax for using R/gstat within a 
> GRASS 
> > 6.1 session to do universal kriging. I have a DEM (elevation data 
> on a 
> > grid) and point data for temperature; theoretically, the 
> temperatures 
> > should relate to elevation. So, I am trying to spatially 
> interpolate the 
> > temperature data based on the elevations at the grid points. How 
> do I 
> > setup the gstat command in R/gstat (and using spgrass6, of 
> course)? I 
> > have no trouble reading in my elevation data (DEM) from GRASS and 
> I have 
> > no problem doing ordinary kriging of my temperature data using 
> > GRASS/R/gstat.
> 
> What do the data look like? Do you have temperature and elevation 
> at the
> observation points and elevation over the grid? If temperature is 
> the 
> variable for which you want to interpolate, then the formula 
> argument in 
> the gstat() function would be temp ~ elev, data=pointsdata (if a 
> SpatialPointsDataFrame no need for location= ~ x + y). Then the 
> predict() 
> step would need a SpatialGridDataFrame object as newdata, with elev 
> as 
> (one of) the columns in the data slot.
> 
> An example for the Meuse bank data in Burrough and McDonnell:
> 
> cvgm <- variogram(Zn ~ Fldf, data=BMcD, width=100, cutoff=1000)
> uefitted <- fit.variogram(cvgm, vgm(psill=1, model="Exp", 
> range=100, 
>  nugget=1))
> UK_fit <- gstat(id="UK_fit", formula = Zn ~ Fldf, data = BMcD, 
>  model=uefitted)
> z <- predict(UK_fit, newdata=BMcD_SPx)
> 
> where BMcD_SPx is a SpatialPixelsDataFrame (the grid has ragged 
> edges) 
> with flood frequencies in Fldf (actually a factor, but works neatly).
> 
> Hope this helps,
> 
> Roger
> 
> > 
> > Regards,
> > Tom
> > 
> > 
> 
> -- 
> 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: [EMAIL PROTECTED]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to