I'm writing a script that needs to clip a multidimensional raster (Gridmet temperature data) to a smaller area. Poking around the documentation this is the workflow that I came up with
temp_max_file = r"D:\r3_analyst_work\Climate_Change_Modeling\climate_envelope\GridMetData_2020\tmmx_2020.nc" max_temp_rast = arcpy.Raster(temp_max_file,True) clip_frame= r"D:\r3_analyst_work\GIS_work\test_working_netcdf_climate_data\Default.gdb\small_area" max_temp_clip_raster = arcpy.sa.Foreach(max_temp_rast,"Clip",{"ClippingGeometry":clip_frame, "ClippingType":1})
When I run this I get
**RuntimeError Traceback (most recent call last)
In [39]:
Line 1: max_temp_clip_raster = arcpy.sa.Foreach(max_temp_rast,"Clip",{"ClippingGeometry":clip_frame, "ClippingType":1})
File C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\ia_ia.py, in Foreach:
Line 114: return arcgisscripting._ia.Foreach(in_raster=in_raster,
RuntimeError: Failed to apply Raster Function: 'Clip' (The parameter is incorrect. )**
There is no indication what parameter is incorrect.
I had to extract the parameter name by exporting the Clip raster function and then reading the XML document.
Using the ArcPro interface the raster function works correctly on those data sets.
From what I can tell, my code is exactly the same as the NDVI example provided in the Foreach documentation.
I'm writing a script that needs to clip a multidimensional raster (Gridmet temperature data) to a smaller area. Poking around the documentation this is the workflow that I came up with
temp_max_file = r"D:\r3_analyst_work\Climate_Change_Modeling\climate_envelope\GridMetData_2020\tmmx_2020.nc" max_temp_rast = arcpy.Raster(temp_max_file,True) clip_frame= r"D:\r3_analyst_work\GIS_work\test_working_netcdf_climate_data\Default.gdb\small_area" max_temp_clip_raster = arcpy.sa.Foreach(max_temp_rast,"Clip",{"ClippingGeometry":clip_frame, "ClippingType":1})When I run this I get
**RuntimeError Traceback (most recent call last)
In [39]:
Line 1: max_temp_clip_raster = arcpy.sa.Foreach(max_temp_rast,"Clip",{"ClippingGeometry":clip_frame, "ClippingType":1})
File C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\ia_ia.py, in Foreach:
Line 114: return arcgisscripting._ia.Foreach(in_raster=in_raster,
RuntimeError: Failed to apply Raster Function: 'Clip' (The parameter is incorrect. )**
There is no indication what parameter is incorrect.
I had to extract the parameter name by exporting the Clip raster function and then reading the XML document.
Using the ArcPro interface the raster function works correctly on those data sets.
From what I can tell, my code is exactly the same as the NDVI example provided in the Foreach documentation.