Resumen
The GeostatisticalDatasets class is used to manage datasets associated with a geostatistical model source. A geostatistical model source can be either a geostatistical layeror a geostatistical model (XML).
Debate
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.
Since dataset1WeightField, dataset1TimeField, and dataset2TimeField are optional inputs in their respective geostatistical methods, these properties will be created in the GeostatisticalDatasets object if they can apply to that model, regardless of whether they were actually included in the original geostatistical model source. 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.
Sintaxis
GeostatisticalDatasets (ga_model_source)
Parámetro | Explicación | Tipo de datos |
ga_model_source | The geostatistical model source used to generate the properties of the class. The model source must be a geostatistical layer or a geostatistical model (XML) file. Geostatistical model (XML) files can be saved from the Method Report screen at the end of the Geostatistical Wizard. | String |
Propiedades
Propiedad | Explicación | Tipo de datos |
dataset1 (Lectura y escritura) | The catalog path to the primary dataset. This property applies to all geostatistical models. | String |
dataset1CountField (Lectura y escritura) | The string of the Count Field associated with dataset1. This property applies to count (overdispersed Poisson) and rate (binomial) areal interpolation models. | String |
dataset1Field (Lectura y escritura) | The string of the field associated with dataset1. This property applies to all geostatistical models except areal interpolation models. | String |
dataset1PopulationField (Lectura y escritura) | The string of the Population Field associated with dataset1. This property applies to rate (binomial) areal interpolation models. | String |
dataset1TimeField (Lectura y escritura) | The string of the Time Field associated with dataset1. This property applies to count (overdispersed Poisson) areal interpolation models. | String |
dataset1ValueField (Lectura y escritura) | The string of the Value Field associated with dataset1. This property applies to average (Gaussian) areal interpolation models. | String |
dataset1WeightField (Lectura y escritura) | 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 (Lectura y escritura) | The catalog path to the secondary dataset. This property applies to cokriging and co-areal interpolation models. | String |
dataset2CountField (Lectura y escritura) | The string of the Count Field associated with dataset2. This property applies to co-areal interpolation models where the secondary variable is count (overdispersed Poisson) or rate (binomial). | String |
dataset2Field (Lectura y escritura) | The string of the field associated with dataset2. This property applies to cokriging models. | String |
dataset2PopulationField (Lectura y escritura) | The string of the Population Field associated with dataset2. This property applies to co-areal interpolation models where the secondary variable is rate (binomial). | String |
dataset2TimeField (Lectura y escritura) | The string of the Time Field associated with dataset2. This property applies to co-areal interpolation models where the secondary variable is count (overdispersed Poisson). | String |
dataset2ValueField (Lectura y escritura) | The string of the Value Field associated with dataset2. This property applies to co-areal interpolation models where the secondary variable is average (Gaussian). | String |
dataset3 (Lectura y escritura) | The catalog path to the third dataset. This property applies to cokriging models that use at least three datasets. | String |
dataset3Field (Lectura y escritura) | The string of the field associated with dataset3. This property applies to cokriging models that use at least three datasets. | String |
dataset4 (Lectura y escritura) | The catalog path to the fourth dataset. This property applies to cokriging models that use four datasets. | String |
dataset4Field (Lectura y escritura) | The string of the field associated with dataset4. This property applies to cokriging models that use four datasets. | String |
declusterPolygons1 (Lectura y escritura) | The catalog path to the polygon feature class used to decluster dataset1. This property applies to kriging and cokriging models where the primary dataset has been declustered using polygon declustering. | String |
declusterPolygons2 (Lectura y escritura) | The catalog path to the polygon feature class used to decluster dataset2. This property applies to cokriging models where the secondary dataset has been declustered using polygon declustering. | String |
declusterPolygons3 (Lectura y escritura) | The catalog path to the polygon feature class used to decluster dataset3. This property applies to cokriging models where the third dataset has been declustered using polygon declustering. | String |
declusterPolygons4 (Lectura y escritura) | The catalog path to the polygon feature class used to decluster dataset4. This property applies to cokriging models where the fourth dataset has been declustered using polygon declustering. | String |
featureBarriers (Lectura y escritura) | 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 (Lectura y escritura) | 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 (Lectura y escritura) | 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 (Lectura y escritura) | 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 |
Ejemplo de código
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 these 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'
# Check out the ArcGIS Geostatistical Analyst extension license
arcpy.CheckOutExtension("GeoStats")
# 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 recreating 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'
# Check out the ArcGIS Geostatistical Analyst extension license
arcpy.CheckOutExtension("GeoStats")
# 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)
Uses a cokriging XML file as the model source. 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'
# Check out the ArcGIS Geostatistical Analyst extension license
arcpy.CheckOutExtension("GeoStats")
# 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')