+ Reply to Thread
Results 1 to 4 of 4

Thread: ExtractByMask Error

  1. #1
    wentao che
    Join Date
    Nov 2009
    Posts
    31
    Points
    0
    Answers Provided
    0


    0

    Question ExtractByMask Error

    Hi,

    ExtractByMask does not work for the following Python:

    import arcpy
    arcpy.CheckOutExtension("spatial")
    tif = "H:\\Test-20100419\\t.tif"
    shp = "H:\\Test-20100419\\A27401_05.shp"
    out_raster = "H:\\Test-20100419\\ttt.tif"
    out = arcpy.sa.ExtractByMask(tif, shp)
    out.save(out_raster)

    Error message:

    Traceback (most recent call last):
    File "H:\Test-20100419\test.py", line 6, in <module>
    out = arcpy.sa.ExtractByMask(tif, shp)
    File "C:\ArcGIS\Desktop9.4\arcpy\arcpy\sa\Functions.py", line 1210, in ExtractByMask
    in_mask_data)
    File "C:\ArcGIS\Desktop9.4\arcpy\arcpy\sa\Utils.py", line 67, in swapper
    result = wrapper(*args, **kwargs)
    File "C:\ArcGIS\Desktop9.4\arcpy\arcpy\sa\Functions.py", line 1204, in wrapper
    out_raster)
    File "C:\ArcGIS\Desktop9.4\arcpy\arcpy\geoprocessing\_base.py", line 438, in <lambda>
    return lambda *args: val(*gp_fixargs(args))
    arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
    ERROR 000879: Output raster: The length of the stack base name in H:\Test-20100419\Extract_t1 is longer than 9.
    Failed to execute (ExtractByMask).

    I set the output raster as a TIF not a Grid Stack, I can not understand the error message "The length of the stack base name is longer than 9." This is not the case.

    There is no any problem when I use ExtractByMask Tool in ArcToolbox.

    Best regards,

    Wentao

    KKC, Tokyo, Japan

  2. #2
    Ryan DeBruyn
    Join Date
    Nov 2009
    Posts
    34
    Points
    6
    Answers Provided
    0


    0

    Default

    HI Wentao

    There seems to be an issue with the name of the temporary raster that is created by the tool. By default you must have a file based scratch workspace set so the format is attempting to create a grid stack(limit 9 characters).

    Try to set a file geodatabase as your scratch workspace there will not be a name restriction.

    arcpy.env.scratchWorkspace = "c:/data/myfilegdb.gdb"
    out = arcpy.sa.ExtractByMask(tif, shp)
    out.save("C:/output/final_ras")

    Thank you for your input, we will work to remedy the error.

    -Ryan
    ESRI Spatial Analyst Team

  3. #3
    wentao che
    Join Date
    Nov 2009
    Posts
    31
    Points
    0
    Answers Provided
    0


    0

    Default

    Hi Ryan,

    Thank you for your reply.

    I tried to set scratch workspace and worksapce to :\Test-20100419\myfilegdb.gdb, both are failed.
    Herre is the error message:

    File "H:\Test-20100419\test2.py", line 19, in <module>
    out = arcpy.sa.ExtractByMask(tif, shp)
    File "C:\ArcGIS\Desktop9.4\arcpy\arcpy\sa\Functions.py", line 1210, in ExtractByMask
    in_mask_data)
    File "C:\ArcGIS\Desktop9.4\arcpy\arcpy\sa\Utils.py", line 67, in swapper
    result = wrapper(*args, **kwargs)
    File "C:\ArcGIS\Desktop9.4\arcpy\arcpy\sa\Functions.py", line 1204, in wrapper
    out_raster)
    File "C:\ArcGIS\Desktop9.4\arcpy\arcpy\geoprocessing\_base.py", line 438, in <lambda>
    return lambda *args: val(*gp_fixargs(args))
    arcgisscripting.ExecuteError: ERROR 000875: Output raster: H:\Test-20100419\myfilegdb.gdb\Extract_tif1's workspace is an invalid output workspace.
    ERROR 000581: Invalid parameters.
    Failed to execute (ExtractByMask).

    Wentao

  4. #4
    Peter Prokein
    Join Date
    Oct 2010
    Posts
    4
    Points
    0
    Answers Provided
    0


    0

    Default Re: ExtractByMask Error

    This problem persists in Arc10 Build2414.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts