Kriging command from python ignores cell size?

628
3
Jump to solution
06-20-2018 06:21 AM
roemhildtg
Occasional Contributor III

I'm working on creating a batch kriging tool using the Emperical Bayesian Kriging tool. When I run the tool in ArcGIS pro on a selected set of features, the tool runs and creates a nice looking output raster. It looks like this:

But when I copy that exact tool output from a python window, I get the following code:

arcpy.ga.EmpiricalBayesianKriging("pond_depth_points", "Water_dept", "point_geostat", r"K:\01696-360\GIS\Maps\2018 Pond Assessment\2018 Pond Assessment.gdb\pond_empbkrig_1", 0.0001953125, "NONE", 100, 1, 100, "NBRTYPE=StandardCircular RADIUS=0.028516880589107 ANGLE=0 NBR_MAX=15 NBR_MIN=10 SECTOR_TYPE=ONE_SECTOR", "PREDICTION", 0.5, "EXCEED", None, "POWER")


# which I translate to this in my layer loop:

def create_raster(points, workspace, row_data, depth_field):
    raster_name = "kriging_{0}".format(row_data[0])
    try:
        # raster = arcpy.Kriging_3d(points, depth_field, join(workspace, raster_name), "Spherical ,0.000005", 0.0000953125, "Variable 12")
        # arcpy.ddd.Kriging(points, depth_field, join(workspace, raster_name), "Spherical 0.000195 # # #", 0.0001953125, "VARIABLE 12 0.00015", None)
        # raster = arcpy.Kriging_3d(points, depth_field, join(workspace, raster_name),"Spherical 0.2", "0.2", "VARIABLE 8", "")

        output_filename = join(workspace, raster_name)
        output_geostat = 'point_geostat'
        cell_size = 0.0001953125
        transformation = "NONE"
        max_points = 100
        local_overlap_factor = 1
        simulated_semio = 100
        search_neighborhood = "NBRTYPE=StandardCircular RADIUS=0.028516880589107 ANGLE=0 NBR_MAX=15 NBR_MIN=10 SECTOR_TYPE=ONE_SECTOR"
        output_type = "PREDICTION"
        semio_model_type = "POWER"

        arcpy.ga.EmpiricalBayesianKriging(points, depth_field, output_geostat, output_filename,
            cell_size, transformation, max_points, 
            local_overlap_factor, simulated_semio,  search_neighborhood, 
            "PREDICTION", 0.5, "EXCEED", None, semio_model_type)

When I run this tool and add the output raster to the map, the output raster looks like this. I also noticed the output of the above tool when added to the map also looks like this. Why? Am I doing something wrong here?

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

Your input coordinates were geographic?

I suspect that you might want to read this

What is Empirical Bayesian kriging?—ArcGIS Pro | ArcGIS Desktop  the Distance calculations for data in geographic coordinates section.

Repeat your procedure on projected data, to see if the issue is resolved

View solution in original post

3 Replies
SteveLynch
Esri Regular Contributor

Please do the following in ArcGIS Pro

- right click the raster that you created in Pro

- on the Source tab, expand Raster Information

- note the cell size

- repeat the above using the raster you created via the Python script

Are the cell size the same?, they should be.

Now let us have a look at the rendering.

- Click on the raster you created in Pro

- on the Ribbon -> Appearance Tab click on Symbology

Have a look the custom symbology that is created for the output raster when done in the app.

Now do the same for the raster created via the script, it used the default renderer.

You can manually change the symbology or if you click on the "Burger" button on the symbology pane you can import the symbology.

-Steve

DanPatterson_Retired
MVP Emeritus

Your input coordinates were geographic?

I suspect that you might want to read this

What is Empirical Bayesian kriging?—ArcGIS Pro | ArcGIS Desktop  the Distance calculations for data in geographic coordinates section.

Repeat your procedure on projected data, to see if the issue is resolved

roemhildtg
Occasional Contributor III

Yeah, the data was definitely not projected. Projecting the data fixed the issue. Thank you Dan. 

0 Kudos