how to resolve an invalid workspace

8782
5
10-13-2013 08:24 AM
Jon_PaulPierre
New Contributor
I have been working with a third party extension called Landscape Fragmentation Tool.  I had it working just fine three weeks ago and now I cannot make the tool work for me.
I would greatly appreciate any help that someone can provide. 
I am continuously receiving this error:

Executing: Landscape_Fragmentation_Tool NLCD_reclass_bfpads1 90 C:\Users\Beth\Documents\ArcGIS\lftmod\landfragmod.gdb C:\Users\Beth\Documents\ArcGIS\lftmod\landfragmod.gdb\lfttestsat
Start Time: Sat Oct 12 18:00:14 2013
Running script Landscape_Fragmentation_Tool...

OUTPUT DATASET NAME IS:

    C:\Users\Beth\Documents\ArcGIS\lftmod\landfragmod.gdb\C:\Users\Beth\Documents\ArcGIS\lftmod\landfragmod.gdb\lfttestsat

DATA EXTRACTED FROM LAND COVER
EDGE FRAGMENTATION IDENTIFIED
INTERIOR, PATCH, AND PERFORATED FRAGMENTATION IDENTIFIED
CATEGORIZING CORE FOREST PATCHES...
  File "C:\Users\Beth\Documents\Landscape_Fragmentation_SA\Landscape_Fragmentation_SA\LFT_SA_Arc10.py", line 334, in <module>
    arcpy.ASCIIToRaster_conversion (fragMap_6c, FragMap, "INTEGER")

<class 'arcgisscripting.ExecuteError'>: ERROR 000875: Output raster: C:\Users\Beth\Documents\ArcGIS\lftmod\landfragmod.gdb\C:\Users\Beth\Documents\ArcGIS\lftmod\landfragmod.gdb\lfttestsat's workspace is an invalid output workspace.
ERROR 000581: Invalid parameters.
Failed to execute (ASCIIToRaster).

Completed script Landscape_Fragmentation_Tool...
Failed to execute (Landscape_Fragmentation_Tool).
Failed at Sat Oct 12 19:02:49 2013 (Elapsed Time: 1 hours 2 minutes 35 seconds)
0 Kudos
5 Replies
NeilAyres
MVP Alum

Running script Landscape_Fragmentation_Tool...

OUTPUT DATASET NAME IS:

    C:\Users\Beth\Documents\ArcGIS\lftmod\landfragmod.gdb\C:\Users\Beth\Documents\ArcGIS\lftmod\landfragmod.gdb\lfttestsat



Well you can see that this path is invalid. It looks like the prog is not resolving the difference between the dataset name "lfttestsat" and the path the the gdb, but is concatenating them together.
Never used the Landscape Fragmentation tool. But if it worked before this, then what are you now doing differently?
In this example you are storing your outputs in a fgdb. Previously were you using shapefiles perhaps?
Good luck,
Neil
0 Kudos
Jon_PaulPierre
New Contributor
I have only been using raster files.  I did notice that when I completed it successfully I was doing it inside of a personal geodatabase (.mdb) and not a .gdb.
However, I've been trying to recreate the successful run inside an .mdb and it does not work.
I've attached a screen capture of the successful run.  And a word doc of the latest failure in an .mdb.
Lastly, I attached a copy of the script.

Any help is appreciated.  I am desperate to resolve this at this point.

Thanks.
Jon Paul
0 Kudos
NeilAyres
MVP Alum
jp,

Looking at the python code :
try:


    # enable the overwrite option...
    arcpy.env.overwriteOutput = 1
    
    

    # check out spatial analyst license...
    arcpy.CheckOutExtension("spatial")
                    
    # script parameters...
    landcover = sys.argv[1]         # input raster dataset
    edgeWidth = float(sys.argv[2])         # number
    wksp = sys.argv[3]              # output raster location
    FragMap_lyr = sys.argv[4]       # display layer


##    landcover = r"C:\Projects\ForestFragModel\test_landcover\lc_forest_nonforest.img"
##    edgeWidth = 305        # string
##    wksp = r"C:\Temp"              # output raster location
##    FragMap_lyr = "ff_test"

    s = time.clock()

    #-----------------------------------------------------------
    # CREATE OUTPUT RASTER NAME FROM WORKSPACE AND LAYER NAME...
            
    # if workspace is a geodatabase, no extension needed...
    if ".gdb" in wksp or ".mdb" in wksp:
        FragMap = "%s\\%s" % (wksp,FragMap_lyr)

    # otherwise use ".img" extension (no length / character restrictions)...
    else:    
        FragMap = "%s\\%s.img" % (wksp,FragMap_lyr)

    # provide user feedback...
    arcpy.AddMessage("\nOUTPUT DATASET NAME IS:")
    print "\nOUTPUT DATASET NAME IS:"
    arcpy.AddMessage("\n\t%s\n" % FragMap)
    print "\n\t%s\n" % FragMap

This is the first part, taking in the inputs and setting the outputs.
The pathing is not handled very elegantly imho, but perhaps you are selecting a dataset rather than a workspace (sys.argv(3)).
I see the your successful run you used an *.img image file instead of outputting to a geodatabase. Perhaps try that.
Otherwise, a general point, I would not have any spaces in the path or the filenames.
Never used this tool, so that's about it from me.
Good luck,
Neil
0 Kudos
curtvprice
MVP Esteemed Contributor
Jon Paul, just a note, you can copy and paste messages as text from the Messages item in the Results, this is much better than screen shots, especially if you paste into the form inside[noparse]
[/noparse] tags.


A few additional thoughts


  • Neil is correct that the tool's fourth argument should be a raster name, not a workspace path, for example "lftbuffest". (In the screenshot of what worked, you used a name "NLCDpingclip" not a path.)

  • I would avoid .mdb's if you can, as they are deprecated and have many serious limitations. 

  • Make sure your current and scratch workspaces are set (to a folder or a gdb) before you run the tool, this should help.

  • For raster processing, it's best to have both workspaces point to the same location.

0 Kudos
NeilAyres
MVP Alum
Welcome back Curtis,
It's good to see that the crisis has been averted and that we can again get your insightful contributions here.
Cheers,
Neil
0 Kudos