onei0125

Passing Python Variables into the Geospatial Modeling Environment?

Discussion created by onei0125 on Jul 1, 2011
Latest reply on Sep 13, 2013 by amontgomery3030
Hello,

I am trying to process a batch of rasters using the GME command isectpolyrst.  I am running ArcMap 10 and the newest standalone version of GME.  Does anyone know if it is possible to pass a list of .tif files using the command arcpy.ListRasters() from Python into the GME environment?  If so, how is that done?  The script that I started is below.  It runs without error but doesn't do anything.  I am a beginner when it comes to Python and all other programming so please take that into consideration.

Thank you! 

Shawn O.
U.S. Fish and Wildlife Service (HAPET)
Great Falls, MT 59404

# import standard system modules
import arcpy, os, sys
from arcpy import env

# set workspace directory

Dir = "C:\\Users\\GISuser\\Desktop\\ONeil_2011\\Scaup Folders\\Habitat Attributes\\2007"
env.workspace = Dir

# List all rasters in the workspace

rasters = arcpy.ListRasters()
grid = "C:\\Users\\GISuser\\Desktop\\ONeil_2011\\Scaup Folders\\all_grids.shp"

# Run each raster through the GME command "isectpolyrst"

for raster in rasters:
    os.system("C:\\Program Files (x86)\\SpatialEcology\\GME\\SEGME.exe isectpolyrst(in=\\\"grid\\\", raster = \\\"raster\\\", prefix = \\\"raster[:3])\\\", where \\\"Year=2007\\\";")

Outcomes