Select to view content in your preferred language

Need Help Automation of Kriging using Model builder or python - Reg.

20737
53
09-12-2013 05:58 AM
AnushuyaRamakrishnan
New Contributor
I am using arcmap 10.2.

My project deals with the prediction of PM and Ozone concentrations for 2004-2006 (1098 days) using known concentrations of them at
99 grids throughout the county.

I am trying to predict the unknown concentrations at mother's residences using ordinary kriging.

This is what I am doing:

1. Use Geostatistical Wizard
2. Select kriging cokriging
3. Input the Data layers and specifications
4. Select Finish
5. Read the model parameters and click OK
6. Generate Kriged predictions
7. Right click on Kriged data and convert to raster
8. Use spatial analyst tool Extraction
9. Select "Extract values to points"
10. Generate Extracted values of kriged predictions
11. Select conversion tool
12. Choose convert From Raster to Ascii
13. Generate the Ascii table.
14. Alternatively use Sample tool and input multiple rasters to generate an output table.

My question:

1. I need some guidance for automating this kriging process using model builder or python?

2. Is there any way to directly copy and paste the raster values to excel?

Can any one provide me a lead into this
0 Kudos
53 Replies
AnushuyaRamakrishnan
New Contributor
Hi Steve/Eric,

I have created a model for my project using a model builder and incorporated the tools for Emprical bayesian kriging. I could run the model successfully and get the output that I expected.

Now, I need to loop the model to change the Z field of my merge1.CSV input point file (containing PM values for each day from Jan 1 2004 to Dec 31 2006). to run all the tools continuously to generate outputs for the entire dataset.

How I can loop through the merge1.CSV input point file in my model builder?

Thanks

Anushuya
0 Kudos
AnushuyaRamakrishnan
New Contributor
Hi Steve/Eric,

I attach my python script for Emprical Bayesian Kriging.

I need to inlcude a last step for looping through the entire merge1.csv data (Jan 1 2004 to Dec 31 2006).

How do I do this looping?

Pls. suggest

Thanks

Anushuya
0 Kudos
EricKrause
Esri Regular Contributor
0 Kudos
AnushuyaRamakrishnan
New Contributor
Hi Eric/Steve,

I am trying to follow the steps below for iteration of EBK:

# Create a list variable to store the names of all the fields in the air quality data table
fieldList = arcpy.ListFields(File path to your table)

# Loop through each field in the air quality table
for zField in fieldList:

    # Set output raster name to match the field name with an added EBK suffix
    outRaster = zField + "_EBK"

    # Run the EBK interpolation for each field.
    arcpy.EmpiricalBayesianKriging_ga(...)

When I try to run my model in python, arcmap 10.2 crashes... I do not know the reason.

Have you experienced this problem?

Can you suggest me suitably.
0 Kudos
AnushuyaRamakrishnan
New Contributor
I have written python scripts for Empirical bayesian kriging and I am using it to generate predicted values for my sample mothers.
However, there is a concern that EBK is not well established in the literature.

I need certain clarifications before I can proceed to apply EBK for my study:

1. What is the underlying model to estimate parameters in semivariogram in EBK?

2. What is the bayesian Prior /bayesian rule that is applied in EBK?

3. What is the basis of calling it more accurate?

Any clarifications for these questions would be highly appreciated.

Thank you

Anushuya
0 Kudos
EricKrause
Esri Regular Contributor
1.  If no transformation is applied, the underlying model is an intrinsic random function, specifically a Power semivariogram model.  If a transformation is applied, it is a simple kriging model with an exponential semivariogram.

2.  The prior distribution is estimated from the data using restricted maximum likelihood (REML).  This is the difference between "Bayesian" and "empirical Bayesian."  In empirical Bayesian models, the prior is estimated from the data, and the posterior distribution is generated through simulations.

3.  There are several reasons to think EBK will, in general, be more accurate.  First, REML is known to be a better estimator of semivariogram parameters than weighted least-squares (which is what is used in other kriging methods).  Second, EBK works on subsets, so it eases the stationarity assumption of kriging.  Other kriging methods assume global stationarity.  EBK, however, only assumes stationarity within subsets, so it can work effectively even in the presence of global nonstationarity, as long as the subsets are close to being stationary.  Third, EBK does a better job of estimating kriging variances because it can account for error in estimating the underlying semivariogram (it does this with simulations); other kriging models assume the semivariogram is modeled absolutely correctly, which often results in standard errors that are too small.

Here is a reference for EBK (a longer paper with all the details is in the works):

Krivoruchko K. and Gribov A. (2014) Pragmatic Bayesian kriging for non-stationary and moderately non-Gaussian data. Submitted. In Mathematics of Planet Earth. Proceedings of the 15th Annual Conference of the International Association for Mathematical Geosciences. Eds: Pardo-Igúzquiza, E.; Guardiola-Albert, C.; Heredia, J.; Moreno-Merino, L.; Durán, J.J.; Vargas-Guzmán, J.A. Springer 2014, pp. 61-64.

(We're not sure why the date is 2014 because it's already been published)
0 Kudos
AnushuyaRamakrishnan
New Contributor
Hi Eric,

Thank you very much for the clarification.

This would help me a lot.

Thanks

Anushuya
0 Kudos
AnushuyaRamakrishnan
New Contributor
How do we automate ordinary kriging? Just was curious to know about it.

We need to generate range, sill and nugget values for each day of the study. Is there any way for me to generate those as a first step in python script and give the inputs in the subsequent step for kriging.

I am trying to figure out how this can be done?

Any suggestions/help would be highly appreciated.

Thank you

Anushuya
0 Kudos
EricKrause
Esri Regular Contributor
Automation of Ordinary Kriging can be done with a template model and the Create Geostatistical Layer geoprocessing tool.  This blog will take you through the basics, but you'll need to do some extra work:

http://blogs.esri.com/esri/arcgis/2010/06/18/automating-geostatistical-interpolation-using-template-...

However, you'll need to use a template XML file rather than a geostatistical layer.  You can save this XML file at the end of the Geostatistical Wizard (after you hit Finish, click "Save..." on the Method Report screen).  You'll need to change various "auto" flags in this XML file.  You can change them with the "Set Model Parameter" gp tool, or you can just open the XML file in a text editor and manually change them (this way is probably easier).

Read the following topic (be sure to read the whole thing because I make a mistake in my first post):
http://forums.arcgis.com/threads/75743-Automatically-generate-anisotropic-semivariogram-parameters

The other poster's question was about anisotropic parameters and multiple semivariogram models, so the solution is more complicated that what you need.  See if you can figure it out from those two resources, but I'm happy to help you if you run into any problems.
0 Kudos
AnushuyaRamakrishnan
New Contributor
Thank you Eric... I will try this and let you know if I run into trouble.

Thanks

Anushuya
0 Kudos