How can I do batch processing with Geostatistical Wizard (not the tool Geostatistical analyst) in ArcGIS specifically for Kriging?

1377
5
07-09-2019 09:36 PM
VitoTorres
New Contributor

Hello, I'm trying to process multiple point vectors at once using Geostatistical Wizard, is there any way I can batch process kriging using Geostatistical Wizard?

0 Kudos
5 Replies
SteveLynch
Esri Regular Contributor
0 Kudos
VitoTorres
New Contributor

Moreover, when I first set the template layer, I always click or optimize the model in the Geostatistical wizard. Does it optimized the model for each model when used as the template layer or will only "follow" the optimized layer of the template layer itself.

0 Kudos
VitoTorres
New Contributor

Edit:

Moreover, when I first set the template layer, I always click or optimize the model in the Geostatistical wizard. Does it optimized the model for each model when used as the template layer or will only "follow" the optimized *model* of the template layer itself.

0 Kudos
EricKrause
Esri Regular Contributor

Hi Vito,

It is possible to automate the Optimize button using Create Geostatistical Layer, but it it involves make manual edits to XML files, so be careful before doing this.  We generally do not recommend automating this type of kriging which is why there is no easy way to do it.  Instead, we recommend using Empirical Bayesian Kriging, which is available as a geoprocessing tool for easy automation, and it is much safer to run in an automated fashion (though no interpolation method is completely safe when run without active monitoring).

If you really want to automate the Optimize button in kriging, this topic will explain how to create the XML file and what alterations you need to make:

https://community.esri.com/thread/80709

That topic is very long with lots of discussion that won't be relevant to you.  Here are the relevant posts:

The Create Geostatistical Layer tool takes a model source as input.  This model source can be a geostatistical layer (either a layer in ArcMap or saved as a .lyr file on disk) or an XML model source.  For your purposes, the XML will be easier to use.  The tool reads all the interpolation parameters from the model source (type of kriging, nugget, range, sill, transformations, etc) and applies them to a new dataset.  This is useful for something like temperature data taken daily.  You can build the model for one day and easily apply that model to each subsequent day.

However, if you're using different kinds of data (temperature, elevation, pollution, etc), you don't want to keep using the same model over and over because the interpolation parameters will not fit different types of data.  So, you need to tell the tool to recalculate all these parameters (explained below) for each new dataset.  

You only need to manually create one XML file source.  You can do this with the Geostatistical Wizard.  Open the Wizard, choose Ordinary kriging, and give it a dataset.  When you click Finish, the Method Report screen will pop up that shows all the parameters that you used.  Click "Save..." and save the XML file in a convenient location.  You then need to open the XML file with a text editor (Cooktop is a useful and free XML editor, but you can do it with Notepad too).  Inside the XML, you'll see all of the parameters, and most of them will have auto = "false" after them.  This auto flag tells the tool whether to recalculate that parameter or keep it fixed when it is used as a model source.  For every parameter that you want to be recalculated, you need to change the flag to auto = "true" and save the XML.  You only need to do this once, and you'll keep reusing this same model source.

You can then set up a loop in Python to iterate through your datasets.  For each dataset, you'll use the XML as the model source in Create Geostatistical Layer.  This will generate a geostatistical layer for each dataset, where the interpolation parameters have been recalculated, and you can use these layers to create the ASCII files that you described in your first post.

The difficulty in automating Ordinary/Simple kriging is one of the many reasons we made Empirical Bayesian Kriging as a geoprocessing tool.

If you are using ArcGIS Pro, you'll find the option to save the XML in a dropdown menu on the Method Report screen of the Geostatistical Wizard.  In ArcMap, it is a button.

The specific changes you need to make to the XML file to automate the optimize button is explained in this post:

You can recreate the defaults from the Geostatistical Wizard by adding one line to your XML file.

You should see a line at the top of the XML that says:
<model name="Kriging">

Change this line to:
<model name="Kriging" optimize = "BySill">

You actually don't need to change any "auto" flags.  This "optimize" flag will override any auto flags, so it doesn't matter if they are false or true.

If you want to automate the Optimize Model button in the Geostatistical Wizard, you can change that same line to:
<model name="Kriging" optimize = "ByCrossvalidation">

You will want to use the "ByCrossvalidation" option, and you don't need to worry about "auto" flags. 

Make a copy of the XML before you edit it because it is very easy to accidentally corrupt it.

0 Kudos
VitoTorres
New Contributor

Do I need to use model builder or other tools in order to automate the process so that all of my various individual inputs will be interpolated using the template layer?

0 Kudos