Skip to content

Commit

Permalink
Create compute-average-on-july-4.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ktarbet authored Mar 8, 2021
1 parent 07c502b commit 31f1e5d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/compute-average-on-july-4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from hec.heclib.util import HecTime

from hec.heclib.dss import HecDss, DSSPathname

def isTargetDate(t):
return t.month()==7 and t.day()==4

print ("hi2")

dss = HecDss.open("C:\project\DSSVue-CWMSVue\Hickey-DssVue30minDemo\Data for EFM relationships.dss")
flow = dss.get("/SAN JOAQUIN/VERNALIS/FLOW//1Day/GAGED/")
print flow.units
times = flow.getTimes()
i = 0
count =0
avg =0
for Q in flow.values:
t = times.element(i)
if isTargetDate(t) :
avg += Q
count+=1
i = i+1

avg = avg/count
print "Average: "+str(avg)

print "done"

0 comments on commit 31f1e5d

Please sign in to comment.