-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave_leadyear.py
37 lines (29 loc) · 962 Bytes
/
save_leadyear.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
#Loading and using all required classes to calculate leadyear timeseries
from calendar import month
import config as cfg
from preprocessing import concat
from leadyear import calculate_leadyear
import os
import tempfile
tempfile.tempdir ='/mnt/lustre02/work/uo1075/u301617/tmp'
cfg.set_args()
correlation_path = cfg.tmp_path + 'correlation/'
tmp_path = cfg.tmp_path + 'tmp/'
if not os.path.exists(cfg.plot_path):
os.makedirs(cfg.plot_path)
if not os.path.exists(cfg.tmp_path):
os.makedirs(cfg.tmp_path)
if not os.path.exists(correlation_path):
os.makedirs(correlation_path)
if not os.path.exists(tmp_path):
os.makedirs(tmp_path)
if not os.path.exists(cfg.residual_path):
os.makedirs(cfg.residual_path)
#save lead correlation for cfg.lead_year
if cfg.lead_years:
lead_year = cfg.lead_years
else:
lead_year = cfg.lead_year
ly = calculate_leadyear(cfg.start_year, cfg.end_year, lead_year=lead_year)
ly.plot()
ly.save_lead_corr()