Hello,
using the following R code I get the attached variogram cloud. The data itself contains of latitude, longitude and value (cf. comments in source code and figure). Let's assume we have WGS84 coordinates and we are on WGS84 height = 0.
If one considers the resulting variogram cloud, it will be seen that the Euclidean distances between the location vectors is calculated and the corresponding (z1-z2)^2 / 2 is drawn at this distance. For instance: norm([80,-10]-[80,10]) = 20 and (4-2)^2 / 2 = 2.
#Test field
#lat,lon,residual
#80.0,-10.0, 2.0
#80.0, 10.0, 4.0
#70.0,-10.0, 4.0
#70.0, 10.0,-2.0
#60.0,-10.0, 1.0
#60.0, 10.0, 1.0
tecData.table <- read.table(file="/home/linux/Reconstruction/Software/R/Data/Testfeld.csv",header=TRUE,sep=",")
tec.db <- db.create(tecData.table,ndim=2,flag.grid=FALSE,autoname=FALSE)
#CALCULATE VARIOGRAM CLOUD
##########################
v_cloud=cloud.calc(tec.db,varmax=20)
plot(v_cloud,ylim=c(0,20))
axis(1,at=seq(0,25,1),labels=T)
axis(2,at=seq(0,20,1),labels=T)
grid()
But, using the Euclidean distance is good for coordinates which are more on a local scale than global as in the given data set. Why? For example: if we calculate the distance of two different point pairs on a sphere surface (radius=6371 km) with the following coordinates:
1. [80°N,-10°W] and [80°N,10°E] -> distance ~ 408 km
2. [60°N,-10°W] and [60°N,10°E] -> distance ~ 1177 km
The distance between points on the same latitude but different longitude increases from North to South on the northern hemisphere. If we keep this in mind we probably expect more correlations between the first two points because they are indeed closer to each other (the values in the given in the example do not behave like this, but it should not concern here).
So, how to cope with this problem? What I can do is for example change the given Geodetic WGS84 coordinates to ECEF coordinates and work with a 3D location. But then the caluclation of the directional variogram (vario.calc(*.db,dir=c(0,45,90,135))) cannot be done on this space. How do you normally tackle this problem? Sure, I can manage to implement something for myself, but maybe there is already a function which I currently do not know. The best would be if somehow the great circle distance, giving lat, lon and a radius could be calculated using vario.calc.
Thank you very much in advance and best regards
David