[SOLVED] Variogram on Sphere

Here you can report the problems encountered when using a function relative to the variography:
- experimental variography (vario.calc, vario.grid, vmap.calc, ...)
- model fitting (model.auto)

[SOLVED] Variogram on Sphere

Postby David Minkwitz » Wed Jul 16, 2014 12:00 pm

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.

Testfeld.png
Data set
Testfeld.png (8.09 KiB) Viewed 4828 times


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()


VariogramCloudTestfeld.png
Resulting variogram cloud
VariogramCloudTestfeld.png (21.22 KiB) Viewed 4828 times


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
David Minkwitz
 
Posts: 2
Joined: Tue Jul 08, 2014 4:17 pm

Re: Variogram on Sphere

Postby Didier Renard » Thu Jul 17, 2014 9:15 pm

Hi David

These are my comments on your very interesting question.

1) All the Db are seen through a projection system. By default, this system is not activated. But if you use the method define.projec(), you can switch the projection on.
This projection is part of the package mapproj (that I do not know exhaustively). This projection system remains valid through the different sessions. All the calculation distances are then performed through this projection system.
The only question then is to choose a suitable projection which maps the current (long,lat) system into a flat relevant space where euclidean distances are calculated.
Of course, I do not guarantee that mapproj package is able to perform such a projection in the case of points lying over a holw hemisphere...

2) the second option would be to ensure that any distance calculation is performed through a specific function. This function could then be derived by the user... for example using the great circle algorithm. But, for the time being, this is not gauranteed and it would probably take some time making that last statement valid.
Moreover I am not certain that some algorithms are not completely incompatible with such non euclidean distance calculations.

So, my recommendation is to use my first solution ... if reasonably correct.
Didier Renard
 
Posts: 337
Joined: Thu Sep 20, 2012 4:22 pm

Re: Variogram on Sphere

Postby David Minkwitz » Thu Jul 24, 2014 10:11 am

Dear Didier,

thanks a lot for your respond. In my opinion the first option would probably not work on global scale since as far as I know there is no projection between 3D and 2D without distortion. But to have the second option would be great maybe at first without any guarantee regarding the meaningfulness of the results obtained from using another distance than euclidean.

When you swtich to 3D Space. Is there maybe already an example how the 3D grid for kriging (i.e. for result0=kriging(dat,grid,model=model,neigh=unique.neigh)) can be defined (sorry I am not so familiar with R)?

Best regards
David
David Minkwitz
 
Posts: 2
Joined: Tue Jul 08, 2014 4:17 pm

Re: Variogram on Sphere

Postby Nicolas Desassis » Thu Jul 24, 2014 12:42 pm

Dear David,

I agree with you for the inaccuracy of the projection at more global scale.
However, I don't think that simple solutions exists. For instance,
if you change the function which computes the distance (by taking
the geodesic distance on the sphere), which covariance model are you allowed
to use on this manifold?
When you change the space, the class of allowed functions also changes:
(for instance, the cosinus function is a covariance function in 1D but doesn't remain valid in higher dimensions).
You have interesting theoretical material in

Sasvary, Z., 1994. Positive Definite and Definitizable Functions.

You can also find references more focussed on the sphere

Gneiting, T. (2013) Strictly and-non strictly positive definite functions on spheres. Bernouilli 19(4) pp 1327-1349.

Unfortunately, until now, RGeostats only works on the Euclidian spaces.
I hope it helps you.
Nicolas Desassis
 
Posts: 198
Joined: Thu Sep 20, 2012 4:22 pm


Return to Variography

Who is online

Users browsing this forum: No registered users and 2 guests

cron