I've got a script tool in ArcGIS that runs Curvature and Aspect from Spatial Analyst, and the outputs of both contain an extra column. I've attempted to set the extent in the both the tool and the script to be the same as the input file, but still the extra column appears. The same snap raster is used for all process steps, and is a statewide grid of 20-foot cells, the same size as the cells in these rasters.

I could add a tool to extract the area using the original raster, but I'd rather understand the problem.

Here are what I believe to be the relevant lines of code:

fel= glob.glob(inDir+"\\"+"*_fel.tif")[0]

# Set Geoprocessing environments
arcpy.env.compression = "NONE"
arcpy.env.rasterStatistics = "STATISTICS 1 1"
# arcpy.env.resamplingMethod = "NEAREST"
arcpy.env.snapRaster = "[path deleted]"
arcpy.env.tileSize = "128 128"
arcpy.env.pyramid = "PYRAMIDS -1 NEAREST DEFAULT 75 NO_SKIP"
arcpy.env.extent = fel
arcpy.env.nodata = "NONE"

# Process: Curvature
arcpy.gp.Curvature_sa(fel, Curv, "1", Prof, Plan)

# Process: Aspect
arcpy.gp.Aspect_sa(fel, asp)

I'm using ArcGIS 10.3.1 with foreground processing.

This size mismatch makes it so the rest of the script cannot run, and I should also note, it doesn't always happen. Some outputs are the same size.

  • Shouldn't that be curvRaster = arcpy.sa.Curviture help.arcgis.com/EN/arcgisdesktop/10.0/help/index.html#//…? I don't think that matters though. You've set your extent correctly I can see, perhaps though make your extent as an envelope rather than setting it to a raster... I've found the extent set to a raster sometimes doesn't include NoData around it; d = arcpy.Describe(fel) then arcpy.env.extent = d.extent seems to be a bit more reliable. – Michael Stimson Jul 29 '15 at 1:24
  • @MichaelMiles-Stimson I tried your suggestion but got the same results. I tested the extents in the Python on window just to be sure, and they are different. Sorry for the mess: >>> d = arcpy.Describe(r'I:\HUC10\WSD_NOPtest\HUC03020111_WSDzmod01_fel.tif') >>> print d.extent 2060000.00011212 620000.001880146 2230000.00011212 770000.001880146 NaN NaN NaN NaN >>> f = arcpy.Describe(r'I:\HUC10\WSD_NOPtest\MA_NOP06\HUC03020111_MA_NOP06_asp.tif') >>> print f.extent 2059999.99956218 620000.001880146 2230019.99956218 770000.001880146 NaN NaN NaN NaN – troubbble Jul 29 '15 at 1:49
  • Also @MichaelMiles-Stimson, I believe using the gp version of Spatial Analyst allows you to write a file directly and give its name as an argument, while the arcpy.sa.curvature requires and extra step to save the file. – troubbble Jul 29 '15 at 1:54
  • The point behind that (I believe) is so that you don't have to keep every intermediate... it just depends if you want to keep your curvature raster. Either way works. Does that extent given match what you're expecting? I remember how much fun I had trying to get raster cells exactly 1000 x 1000 on the ephemera, without them shedding their NoData, I gave up with Esri and wrote it in MicroImages SML which gives more control over rasters directly (GDAL would also work). – Michael Stimson Jul 29 '15 at 2:12
  • Try making a couple of fake inputs. Set an extent and export from one of your files. Make one raster 100 cells by 100 cells and the second one 99 cells by 99 cells. Run these and check where and which file gets cells added. Just thinking this has something to do with the neighbourhood analysis going on with these processes. The area/volume raster tools have issues with removing cells... But same reason. Still should be restricted by the extent and snapping Environments. – Mike Jul 29 '15 at 2:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.