[R-sig-Geo] Using GStat for kriging with Anisotropy

Dan Turenne DanielTurenne at hotmail.com
Wed Jun 15 20:00:38 CEST 2016


Hello,


I am trying to use kriging to make temperature predictions but I have run into a slight issue.  I would like to include anisotropy in my variogram model but GStat does not support anisotropy when coordinates are given in longitude and latitude.  Here is a example of what my code looks like, where dailyData is a data frame containing long/lat coordinates and the mean temperature data:



    coordinates(dailyData) = ~long+lat

    proj4string(sp) = CRS("+init=epsg:4326")


    anisParams=estimateAnisotropy(dailyData,"meanTemp")

    sample.variogram=variogram(meanTemp~1,dailyData)


    sillEst=var(dailyData$meanTemp)

    nuggetEst=0

    rangeEst=200


    anis.variogram=vgm(nugget=nuggetEst, model="Exp", range=rangeEst, psill=sillEst,

                                          anis=c(anisParams$direction,1/anisParams$ratio))

    anis.fitVariogram=fit.variogram(sample.variogram,anis.variogram)


    surface=krige(meanTemp~1,locations=dailyData,newdata=fData,model=anis.fitVariogram)



However running this code produces the following error:


    Error in predict.gstat(g, newdata = newdata, block = block, nsim = nsim,  :
    value not allowed for: nnot be defined for long/lat data, anisotropy cannot be defined


I know that the problem is that GStat can't model anisotropy while using great circle distances, but I am wondering if there is a workaround that exists which allows anisotropy to be modelled while using long/lat coordinates?  All of my long/lat data is in decimal format (i.e lat=45.62, long=-75.48).  I have searched through the R-Sig-Geo mailing list and have seen this issue mentioned but I have not been able to find a solution that works for my code.  Any help on this subject would be greatly appreciated.


Thank you in advance,


Daniel Turenne

University of Manitoba

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list