Select to view content in your preferred language

Python script error message

2550
17
10-02-2018 12:03 PM
JimFritz
Regular Contributor

Any help with the error message below would be appreciated. 

Thanks,

arcpy.env.workspace = outbufferpath
featureClassList = arcpy.ListFeatureClasses()
for featureClass in featureClassList:
    for row in arcpy.da.SearchCursor(featureClass,'SHAPE@'):
        arcpy.management.Clip(raster, row[0].extent, outrasterpath + featureClass, featureClass, -3.402823e+38, "ClippingGeometry", "MAINTAIN_EXTENT")


Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 15215, in Clip
    raise e
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 15212, in Clip
    retval = convertArcObjectToPythonObject(gp.Clip_management(*gp_fixargs((in_raster, rectangle, out_raster, in_template_dataset, nodata_value, clipping_geometry, maintain_clipping_extent), True)))
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 496, in <lambda>
    return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000445: Extension is invalid for the output raster format.
Failed to execute (Clip).
0 Kudos
17 Replies
JimFritz
Regular Contributor

Just some additional info.  There really is no extension for an ESRI format grid so this error message is hard to understand.

0 Kudos
JoeBorgione
MVP Emeritus

I see two 'clips':

Clip—Help | ArcGIS Desktop  where the syntax is arcpy.Clip_analysis(.....)

and

Clip—Help | ArcGIS Desktop  where the syntax is arcpy.Clip_management(.....)

Where is arcpy.Managemnet.Clip()  ?

That should just about do it....
0 Kudos
DanPatterson_Retired
MVP Emeritus

see below... it should be the clip in analysis

0 Kudos
DarrenWiens2
MVP Honored Contributor

What is this value?

outrasterpath + featureClass
0 Kudos
DanPatterson_Retired
MVP Emeritus

You should be using Clip in the Analysis toolbox

Clip—Help | ArcGIS Desktop  same in arcmap or pro

Clip in management is for grids

0 Kudos
DarrenWiens2
MVP Honored Contributor

It seems they're trying to perform raster clip, so this (i.e. management clip) is the correct tool.

0 Kudos
JimFritz
Regular Contributor

Yes, clip management is the right one, outrasterpath is defined below:

# out path to clipped rasters
outrasterpath = r"S:/General-Offices-GO-Trans/SLR-Mapping/GIS_Projects_2018/Smart_T_Line_Model/geodata/TEST_RASTERCLIP.gdb/"

Script is still not working.

0 Kudos
DanPatterson_Retired
MVP Emeritus

from your script all I see is featureclasses,  Where is the raster coming from?

Something is missing.  Is the raster defined somewhere else?

featureClassList = arcpy.ListFeatureClasses()
for featureClass in featureClassList:
    for row in arcpy.da.SearchCursor(featureClass,'SHAPE@'):
        arcpy.management.Clip(raster, row[0].extent, o

can you provide what is needed for your raster clip, like... raster, outrasterpath. 

raster, row[0].extent, outrasterpath + featureClass, featureClass, -3.402823e+38, "ClippingGeometry", "MAINTAIN_EXTENT"

also, you aren't specifying any file name for the raster so you will end up with esri grids which I am not sure if your nodata value minimum  (-3.402823e+38) is supported... maybe check that as well

0 Kudos
JimFritz
Regular Contributor

Yes, hoping for ESRI grids as output.  Not sure where to check on the nodata value minimum?

0 Kudos