-
Notifications
You must be signed in to change notification settings - Fork 0
/
bogus_sno.py
56 lines (42 loc) · 1.37 KB
/
bogus_sno.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
#import sys
df = pd.read_csv('bogus_sno.txt', sep=",",header=56, names=["date", 'depth [cm]','SWE [mm]'])
# index_col='date'
sns.set_style('darkgrid')
sns.set_style("ticks")
sns.set_context('talk') #[notebook, paper, talk, poster]
fig, a=plt.subplots(2,1)
a[0].plot(pd.to_datetime(df["date"]),df['depth [cm]'])
a[0].set_ylabel('Snow Depth [cm]')
a[0].set_title('Bogus Basin Snow Depth')
# plt.legend()
a[0].grid(True)
a[1].plot(pd.to_datetime(df["date"]), df['SWE [mm]'].div(10),color="red")
# a[1].plot(pd.to_datetime(df["date"]),np.divide(df['SWE [mm]',10]),color="red")
a[1].set_xlabel('Year')
a[1].set_ylabel('SWE [cm]') #CONVERTED (for 7th grade comparison)
#examples
#a.set_ylim()
a[1].set_title('Bogus Basin Snow Water Equivalent (SWE)')
a[1].grid(True)
plt.subplots_adjust(hspace=0.5)
plt.show()
plt.savefig('plot_depth_swe')
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#works - one plot
# sns.set_style('darkgrid')
# sns.set_style("ticks")
# sns.set_context('notebook') #[notebook, paper, talk, poster]
#
#
# f=plt.figure()
# a=plt.gca()
# a.plot(pd.to_datetime(df["date"]),df['SWE [mm]'])
# a.plot(pd.to_datetime(df["date"]),df['depth [cm]'])
# plt.xlabel('Year')
# plt.ylabel('Snow Depth [cm]')
# plt.title('Bogus Basin Snow Depth')
# plt.legend()