import salishsea_tools.river_202108 as rivers
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
rivers_puget = rivers.prop_dict['puget']
rivers_puget.keys()
dict_keys(['Johnson', 'Jimmycomelately', 'SalmonSnow', 'Chimacum', 'Thorndike', 'Torboo', 'LittleBigQuilcene', 'Dosewalips', 'Duckabush', 'Fulton', 'Waketick', 'HammaHamma', 'Jorsted', 'Eagle', 'Lilliwaup', 'Finch', 'Skokomish', 'Rendsland', 'Tahuya', 'Mission', 'Union', 'Coulter', 'Minter', 'Burley', 'Olalla', 'Blackjack', 'ClearBarker', 'BigValley', 'BigBear', 'Swaback', 'Stavis', 'Anderson', 'Dewatta', 'Sherwood', 'DeerJohnsGoldboroughMill', 'Skookum', 'KennedySchneider', 'PerryMcClane', 'Deschutes', 'Woodward', 'Woodland', 'Chambers', 'NisquallyMcAllister', 'Puyallup', 'Hylebas', 'Duwamish1', 'Duwamish2', 'CedarSammamish'])
data = pd.read_csv('/ocean/cstang/MOAD/rivers_data/river_dailies_to_ts_rivers_20171210_20221231.csv')
data.iloc[:,3:]
Johnson [kg/m2/s] | Jimmycomelately [kg/m2/s] | SalmonSnow [kg/m2/s] | Chimacum [kg/m2/s] | Thorndike [kg/m2/s] | Torboo [kg/m2/s] | LittleBigQuilcene [kg/m2/s] | Dosewalips [kg/m2/s] | Duckabush [kg/m2/s] | Fulton [kg/m2/s] | ... | Deschutes [kg/m2/s] | Woodward [kg/m2/s] | Woodland [kg/m2/s] | Chambers [kg/m2/s] | NisquallyMcAllister [kg/m2/s] | Puyallup [kg/m2/s] | Hylebas [kg/m2/s] | Duwamish1 [kg/m2/s] | Duwamish2 [kg/m2/s] | CedarSammamish [kg/m2/s] | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 0.014361 | 0.014347 | 0.071620 | 0.057317 | 0.014253 | 0.014272 | 0.099892 | 0.056994 | 0.039894 | 0.005701 | ... | 0.059857 | 0.008521 | 0.008524 | 0.056353 | 0.424030 | 0.559204 | 0.002810 | 0.141188 | 0.141189 | 0.283189 |
1 | 0.014065 | 0.014052 | 0.070146 | 0.056137 | 0.013960 | 0.013979 | 0.097836 | 0.055820 | 0.039073 | 0.005584 | ... | 0.058625 | 0.008345 | 0.008348 | 0.055193 | 0.415300 | 0.547691 | 0.002752 | 0.138281 | 0.138282 | 0.277359 |
2 | 0.013733 | 0.013720 | 0.068488 | 0.054810 | 0.013630 | 0.013648 | 0.095523 | 0.054501 | 0.038149 | 0.005452 | ... | 0.057239 | 0.008148 | 0.008151 | 0.053889 | 0.405483 | 0.534745 | 0.002687 | 0.135013 | 0.135013 | 0.270803 |
3 | 0.013474 | 0.013462 | 0.067199 | 0.053778 | 0.013373 | 0.013391 | 0.093725 | 0.053475 | 0.037431 | 0.005349 | ... | 0.056162 | 0.007995 | 0.007997 | 0.052874 | 0.397852 | 0.524681 | 0.002636 | 0.132472 | 0.132472 | 0.265706 |
4 | 0.013252 | 0.013240 | 0.066093 | 0.052894 | 0.013153 | 0.013171 | 0.092184 | 0.052596 | 0.036815 | 0.005261 | ... | 0.055238 | 0.007863 | 0.007866 | 0.052005 | 0.391308 | 0.516050 | 0.002593 | 0.130293 | 0.130293 | 0.261335 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
1843 | 0.037919 | 0.037884 | 0.189112 | 0.151344 | 0.037635 | 0.037686 | 0.263764 | 0.150491 | 0.105339 | 0.015054 | ... | 0.158051 | 0.022499 | 0.022507 | 0.148800 | 1.119644 | 1.476569 | 0.007419 | 0.372805 | 0.372806 | 0.747756 |
1844 | 0.036420 | 0.036386 | 0.181635 | 0.145361 | 0.036147 | 0.036196 | 0.253337 | 0.144542 | 0.101175 | 0.014459 | ... | 0.151803 | 0.021609 | 0.021617 | 0.142918 | 1.075381 | 1.418195 | 0.007126 | 0.358067 | 0.358068 | 0.718194 |
1845 | 0.028637 | 0.028611 | 0.142821 | 0.114299 | 0.028423 | 0.028461 | 0.199201 | 0.113654 | 0.079555 | 0.011369 | ... | 0.119364 | 0.016992 | 0.016997 | 0.112377 | 0.845580 | 1.115138 | 0.005603 | 0.281551 | 0.281552 | 0.564722 |
1846 | 0.026237 | 0.026213 | 0.130852 | 0.104719 | 0.026041 | 0.026076 | 0.182506 | 0.104129 | 0.072887 | 0.010416 | ... | 0.109360 | 0.015568 | 0.015573 | 0.102959 | 0.774713 | 1.021679 | 0.005133 | 0.257954 | 0.257955 | 0.517393 |
1847 | 0.025001 | 0.024978 | 0.124684 | 0.099784 | 0.024813 | 0.024847 | 0.173904 | 0.099221 | 0.069452 | 0.009925 | ... | 0.104205 | 0.014834 | 0.014839 | 0.098106 | 0.738199 | 0.973525 | 0.004891 | 0.245796 | 0.245797 | 0.493007 |
1848 rows × 48 columns
puget_rivers_avg = np.sum(data.iloc[:,3:],axis=1)
plt.plot(puget_rivers_avg)
[<matplotlib.lines.Line2D at 0x7f135eb5a1a0>]
puget_rivers_avg.index = data['date']
puget_rivers_avg
puget_rivers_avg.to_csv('puget_rivers_avg.csv',index_label='Date')