AnsweredAssumed Answered

Cant get ArcGIS 10.3.1 “topo to raster” to work in python script

Question asked by thaelom on Aug 15, 2016
Latest reply on Aug 15, 2016 by xander_bakker

I copied the sample python script from this webpage and modified for my own data and paths.

 

Topo to Raster—Help | ArcGIS for Desktop 

 

# Name: TopoToRaster_Ex_02.py
# Description: Interpolates a hydrologically correct surface
#    from point, line, and polygon data.
# Requirements: Spatial Analyst Extension

# testing topo to raster gcr

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "D:/clovis_portales/cp_spatial/hydrology/water_level_analysis_v7_py"

# Set local variables
##inPointElevations = TopoPointElevation(['wells_in.shp', 'usgs_wl'])

inContours = TopoContour(['rwl_krg_cntr_smth.shp', 'CONTOUR'])

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute TopoToRaster
outTTR = TopoToRaster(inContours)

### Save the output
##outTTR.save("D:/clovis_portales/cp_spatial/hydrology/water_level_analysis_v7_py/ttrout03")

I keep getting the following errors:

Traceback (most recent call last):
  File "D:\clovis_portales\cp_spatial\hydrology\water_level_analysis_v7_py\ord_krige_2010_2015_wls_v2_for_question_post.py", line 25, in <module>
    outTTR = TopoToRaster(inContours)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\sa\Functions.py", line 2777, in TopoToRaster
    out_contour_error_feature)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\sa\Utils.py", line 53, in swapper
    result = wrapper(*args, **kwargs)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\sa\Functions.py", line 2753, in Wrapper
    out_contour_error_feature)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\geoprocessing\_base.py", line 504, in <lambda>
    return lambda *args: val(*gp_fixargs(args, True))
RuntimeError: Object: Error in executing tool

It doesnt work with point or contour data. Topo to raster works fine with same data and paths when using the GUI in arc toolbox

 

thanks in advance for any help

Geoff

Outcomes