1. Bancheri and Formetta
LINKERS
JGrass-NewAGE: Kriging component
Marialaura Bancheri*†
and Giuseppe Formetta†
*
Correspondence:
marialaura.bancheri@unitn.it
Dipartimento di Ingegneria Civile
Ambientale e Meccanica, Trento,
Mesiano di Povo, Trento, IT
Full list of author information is
available at the end of the article
†
Code Author
Abstract
These pages teach how to run the Kriging component inside the OMS 3 console.
Some preliminary knowledge and installation of OMS is mandatory (see @Also useful).
This component deals with the interpolation of the spatial behavior of climatological
variable following the approach proposed by Matheron (1981) and Goovaerts (1997). It
implements 10 theoretical semivariogram models and 4 types of Kriging algorithms, for
a total of forty interpolation options. The component can be used with both raster
inputs and punctual inputs. It is perfectly integrated in the system and its outputs can
be the inputs of different components.
@Version:
0.1
@License:
GPL v. 3
@Inputs:
• Climatological variable (−);
• Shapefile of the weather station, containing also the elevation information (m)
required for detrended kriging (DK);
• Shapefile of the sub-basin centroid containing also the elevation information (m)
required for detrended kriging (DK);
• Start date (String);
• End date (String);
• number of station the algorithm has to consider;
• range (m);
• sill (−);
• nugget (−);
• type of the semivariogram to use (String);
@Outputs:
• Climatological variable interpolated (−);
@Doc Author: Marialaura Bancheri
@References:
• See References section below
Keywords: OMS; JGrass-NewAGE Component Description; Kriging
2. Bancheri and Formetta Page 2 of 7
Code Information
Executables
This link points to the jar file that, once downloaded can be used in the OMS console:
https://github.com/GEOframeOMSProjects/OMS_Project_Krigings/tree/master/
lib
Developer Info
This link points to useful information for the developers, i.e. information about the code
internals, algorithms and the source code
https://github.com/geoframecomponents
Also useful
To run JGrass-NewAGE it is necessary to know how to use the OMS console. Information
at: ”How to install and run the OMS console”,
https://alm.engr.colostate.edu/cb/project/oms).
JGrasstools are required for preparing some input data (information at:
http://abouthydrology.blogspot.it/2012/11/udig-jgrasstools-resources-in-italian.
html
To visualize results you need a GIS. Use your preferred GIS, following its installation
instructions. To make statistics on the results, you can probably get benefits from R:
http://www.r-project.org/ and follow its installation instruction.
To whom address questions
marialaura.bancheri@unitn.it
Authors of documentation
Marialaura Bancheri (marialaura.bancheri@unitn.it)
This documentation is released under Creative Commons 4.0 Attribution International
3. Bancheri and Formetta Page 3 of 7
Component Description
Kriging is a group of geostatistical techniques used to interpolate the value of random
fields based on spatial autocorrelation of measured data (1, Chapter 6.2). The measure-
ments value z(xα) and the unknown value z(x), where x is the location, given according
to a certain cartographic projection, are considered as particular realizations of random
variables Z(xα) and Z(x) (Goovaerts, 1997; Isaaks and Srivastava, 1989). The estimation
of the unknown value zλ
(x), where the true unknown value is Zλ
(x), is obtained as a
linear combination of the N values at surrounding points, Goovaerts (1999):
Zλ
(x) − m(x) =
N
α=1
λ(xα)[Z(uα) − m(xα)] (1)
where m(x) and m(xα) are the expected values of the random variables Z(x) and Z(xα).
λ(xα) is the weight assigned to datum z(xα). Weights are chosen to satisfy the conditions
of minimizing the error of variance of the estimator σ2
λ, that is:
argmin
λ
σ2
λ ≡ argmin
λ
VarZλ
(x) − Z(x) (2)
under the constrain that the estimate is unbiased, i.e.
EZλ
(x) − Z(x) = 0 (3)
The latter condition, implies that:
N
α=1
λα(xα) = 1 (4)
As shown in various textbooks, e.g. Kitanidis (1997), the above conditions bring to a linear
system whose unknown is the tuple of weights, and the system matrix depends on the
semivariograms among the couples of the known sites. When it is made the assumption
of isotropy of the spatial statistics of the quantity analyzed, the semivariogram is given
by Cressie and Cassie (1993):
γ(h) :=
1
2Nh
Nh
i=1
(Z(x) − Z(x)i)2
(5)
where the distance (x, xi) ≡ h, Nh denotes the set of pairs of observations at local x and
at location xi at distance h apart from x. In order to be extended to any distance, ex-
perimental semivariogram need to be fitted to a theoretical semivariogram model. These
theoretical semivariograms contain parameters (called nugget, sill and range) to be fitted
against the existing data, before introducing in the Kriging linear system, whose solu-
tion returns the weights in eq.(1). Three main variants of Kriging can be distinguished,
(Goovaerts, 1997):
• Simple Kriging (SK),which considers the mean, m(x), to be known and constant
throughout the study area;
• Ordinary Kriging (OK) ,which account for local fluctuations of the mean, limiting
the stationarity to the local neighborhood. In this case, the mean in unknown.
4. Bancheri and Formetta Page 4 of 7
• Kriging with a trend model (here Detrended Kriging, DK), which considers that
the known local mean m(xα) varies within the local neighborhood.
The trend can be, for example, a linear regression model between the investigated variables
and a auxiliary variable, such as elevation or slope. According to Goovaerts (1997), the
trend should be subtracted from the original data and the OK of the residuals performed.
The final interpolated values will be the sum of the interpolated values and the previously
estimated trend. Variants of OK and DK are the local ordinary kriging (LOK) and local
detrended Kriging (LDK). In this case the estimate is only influenced by the measurements
belonging to a neighbor. The SI package implements the OK and the DK, since local mean
may vary significantly over the study area and the SK assumption of the known stationary
mean could be too strict, (Goovaerts, 1997). Moreover, Goovaerts (2000) found that, in
the case of trend, detrended kriging provides better results than coKriging and it is not
as computationally demanding. In SI package, the neighbor stations in the local case are
defined either in a maximum searching radius or as a number of stations closer to the
interpolation point. To estimate the errors produced by the interpolation using Kriging
techniques, we chose the leave-one-out cross validation technique (Efron and Efron, 1982).
In fact, Goovaerts (1997) states that the standard deviation cannot be used as a direct
measures of estimation precision. Moreover the procedure allows to evaluate the impact
of the different models on interpolation results, (Isaaks and Srivastava, 1989; Goovaerts,
1997; Prudhomme and Reed, 1999; Martin and Simpson, 2003; Aidoo et al. , 2015).
Leave-one-out cross validation consists of removing one data point at a time and per-
forming the interpolation for the location of the removed point, using the remaining
stations. The approach is repeated until every sample has been, in turn, removed and
estimates are calculated for each point. Interpolated and measured values for each station
were compared and the goodness of fit indexes, such as Root mean square error (RMSE)
and Nash-Sutcliffe Efficiency (NSE),were calculated to asses model performances.
Detailed Inputs description
General description
The input file is a .csv file containing a header and one or more time series of input data,
depending on the number of stations involved. Each column of the file is associated to a
different station.
The file must have the following header:
• The first 3 rows with general information such as the date of the creation of the file
and the author;
• the fourth and fifth rows contain the IDs of the stations (e.g. station number 8:
value 8, ID, ,8);
• the sixth row contains the information about the type of the input data (in this
case, one column with the date and one column with double values);
• the seventh row specifies the date format (YYYY-MM-dd HH:mm).
All this information shown in the figure 1.
5. Bancheri and Formetta Page 5 of 7
Figure 1 Heading of the .csv input file
Total precipitation
The total precipitation is given in time series or raster maps of (mm) values.
Relative humidity
The relative humidity is given in time series or raster maps of (%) values.
Air temperature
The air temperature is given in time series or raster maps of (◦
C) values.
range
range is the distance after which data are no longer correlated.
sill
sill is the total variance where the empirical variogram appears to level off.
nugget
nugget is related to the amount of short range variability in the data. A nugget that’s
large relative to the sill is problematic and could indicate too much noise and not enough
spatial correlation
semivariogram
semivariogram describes the degree of spatial dependence of the climatological variable.
Detailed Outputs description
Climatological variable
The interpolated climatological variable is given as a time series at each sub-basin centroid
Examples
The following .sim file is customized for the use of the kriging component. The .sim file
can be downloaded from here:
https://github.com/GEOframeOMSProjects/OMS_Project_Krigings/tree/master/
simulation
import static oms3.SimBuilder.instance as OMS3
def home = oms_prj
// start and end date of the simulation
def startDate= "2000 -01 -01 00:00"
def endDate="2000 -01 -01 00:00"
6. Bancheri and Formetta Page 6 of 7
OMS3.sim {
resource "$oms_prj/lib"
model(while: "reader_data.doProcess" ) {
components {
// components to be called : reader input data , lwrb and writer
output data
" reader_data " org. jgrasstools .gears.io. timedependent .
OmsTimeSeriesIteratorReader "
" vreader_station " "org.jgrasstools.gears.io.shapefile.
OmsShapefileFeatureReader "
// comment this component if you want to use the ordinary Kriging
"trend" " trendAnalysis . TrendAnalysis "
" vreader_interpolation " "org.jgrasstools.gears.io.shapefile.
OmsShapefileFeatureReader "
"kriging" "krigings.Krigings"
" writer_interpolated " "org. jgrasstools.gears.io. timedependent .
OmsTimeSeriesIteratorWriter "
}
parameter{
" reader_data .file" "${home }/ data/rain_test.csv"
" reader_data .idfield" "ID"
" reader_data .tStart" "${startDate}"
" reader_data .tEnd" "${endDate}"
" reader_data .tTimestep" 60
" reader_data .fileNovalue" " -9999"
" vreader_station .file" "${home }/ data/ rainstations .shp"
" vreader_interpolation .file" "${home }/ data/
basins_passirio_width0 .shp"
// comment this line if you want to use the ordinary Kriging
"trend. fStationsid " "ID_PUNTI_M"
// comment this line if you want to use the ordinary Kriging
"trend.fStationsZ" "QUOTA"
// comment this line if you want to use the ordinary Kriging
"trend. thresholdCorrelation " 0
"kriging.fStationsid" "ID_PUNTI_M"
"kriging. fInterpolateid " "netnum"
"kriging. inNumCloserStations " 5
"kriging.range" 123537.0
"kriging.nugget" 0.0
"kriging.sill" 1.678383
// parameter of the writing component
" writer_interpolated .file" "${home }/ output/
kriging_detrendend .csv"
" writer_interpolated .tStart" "${startDate}"
" writer_interpolated .tTimestep" 60
}
connect {
// if you want to use the ordinary Kriging uncomment this line
// " reader_data .outData" "kriging.inData"
// comment this line if you want to use the ordinary Kriging
" reader_data .outData" "trend.inData"
// comment this line if you want to use the ordinary Kriging
" vreader_station .geodata" "trend.inStations"
7. Bancheri and Formetta Page 7 of 7
" vreader_station .geodata" "kriging.inStations"
" vreader_interpolation .geodata" "kriging. inInterpolate "
// comment this line if you want to use the ordinary Kriging
"trend. outResiduals " "kriging.inData"
// comment this line if you want to use the ordinary Kriging
"trend. trend_intercept " "kriging. trend_intercept "
// comment this line if you want to use the ordinary Kriging
"trend. trend_coefficient " "kriging. trend_coefficient "
// comment this line if you want to use the ordinary Kriging
"trend. doDetrended " "kriging.doDetrended"
"kriging.outData" " writer_interpolated .inData"
}
}
}
Data and Project
The following link is for the download of the input data necessaries to execute the CI
component (as shown in the .sim file in the previous section ) :
https://github.com/GEOframeOMSProjects/OMS_Project_Krigings/tree/master/
data
The following link is for the download of the OMS project for the component:
https://github.com/GEOframeOMSProjects/OMS_Project_Krigings
%
References
1. Bancheri, M.: A flexible approach to the estimation of water budgets and its connection to the travel time theory. PhD
thesis, Universit`a degli Studi di Trento (2017)