arcpy.sa.TopoToRaster Visual Fortran error

4083
15
04-05-2016 10:09 AM
RodrigoRocha
New Contributor II

Hello everybody , I'm trying to run Topo to Raster by Arcpy, in a ArcGIS Desktop 10.2 , however, every time appears the following warning and ArcGis closes. I did an experiment by turning the Topo to Raster directly from ArcToolbox and worked perfectly. I also tried to run the tool in ModelBuilder , successfully. The error message are attached.

0 Kudos
15 Replies
DanPatterson_Retired
MVP Esteemed Contributor

seen 3 years ago... https://community.esri.com/message/468079#comment-468079

no closed resolution

SteveLynch
Esri Regular Contributor

...we'll need info :)

I would guess that it is related to the output raster size and/or number of inputs. Try changing the output cellsize or limiting the number of input contours. We have done much work on trapping the "out of memory" errors so this may be non-reproducible in versions post 10.2

BTW, TopoToRaster is written in Fortran and that is most likely the reason for throwing this error.

-Steve

DanPatterson_Retired
MVP Esteemed Contributor

I suspect not Fortran 77 ... sigh

SteveLynch
Esri Regular Contributor

Correct, however, there are still constraints and you might want to read How large a DEM can the TopoToRaster tool create?

curtvprice
MVP Esteemed Contributor

If the inputs are the same, I would look at the difference in environment. The error message is low-level and makes it look like files can't be written... have you set the env workspace and scratchWorkspace the same as they are set in the ArcMap session, or are they None -- or set to a non-existent workspace (by a typo or misspelling the path by neglecting to use raw strings (r"c:\workspace")

RodrigoRocha
New Contributor II

Curtis, both env.worspace as env.scratchworkspace are declared in the script, however, to get 99% of the running, the pop-up on the Visual Fortran Error appears and then closes the ArcGis!

Already I tested without declaring environment, but the problem persists!

Also revised all path and spelling, but all are correct.

Dan Patterson, read about the suggested article "How large the DEM can the tool TopoToRaster create?"(https://geonet.esri.com/external-link.jspa?url=https%3A%2F%2Fblogs.esri.com%2Fesri%2Farcgis%2F2012%2...), however, the expected DEM are within the processing capacity (Win7, Intel i5-650, 4GB RAM, ArcGis10.2, etc).

Anyway, I appreciate the ideas. The discussion is always welcome!

The following script text below:

... import arcpy

... from arcpy import env

... from arcpy.sa import *

...

... # Set environment settings

... env.workspace = r"C:\Users\rodrigotr\Documents\01_PROCESSOS\2016\indice_cartas_split_buffer"

... env.scratchWorkspace = r"C:\Users\rodrigotr\Documents\01_PROCESSOS\2016\indice_cartas_split_buffer"

...

... # Set local variables

... input = r"C:\Users\rodrigotr\Documents\01_PROCESSOS\2016\indice_cartas_split_buffer\CN_cartas_buff5mUTM23sirgas2k\CN_buff5m_26124se.shp"

... outputFolder = r"C:\Users\rodrigotr\Documents\01_PROCESSOS\2016\indice_cartas_split_buffer\outMDE"

... inContours = TopoContour([[input, 'COTA']])

... inFeatures = ([inContours])

...

... # Execute TopoToRaster

... outTTR = TopoToRaster(inFeatures)

...

... # Save the output

... outTTR.save(outputFolder + "\\" + outTTR + ".tif")

That's all folks!

0 Kudos
PeterWilson
Regular Contributor

Hi Rodrigo

I suspect its the environment settings that are not being explicitly being set when you run the TopoToRaster from Python. When you run it from within ArcMap your current environment settings would be used. I also noted that you have not provided a Boundary Feature Class or set the output Cell Size of the DEM that you are generating. I would try to first provide a boundary Feature Class to limit the DEM extent that is being generated. Make sure they are both using same projected coordinate system.

I run TopoTo Raster on a daily basis on very large data sets that few would ever require and using the following workflow have had no errors:

  • Dissolve my contours by the height field (Make sure to remove the selection to create multi-parts)
  • Repair the geometry of the dissolved contours to remove any empty or self intersecting geometries
  • Provide a Boundary Feature Class to limit the extent of the processing extent
  • Provide a Cell Size for the output DEM based on the limitations of the input contours. As a rule of thumb I don't exceed the contour height interval by half. (.i.e. Contour vertical interval is 10m so my Cell Size would be 5m)

Hope the following helps

0 Kudos
RodrigoRocha
New Contributor II

Hi Peter,

In previous attempts, I explored the syntax arcpy.sa.TopoToRaster the most. The vertical contour interval feature class that I am using is 10m and the cellsize I use is 5m. I also use a feature class boundary. The extent already is a parameter that generates me questions. I don't know if I declare in the script as a variable using previously arcpy.env.extent.

In another experiment, I tried to create a model in ModelBuilder, using TopoToRaster and declaring the workspace. After running the tool, captured the code with their respective parameters and variables used by the Results> Copy As Python Snippet. Later, I pasted the code in ArcMap Python Window and ran. TopoToRaster with the same parameters and variables now in arcpy, after 99% closed by error.

Some friends of nearby universities, working in the geomatics area when they heard of this problem, suggested that this is a bug in arcpy.

But I still could not reach a conclusion. I will continue performing tests. I will do another test considering Peter's suggestions.

Any news, I write. But I ask everyone to continue trying to help.

Regards, Rodrigo

0 Kudos
PeterWilson
Regular Contributor

Hi Rodrigo

If the contours file is not too large zip it and attach it to the forum postl. I'll have  a look at the following to see if I can resolve the problem that you are having, Regards Peter

0 Kudos