Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Could not save raster dataset to ("path") with output format FGDBR.

$
0
0
I'm running a loop that iterates through a series of map algebra expressions and I get this error:

Code:

Traceback (most recent call last):
  File "G:\Thesis\BACKUP\Thesis\Code\PyCode\LandSatAccurAssesment\OneD_Analysis_Code_USE.py", line 62, in <module>
    outsetnull=SetNull (outrast,outrast, "Value < 0")
  File "C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Functions.py", line 311, in SetNull
    where_clause)
  File "C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Utils.py", line 47, in swapper
    result = wrapper(*args, **kwargs)
  File "C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Functions.py", line 306, in wrapper
    where_clause)
  File "C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 498, in <lambda>
    return lambda *args: val(*gp_fixargs(args, True))
RuntimeError: ERROR 010240: Could not save raster dataset to C:\Users\mbs7038\Documents\New_Landsat_Imagery\For_Area_Calc\Gauges_For_AccuracyAssessment\W_Gauges\km.gdb\minus_ras2 with output format FGDBR.

I've troubleshooted by reading through other forum posts about this error and still have not debugged my code:

Code:

import arcpy
from arcpy import env
from arcpy.sa import*

env.workspace =r"C:\Users\mbs7038\Documents\New_Landsat_Imagery\For_Area_Calc\Gauges_For_AccuracyAssessment\W_Gauges\km.gdb"

OneD_savepath="C:\Users\mbs7038\Documents\New_Landsat_Imagery\For_Area_Calc\Gauges_For_AccuracyAssessment\W_Gauges\OneD.gdb"

env.overwriteOutput = True

arcpy.overwriteOutput = True

# List inputs
print 'listing inputs'
dem="C:\Users\mbs7038\Documents\New_Landsat_Imagery\For_Area_Calc\Gauges_For_AccuracyAssessment\W_Gauges\W_Gauges.gdb\W_Basin_DEM"

print 'listing rasters'
kriglist= arcpy.ListRasters("a*")


# Check out the ArcGIS Spatial Analyst extension license
print 'checking spatial analyst license'
arcpy.CheckOutExtension("Spatial")


# Starting from the first krig raster, iterate through to the fourth [0] - [3]
# start at index [0]
print 'initializing for loop'
for k in range (3):
    print(k)
    print "1 Dimensional Analysis Part 1:"
    print "calculating difference"
    outrast = ((Raster(kriglist[k]) - dem))

    print "1 Dimensional Analysis Part 2:"
    print "running setnull"
    outsetnull=SetNull (outrast,outrast, "Value < 0")
    outrastName = "oneD" + "_" + (kriglist[k])[:-10]

    print 'saving 1D grid'
    outsetnull.save(OneD_savepath + "/" + outrastName)


    print arcpy.GetMessages()

When the env.workspace path is set to other folders containing multiple rasters, sometimes the code works fine while other times it will iterate though the first few rasters like its supposed to, and then I get the error message (010240): could not save raster with output format FGDBR. In this instance, the line of code stops working during the Setnull function. Its looks like the code attempts to save a raster grid using default naming parameters, "minus_ras2", to my env.workspace. Is there a way to get it to not do this?

Any suggestions?

Thanks

Viewing all articles
Browse latest Browse all 2485

Latest Images

Trending Articles



Latest Images