Lady_Jane

Script Returns NoData (-99999), Manual Processing Does Not

Discussion created by Lady_Jane on May 31, 2011
Hi everyone,
I wrote a script which has been running fine. It uses the "zonal statistics as table" tool. If the raster cells are too big with respect to the polygons being used, then some polygons may be skipped. The script identifies these polygons, converts them to points and uses "extract values to points" to fill in the missing data. The whole thing can be found here: http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=EDC215BC-1422-2418-3467-416ECAC40414

There is one polygon shapefile causing me trouble. While running the script, the polygons not processed by the "zonal statistics as table" tool are correctly identified and converted to points. Running "extract values to points", however, skips one point of the 87 and returns -99999.
If I run all the processes manually, this point is not skipped and is given the correct value of -6.91.

I cannot figure out what is causing this discrepancy between running the tools manually and as part of a script. Here is a code snippet:

# Make sure that the exported missingStats table is not empty
Desc = gp.Describe(missingStats + ".shp")
Extent = Desc.Extent
Width = Extent.Width
#   If it's not empty, then run through the rest of the code:
if Width > 0:
    # Set the output extent equal to the extent of the catchments missing data, to deal with situations where there is only one point
    gp.Extent = str(round(Extent.xmin,6)) + " " + str(round(Extent.xmax,6)) + " " + str(round(Extent.ymin,6)) + " " + str(round(Extent.ymax,6))
    # Convert the exported "missing stats" catchments to point centroids
    gp.FeatureToPoint_management (missingStats + ".shp", points, "INSIDE")     # <---The point is created here

    # Add the underlying raster values to the points
    gp.ExtractValuesToPoints_sa (points + ".shp", raster, pointValues, "INTERPOLATE", "VALUE_ONLY")     # <--- But no value is extracted for it

    # Make table views from the zonal statistics and value to points tables
    gp.MakeTableView_management (statTable, statTableV, "", workspace, "")
    gp.MakeTableView_management (pointValues + ".shp", pointValuesV, "", workspace, "")

    # Convert table views to dBASE tables
    gp.TableToDBASE_conversion (statTableV, workspace)
    gp.TableToDBASE_conversion (pointValuesV, workspace)

Outcomes