Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Local Kriging #103

Open
zcakzhuu opened this issue Mar 31, 2022 · 0 comments
Open

Error in Local Kriging #103

zcakzhuu opened this issue Mar 31, 2022 · 0 comments

Comments

@zcakzhuu
Copy link

Hi,

My spatio-temporal variogram was fitted on an STIDF dataframe which has the CRS of the following. The coordinates are latitude and longitude.

"+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"

And by running is.projected(), I can see that my data is not projected. From the description of variogram function provided here, my understanding is that when the input data is unprojected, the variogram will be calculated using the great circle distances which is in km.

projected: logical; if FALSE, data are assumed to be unprojected, meaning decimal longitude/latitude. For projected data, Euclidian distances are computed, for unprojected great circle distances (km). In variogram.formula or variogram.gstat, for data deriving from class Spatial, projection is detected automatically using is.projected

Now the variogram is fitted and I want to start doing LOCAL spatio-temporal kriging. kgrid and full_timeDF has the same CRS (i.e., epsg: 4326) and are both unprojected.

pred <- krigeST(val~1, 
                data=full_timeDF, 
                newdata=kgrid,
                modelList=best_Vgm, 
                nmax=8, 
                stAni=1,
                computeVar=T, 
                progress=T)

I got the following error,

RRuntimeError: Error in krigeST.local(formula = formula, data = data, newdata = newdata,  : 
  (is.projected(data) & (attr(modelList, "spatial unit") %in% c("km",  .... is not TRUE

And I went back to check the code that produces the error. I don't understand why local kriging does not allow variogram model in km and data in lat/lon (i.e., unprojected) despite the fact the the variogram takes in unprojected data to do the calculation.

Am I doing something wrong or is it a bug that needs to be fixed?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant