kirenbahm / ENP_TOOLS

Scripts used to pre- and post-process data
0 stars 2 forks source link

Fix calculation of average flows for observed data #65

Open kirenbahm opened 2 years ago

kirenbahm commented 2 years ago

Open questions - should missing flow values be replaced with zeros? How should averaging over missing data be performed? What about stage data? How are the comparisons performed now? is modeled data that doesn't have corresponding obs data excluded form calculations?

Currently the average flow values for Observed data are not calculated correctly. (The average modeled flows (M01 and M06) appear correct.)

The problem appears in the files DS_YEARLY_AVE.txt , DS_M_AVE.txt, and the Critical Flows Report (examples below)

I believe that the averaging for the Observed data is happening over just the period where there is data present, instead of the entire requested time period. For example, S332BN average observed flow is about twice what it should be.

Please fix the code so the flows are calculated correctly. Thanks!

These files show incorrect values:

DS_YEARLY_AVE.txt

Average yearly discharges in kilo acre feet (kaf)
             Station    M01 M06 Observed
            S332BN_Q       27.40       27.47       50.25

DS_M_AVE.txt

Average monthly
S332BN_Q    Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 
M01         0.63        2.42        3.76       10.93       15.93       49.64       50.40       62.09       67.59       73.71       64.20       51.33    
M06         0.74        2.55        3.92       11.10       16.05       49.69       50.46       62.16       67.67       73.75       64.25       51.37    
Observed        2.13        6.02        8.24       20.25       29.28       86.68       95.06      113.36      123.60      127.40      110.90       88.78    

These files show correct values:

DS_Y_AVE.txt

Average annual stages and discharges in ft and cfs
S332BN_Q    1999    2000    2001    2002    2003    2004    2005    2006    2007    2008    2009    2010    
M01        -0.50       -0.53       -0.71       -0.61       -0.47       34.09      107.13        5.84       20.36       91.85       78.92      119.05    
M06        -0.49       -0.47       -0.64       -0.52       -0.42       34.20      107.20        5.96       20.48       91.99       79.08      119.14    
Observed         NaN         NaN         NaN         NaN         NaN       45.55      107.84        7.31       21.18       92.70       79.87      119.72    

DS_ACCUMULATED.txt

Cumulative discharges in kilo acre feet (kaf) at the end of the simulation period
           S332BN_Q   329.00      329.79      335.08