<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Use python to ASsign Upstream and Downstream Elevations in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/use-python-to-assign-upstream-and-downstream/m-p/158058#M5309</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Iam using python to manipulate survey data being collected in the field.&amp;nbsp; I am receiving point text files of stormwater drainage data.&amp;nbsp; Some of these are point pairs representing pipe ends.&amp;nbsp; Each point has an elevation.&amp;nbsp; The surveyors don't know if they are upstream or down stream.&amp;nbsp; I need to look at the point pairs, read the elvation for each and then place the value in the correct downstream or upstream column when creating the line file.&amp;nbsp; Can anyone assist me with doing this?&amp;nbsp; I have a table of just the pipe points.&amp;nbsp; Each pair has the same pipcode value indicating that pair makes up one pipe.&amp;nbsp; How do I examine each record of that pair, look at the two elevations and assign them correctly when I create a line file?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for any assistance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Jan 2013 14:18:28 GMT</pubDate>
    <dc:creator>GarySchells</dc:creator>
    <dc:date>2013-01-24T14:18:28Z</dc:date>
    <item>
      <title>Use python to ASsign Upstream and Downstream Elevations</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/use-python-to-assign-upstream-and-downstream/m-p/158058#M5309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Iam using python to manipulate survey data being collected in the field.&amp;nbsp; I am receiving point text files of stormwater drainage data.&amp;nbsp; Some of these are point pairs representing pipe ends.&amp;nbsp; Each point has an elevation.&amp;nbsp; The surveyors don't know if they are upstream or down stream.&amp;nbsp; I need to look at the point pairs, read the elvation for each and then place the value in the correct downstream or upstream column when creating the line file.&amp;nbsp; Can anyone assist me with doing this?&amp;nbsp; I have a table of just the pipe points.&amp;nbsp; Each pair has the same pipcode value indicating that pair makes up one pipe.&amp;nbsp; How do I examine each record of that pair, look at the two elevations and assign them correctly when I create a line file?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for any assistance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 14:18:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/use-python-to-assign-upstream-and-downstream/m-p/158058#M5309</guid>
      <dc:creator>GarySchells</dc:creator>
      <dc:date>2013-01-24T14:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Use python to ASsign Upstream and Downstream Elevations</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/use-python-to-assign-upstream-and-downstream/m-p/158059#M5310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Something like this may work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
arcpy.env.overwriteOutput = True
pipesFC = r'C:\Testing\outputs\test.shp'
minMax = r'in_memory\table'

stats = [['Elevation', 'MIN'],['Elevation','MAX']]
arcpy.Statistics_analysis(pipesFC, minMax, stats,'Pipe_ID')

# Generate dictionary to hold pipe ID min/max elevations
val_dict = {}
with arcpy.da.SearchCursor(minMax, ['Pipe_ID','MIN_Elevation','MAX_Elevation']) as rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val_dict[row[0]] = [row[1],row[2]]

# Update records in table
with arcpy.da.UpdateCursor(pipesFC,['Pipe_ID','DownElv','UpElv']) as rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[0] in val_dict:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; down = val_dict[row[0]][0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; up = val_dict[row[0]][1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[1] = down
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[2] = up
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
print 'done'
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:21:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/use-python-to-assign-upstream-and-downstream/m-p/158059#M5310</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T08:21:16Z</dc:date>
    </item>
  </channel>
</rss>

