Quantcast
Channel: Forums - Geoprocessing
Viewing all articles
Browse latest Browse all 1952

Error Accessing Env.Mask in Python

$
0
0
Below is a snippet of code that I have been working on that loops through the geometry of multiple features of a shapefile and uses that geometry as a mask to get raster properties. However, I'm stumped as to why I continue to get the following error,

RuntimeError: Object: Error in accessing environment <mask>

Code:

import arcpy, os, string, csv
from arcpy import env

winsum = "D:/WERC/GIS_Layers/Summer-Winter Ranges/AllShps/WinterSummer.shp"
env.workspace = workspace
with arcpy.da.SearchCursor(winsum, ['SHAPE@', 'Name', 'Season']) as cursor:
    for row in cursor:
        name = row[1]
        season = row[2]
        env.mask = row[0]
        for raster in arcpy.ListRasters():
            stdResult = arcpy.GetRasterProperties_management(raster, "STD")
            print stdResult
            meanResult = arcpy.GetRasterProperties_management(raster, "MEAN")
            print meanResult
            minResult = arcpy.GetRasterProperties_management(raster, "MINIMUM")
            print minResult
            maxResult = arcpy.GetRasterProperties_management(raster, "MAXIMUM")
            print maxResult

If anyone could point me in the right direction it would be much appreciated. Thanks!

Viewing all articles
Browse latest Browse all 1952

Latest Images

Trending Articles



Latest Images