forked from AZMP-NL/python-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
S27.py
50 lines (36 loc) · 1.19 KB
/
S27.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
'''
To explore relationship between Stn 27 stratification and AOO, etc.
Frederic.Cyr@dfo-mpo.gc.ca - March 2018
'''
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import datetime
import matplotlib.dates as mdates
# Adjust fontsize/weight
font = {'family' : 'normal',
'weight' : 'bold',
'size' : 18}
plt.rc('font', **font)
### ---- S27 data ---- ###
# Load data
S27_file = '/home/cyrf0006/research/AZMP_stateReports/ColbourneStuff/S27_Integrated.dat'
AO_file = '/home/cyrf0006/research/AZMP_stateReports/ColbourneStuff/ARCTIC_OSCILLATION.xlsx'
# Read S27 and drop line 2 of file
df = pd.read_csv(S27_file, delimiter=r"\s+", header=0)
df = df.drop(df.index[0])
# Set index
df = df.set_index('Year')
df.index = pd.to_datetime(df.index, format='%Y')
df_27 = df
### ---- AO data ---- ###
df = pd.read_excel(AO_file, header=5)
df = df.set_index(df.columns[0])
df.index = df.index.set_names('Year')
df = df.drop(df.index[-3:,])
df.index = np.int64(df.index)
df.index = pd.to_datetime(df.index, format='%Y')
### ---- plot compa ---- ###
plt.plot(df['DEC-FEB'])
plt.plot(df_27.index, np.float64(df_27['Strat'])-np.float64(df_27['Strat']['1981':'2010']).mean())
plt.show()