Sussing out selecting ExtractByMask script failure.

387
3
Jump to solution
03-22-2023 06:36 AM
AlanLePera
New Contributor

Hello, I apologize if this is the wrong format, I am a general Arc user, so my knowledge of script writing is very basic. I am using a script sent to me for creating climate rasters using climate stations across a study area with a designated raster grid. I am at the point in the script where the climate rasters have already been created and stored as temp files and my raster grid is being used as a mask to exclude the data outside of the grid area. For some reason, the mask works fine for the precipitation data, but not the tmax and tmin temperature data. All of the files are being output to the same workspace and all use the same raster grid as the mask. This is what I am getting for the Traceback. 

Traceback (most recent call last):
File "E:\AdaVamoosa_SWB\SWB_climate_grid_20230321_AKLP_TEST.py", line 282, in <module>
arcpy.gp.ExtractByMask_sa(Int(Con(ras_out_tmax < -20, -20, ras_out_tmax+0.5)),gridSnap,tempFCpath+"temp2")
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 010237: Error in building STA while build VAT.
ERROR 010067: Error in executing grid expression.
Failed to execute (ExtractByMask).

I know it can't be a disk space issue because I am running this off of a 1TB external solid-state drive and I know it's not the output workspace because it's outputting precipitation data to the workspace, just not doing so for the temperature data. 

Any advice or input would be greatly appreciated

 

0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

you are mixing gp stuff with unspecified spatial analyst functions

arcpy.gp.ExtractByMask_sa(Int(Con....

Int and Con don't appear to be defined anywhere

try

from arcpy.sa import *

or better still

from arcpy.sa import ExtractByMask, Con, Int


... sort of retired...

View solution in original post

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

moved to Arcgis Spatial Analyst Questions

ArcGIS Spatial Analyst Questions - Esri Community


... sort of retired...
DanPatterson
MVP Esteemed Contributor

you are mixing gp stuff with unspecified spatial analyst functions

arcpy.gp.ExtractByMask_sa(Int(Con....

Int and Con don't appear to be defined anywhere

try

from arcpy.sa import *

or better still

from arcpy.sa import ExtractByMask, Con, Int


... sort of retired...
0 Kudos
AlanLePera
New Contributor

Thank you. Yes, the code is relatively old, from 2014. It has been updated just enough to run with Pro, but certainly needs an overhaul. It seems the error I was getting was caused by a missing "Float" in the expression. It worked after rewriting as

 arcpy.gp.ExtractByMask_sa(Float(Int(Con....

0 Kudos