GeostatisticalDatasets

Summary

The GeostatisticalDatasets class is used to manage datasets associated with a geostatistical model source.

Discussion

Using the GeostatisticalDatasets object allows you to quickly apply a geostatistical model to a new dataset. For example, as shown in the first example in the Code Sample section below, if you start with a geostatistical layer made using Kernel Interpolation With Barriers, you can easily change the barrier feature class to a new polygon feature class. Then you can generate a new geostatistical layer that uses the new barriers. The new geostatistical layer will apply all of the same interpolation parameters (such as the bandwidth parameter in kernel interpolation with barriers) to the new datasets. This is useful for automating the creation of geostatistical layers for many datasets if you want to use the same interpolation parameters for each dataset.

This class is used primarily in Python for the Input dataset(s) parameter of the Create Geostatistical Layer, Moving Window Kriging, and Semivariogram Sensitivity tools.

The class takes a geostatistical model source as a parameter and returns an object with properties that apply to that model. For example, if the geostatistical model source is the result of a Radial Basis Functions model, the only properties that will be associated with the GeostatisticalDatasets object will be dataset1 and dataset1Field because all other properties cannot apply to radial basis function models. See the Properties list to determine which properties can apply to each type of geostatistical model source.

If the geostatistical model source is a geostatistical layer, the properties of the object will be populated with strings of the datasets and fields that were used for that geostatistical layer. If the geostatistical model source is an XML file, the associated properties will be populated with empty strings because geostatistical model (XML) files do not contain references to the datasets. Note that dataset properties cannot be populated with tables.

All properties that reference fields are prefixed with their associated dataset. For example, dataset2Field refers to the field associated with dataset2.

For example, if the geostatistical model source is an IDW model with just a feature class and a field, the returned GeostatisticalDatasets object will have dataset1, dataset1Field, and dataset1WeightField properties, even though the original model did not use a weight field. In this case, dataset1WeightField will be populated with an empty string.

Syntax

GeostatisticalDatasets (ga_model_source)
ParameterExplanationData Type
ga_model_source
String

Properties

PropertyExplanationData Type
dataset1
(Read and Write)

The catalog path to the primary dataset. This property applies to all geostatistical models.

String
dataset1CountField
(Read and Write)

The string of the count field associated with dataset1.

String
dataset1Field
(Read and Write)

The string of the field associated with dataset1.

String
dataset1PopulationField
(Read and Write)

The string of the population field associated with dataset1.

String
dataset1TimeField
(Read and Write)

The string of the time field associated with dataset1.

String
dataset1ValueField
(Read and Write)

The string of the value field associated with dataset1.

String
dataset1WeightField
(Read and Write)

The string of the weight field associated with dataset1. This property applies to IDW, Global Polynomial Interpolation, Diffusion Interpolation With Barriers, and Kernel Interpolation With Barriers models.

String
dataset2
(Read and Write)

The catalog path to the secondary dataset.

String
dataset2CountField
(Read and Write)

The string of the count field associated with dataset1.

String
dataset2Field
(Read and Write)

The string of the field associated with dataset2.

String
dataset2PopulationField
(Read and Write)

The string of the population field associated with dataset2.

String
dataset2TimeField
(Read and Write)

The string of the time field associated with dataset2.

String
dataset2ValueField
(Read and Write)

The string of the value field associated with dataset2.

String
dataset3
(Read and Write)

The catalog path to the third dataset.

String
dataset3Field
(Read and Write)

The string of the field associated with dataset3.

String
dataset4
(Read and Write)

The catalog path to the fourth dataset.

String
dataset4Field
(Read and Write)

The string of the field associated with dataset4.

String
declusterPolygons1
(Read and Write)

The catalog path to the polygon feature class used to decluster dataset1.

String
declusterPolygons2
(Read and Write)

The catalog path to the polygon feature class used to decluster dataset2.

String
declusterPolygons3
(Read and Write)

The catalog path to the polygon feature class used to decluster dataset3.

String
declusterPolygons4
(Read and Write)

The catalog path to the polygon feature class used to decluster dataset4.

String
featureBarriers
(Read and Write)

The catalog path to the polygon or polyline feature class used as feature barriers. This property applies to Diffusion Interpolation With Barriers and Kernel Interpolation With Barriers models where a feature barrier has been supplied.

String
rasterBarrierAdditive
(Read and Write)

The catalog path to the raster dataset used to define the additive raster barrier. This property applies to Diffusion Interpolation With Barriers models that include an additive raster barrier.

String
rasterBarrierCumulative
(Read and Write)

The catalog path to the raster dataset used to define the cumulative raster barrier. This property applies to Diffusion Interpolation With Barriers models that include a cumulative raster barrier.

String
rasterBarrierFlow
(Read and Write)

The catalog path to the raster dataset used to define the flow raster barrier. This property applies to Diffusion Interpolation With Barriers models that include a cumulative raster barrier.

String

Code sample

GeostatisticalDatasets example 1 (Python window)

Uses a geostatistical layer saved as a layer file for the model source and changes the feature class and field to a new dataset and field. The original model used a polygon feature class as absolute barriers, and the same barriers will be applied to the new dataset and field.

# Name: GeostatisticalDatasets_Example_01.py
# Description: Uses a Kernel Interpolation With Barriers model source
#   and changes the feature class and field to a new dataset and field.

# Requirements: Geostatistical Analyst Extension

import arcpy

# Define the model source
ga_layer = 'C:/data/kernelsmoothing.lyr'

# Create the GeostatisticalDatasets object
geo_datasets = arcpy.GeostatisticalDatasets(ga_layer)

# Set the dataset1 property to the new data
geo_datasets.dataset1 = 'C:/data/data.gdb/new'

# Set the new field
geo_datasets.dataset1Field = 'newfield'

# Create a new geostatistical layer with the new data
arcpy.GACreateGeostatisticalLayer_ga(ga_layer, geo_datasets, 'outGALayer1')

# Save the new geostatistical layer as a layer file
arcpy.SaveToLayerFile_management('outGALayer1', 'C:/data/newlayer1.lyr',
                                 'ABSOLUTE')
GeostatisticalDatasets example 2 (stand-alone script)

Uses an IDW layer file as the model source. This model used an input feature class and field. This code sample adds a weight field before re-creating the IDW model.

# Name: GeostatisticalDatasets_Example_02.py
# Description: Uses an IDW model source and adds a weight field.

# Requirements: Geostatistical Analyst Extension

import arcpy

# Define the model source
ga_layer = 'c:/data/IDW.lyr'

# Create the GeostatisticalDatasets object
geo_datasets = arcpy.GeostatisticalDatasets(ga_layer)

# Set the weight field
geo_datasets.dataset1WeightField = 'weightfield'

# Create a new geostatistical layer that uses a weight field
arcpy.GACreateGeostatisticalLayer_ga(ga_layer, geo_datasets, 'outGALayer2')

# Save the new geostatistical layer as a layer file
arcpy.SaveToLayerFile_management('outGALayer2', 'C:/data/newlayer2.lyr',
                                 'ABSOLUTE')
GeostatisticalDatasets example 3 (stand-alone script)

This model includes two datasets and fields, and the second dataset used a declustering polygon feature class. This code sample updates the datasets, fields, and the declustering polygon feature class.

# Name: GeostatisticalDatasets_Example_03.py
# Description: Uses a cokriging model with two datasets and changes
#   the datasets, fields, and the declustering polygon feature class.

# Requirements: Geostatistical Analyst Extension

import arcpy

# Define the model source
cokriging_xml = 'C:/data/cokriging.xml'

# Create the GeostatisticalDatasets object
geo_datasets = arcpy.GeostatisticalDatasets(cokriging_xml)

# Set the first dataset and field
geo_datasets.dataset1 = 'C:/data/data.gdb/new1'
geo_datasets.dataset1Field = 'newfield1'

# Set the second dataset and field
geo_datasets.dataset2 = 'C:/data/data.gdb/new2'
geo_datasets.dataset2Field = 'newfield2'

# Set the new declustering polygons for the second dataset
geo_datasets.declusterPolygons2 = 'C:/data/data.gdb/decluster2'

# Create a new geostatistical layer with the new data
arcpy.GACreateGeostatisticalLayer_ga(cokriging_xml, geo_datasets, 'outGALayer3')

# Save the new geostatistical layer as a layer file
arcpy.SaveToLayerFile_management('outGALayer3', 'C:/data/newlayer3.lyr',
                                 'ABSOLUTE')