Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am receiving the following error when trying to run the following code:

import arcpy

from arcpy import env

from arcpy.sa import *

arcpy.CheckOutExtension = "Spatial"

env.workspace = r"C:\final_mosaic_files\for_python"

Z3 = Raster("mos_zb3")

Z4 = Raster("mos_zb4")

PC2 = Raster("pca_finb2")

outCon = Con(Z4 < -0.9274,2, Con(Z3 <-0.6223,2, Con(PC2 > 1.13,2, Con(Z3 <-0.05342,2,1))))

outCon.save(r"C:\classifications\actual_real_deal\CART")

The error is:

RuntimeError: ERROR 010240: Could not save raster dataset to C:\Users\User\Documents\Mo with output format GRID.

I have tried changing the destination folder, and the file does not currently exist in the directory, and the values of the raster are within GRID parameters for the type of format. The input rasters are mosaics of z-score values of 12 landsat images delineating coastal marsh in the northeast. The cell size is 30X30m, using WGS1984 coordinate system, no projection system. I have tried running the script with .tif file format instead of GRID, which does not work, throwing another error (file Z3 does not exist or is not supported). I have also tried running the script with other, smaller GRID files, which throws the same error 010240.

share|improve this question
1  
Perhaps this link from the ESRI Knowledge Base, may shed some light: Error: ERROR 010240: Could not save raster dataset to... –  Get Spatial Nov 5 '13 at 21:06
3  
have you tried forward slashes? outCon.save("C:/classifications/actual_real_deal/CART") –  mwil Nov 5 '13 at 21:15
    
@Get Spatial - my raster is not from NLCD. I have also tried checking the destination folder, and there was no raster produced, as the error indicates. –  Mo Correll Nov 5 '13 at 21:22
    
@mwil - forward slashes do not work, unfortunately. –  Mo Correll Nov 5 '13 at 21:24
1  
sometimes my raster output goofs if i haven't set: arcpy.env.snapRaster = snapraster-path and arcpy.env.extent = "MAXOF". not sure if that will help with this error and i can't currently test. can you troubleshoot by checking that you are able to create each of your con statements as individual rasters? –  mwil Nov 6 '13 at 15:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.