I have a script that iterates through the double fields in a shapefile and then creates a raster using TopoToRaster but I keep getting an error at the moment it begins with the "Enero" field, this is the code

import arcpy
from arcpy import env
from arcpy.sa import *
arcpy.env.overwriteOutput = True
arcpy.env.extent = r'C:\Users\g-aka\Desktop\Tua\Limite\LimiteTua.shp'

capa = r'C:\Users\g-aka\Desktop\Tua\Precipitacion\EstacionesCopy.shp'
fieldList = []

for field in arcpy.ListFields(capa,"","Double"):  

for i in fieldList:
    Result= TopoToRaster ( TopoPointElevation([[capa, i]]),
                      "10",arcpy.env.extent,"20", "", 
    rasters= r"C:\Users\g-aka\Desktop\Tua\Preci3.gdb\%s" %i
    print rasters
print "finalizado"

it does great when the pixel size es 100 but the moment it is 10 I get an error in Enero but not in Anual, this is the error. I think the reason is the low values of Enero field

these are the valuesworks fine with the others months

the error:

Traceback (most recent call last):
File "D:\Luis\scrips_py\arcgis\Clima\toporaster.py", line 22, in <module>
"20", "", "","ENFORCE_WITH_SINK","SPOT")

File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\sa\Functions.py", line 2926, in TopoToRaster

File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\sa\Utils.py", line 53, in swapper
result = wrapper(*args, **kwargs)

File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\sa\Functions.py", line 2902, in Wrapper

File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\geoprocessing\_base.py", line 506, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
ExecuteError: ERROR 010235: Returned error from Topo_To_Raster.
ERROR 010067: Error in executing grid expression.
Failed to execute (TopoToRaster).
  • Please always provide errors as formatted text rather than pictures. – PolyGeo May 12 at 20:57
  • You're breaking the string between 751200 and 1053171 on the next line. Did you see that your cell size is 12,5 instead of 12.5? I would think that the processor wouldn't like that; your extent could also be an extent object, as per the help resources.arcgis.com/en/help/main/10.2/index.html#//… specified like arcpy.Extent(xmin, ymin, xmax, ymax).. I'm not sure about the square brackets around TopoPointElevation, I think they're superfluous at best, perhaps execute TopoToRaster(TopoPointElevation([[capa, i]]), 12.5 .. etc. Give that a try and see if that helps any. – Michael Stimson May 13 at 5:40
  • Thank you @MichaelStimson, I already check it but it's not working and it only happens when the pixel value is to low, when I set the pixel size to 100 (for example) it works pretty fine (i did what you said) – Luis Medina May 14 at 0:32
  • Can you update your code and error message to show how it is currently please. – Michael Stimson May 14 at 1:49
  • How many points are in the input file? Topo to raster does not like a fine cell size and lots of points to try and interpolate through. What happens if you run the Topo to Raster from the Toolbox and set your cell size to 10? Does it run then? I would normally get a memory error if I tried something too fine. – Keagan Allan May 14 at 2:06

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.