From 31f1e5d19f09256f21668caa1b6364980382f360 Mon Sep 17 00:00:00 2001 From: Karl Tarbet Date: Mon, 8 Mar 2021 09:58:22 -0800 Subject: [PATCH] Create compute-average-on-july-4.py --- src/compute-average-on-july-4.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/compute-average-on-july-4.py diff --git a/src/compute-average-on-july-4.py b/src/compute-average-on-july-4.py new file mode 100644 index 0000000..fa3f20a --- /dev/null +++ b/src/compute-average-on-july-4.py @@ -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"