Create Overland Flow Connectors- KeyError 26

810
2
03-12-2019 09:59 PM
Labels (1)
lizannewilmot
New Contributor II

Roadblock in the create overland connectors

I’ve followed the stormwater documentation from page 1.  I have created the. gdb’s and feature datasets as per the recommended method.  But when trying to execute I have some warning messages that appear to be fatal. 

The first errors happen in Create Drainage Line Structures

 

When I go to Line 247

        # define full path to output layers

        if parameters[0].altered and not parameters[0].hasBeenValidated:

247         if not parameters[0].isInputValueDerived():

                if parameters[0].value=='':

                    #Reset output

                    parameters[2].value=''

                    parameters[3].value=''

 

Then 989

#..2 by 2 comparison, on the first loop, line on index 0 is compared with line 1,2, till lOIDs.count-1

                    iLoopStart = 0

                    iLoopEnd = len(lOIDs) - 2

                    for iLoopStart in range(0,iLoopEnd + 1):

                       iOID = lOIDs[iLoopStart]

                       with arcpy.da.UpdateCursor(out_drain_lines,[apwrutils.FN_ShapeAt,apwrutils.FN_ShapeAtLength,apwrutils.FN_QCVALUE], sOIDName + "=" + str(iOID)) as rows:

989                        for row in rows:

                               if row[0]:

                                   pointcolpart1 = row[0].getPart(0)

                                   pointcolpartnew = []

                                   for i in pointcolpart1:

                                        pointcolpartnew.append(i)

                                   dlpolyline = dConfLines[iOID]

                                   for nii in range(iLoopStart + 1, len(lOIDs)):

                                       iOID2 = lOIDs[nii]

                                       with arcpy.da.UpdateCursor(out_drain_lines,[apwrutils.FN_ShapeAt,apwrutils.FN_ShapeAtLength,apwrutils.FN_QCVALUE], sOIDName + "=" + str(iOID2)) as rows2:

                                            for row2 in rows2:

                                                 #polyline2 = row2[0]

                                                 if row2[0]:

                                                     pointcolpart2 = row2[0].getPart(0)

                                                     pointcolpart2new = []

                                                     for i in pointcolpart2:

                                                        pointcolpart2new.append(i)

                                                     dlpolyline2 = dConfLines[iOID2]

 

My Python is basic, and I cant work out what the actual issue is. 

 

The final error is, the output cant be opened. 

but when I go into catalogue I’m able to open the file path. 

 

I get the same error when doing the next step, Adjust Flow direction in Streams. 
same thing, once run I can go into catalogue and open the file path

 

In all cases, the output data looks consistent to what was produced when I was running the v1 workflow of the stormwater model. 

The final error, where I’ve hit a road block was in Create Overland Flow connectors

It appears everything runs fine, but I get keyError 26

It related to a python dictionary item not being defined. 

            with arcpy.da.UpdateCursor(outletpathstream,["grid_code","SHAPE@"]) as ucursor:

                for urow in ucursor:

                    gridid = ucursor[0]

                    if gridid>2:

                        #arcpy.AddMessage("GRIDID" + str(gridid))

                        part = urow[1].getPart(0)

  326               x, y = outletdict[gridid]

                        #arcpy.AddWarning("x, y " + str(x) + " " + str(y))

                        part.replace(0, arcpy.Point(x,y))

                        polyline =arcpy.Polyline(arcpy.Array(part))

                        urow[1] = polyline

                        ucursor.updateRow(urow)

 

I’m going to assume the error in creating the overland flow was due to something being missed during the previous steps. 

I’ve tried re-starting the process in a totally new folder. 
I’ve tried again from scratch, re-running the arc hydro to get the input streams

I run the tools with the raster data located in a folder (as per the workflow) and through a .gdb

 

I got a GIS guy from IT to help me debug and we’ve run out of ideas. 

Is this something that has been encountered before? Do you have any ideas on how I could do a workaround?

 

Thanks

Lizanne

0 Kudos
2 Replies
ChristineDartiguenave
Esri Contributor

Please install the new patch for 10.6.1 and retest:

The ArcGIS (Desktop, Engine, Server) 10.6.1 Spatial Analyst Patch is now live on the support site. The URL is:
https://support.esri.com/en/download/7685

Christine Dartiguenave

Esri Water Resources Team

0 Kudos
JenniferPfister
New Contributor

I am still getting no output from the Overland Flow Connectors. Has this been resolved yet? I am running Desktop 10.7.1 Can I move forward without running this tool? 

0 Kudos