Commit 3f7a1fb7 authored by Pablo Iturrieta Rebolledo's avatar Pablo Iturrieta Rebolledo
Browse files

clean pgs code

defined final results figure
modified get_forecast_figures to be adapted to new data structure and new ModelObjectg structure

# Pending: Modify T-test to include t-test significante along with w-test significance
parent 0a011cc4
......@@ -9,7 +9,7 @@ import copy
import scipy.stats
import pickle
import os
from codes import get_catalogs, get_models, filepaths
from codes import get_catalogs, get_models, paths
def process_forecasts_batch(Model_batch, catalog, save_obj=False, load_obj=False):
......@@ -128,23 +128,23 @@ def run(use_saved=False):
test = 'CL'
types = ['']
models = {5: get_models.get_models_5yr(),
10: get_models.get_models_10yr()}
models = {5: get_models.five_years(),
10: get_models.ten_years()}
catalogs = {5: get_catalogs.filter_5yr_08_2009(get_catalogs.taroni2008()),
10: get_catalogs.filter_10yr_01_2010(get_catalogs.bollettino())}
Results = {}
for yr, type in itertools.product(years, types):
result_path = filepaths.get_csep_result_path(test, yr, type)
result_path = paths.get_csep_result_path(test, yr, type)
if use_saved:
Result = process_forecasts_batch(models[yr], catalogs[yr], load_obj=result_path)
else:
Result = process_forecasts_batch(models[yr], catalogs[yr], save_obj=result_path)
Results[yr] = Result
plot_results(Result, years=yr, savepath=filepaths.get_csep_fig_path(test, yr, type))
plot_results(Result, years=yr, savepath=paths.get_csep_fig_path(test, yr, type))
plot_merged_batchs(merge_results_batchs(Results[years[0]], Results[years[1]]),
savepath=filepaths.get_csep_fig_path(test, "%i-%i" % tuple(years), types[0]))
savepath=paths.get_csep_fig_path(test, "%i-%i" % tuple(years), types[0]))
print('Scores 5yr')
get_score(Results[5])
print('Scores 10yr')
......
......@@ -9,7 +9,7 @@ import scipy.stats
import itertools
import pickle
import os
from codes import get_catalogs, get_models, filepaths
from codes import get_catalogs, get_models, paths
......@@ -130,23 +130,23 @@ def run(use_saved=False):
test = 'L'
types = ['']
models = {5: get_models.get_models_5yr(),
10: get_models.get_models_10yr()}
models = {5: get_models.five_years(),
10: get_models.ten_years()}
catalogs = {5: get_catalogs.filter_5yr_08_2009(get_catalogs.taroni2008()),
10: get_catalogs.filter_10yr_01_2010(get_catalogs.bollettino())}
Results = {}
for yr, type in itertools.product(years, types):
result_path = filepaths.get_csep_result_path(test, yr, type)
result_path = paths.get_csep_result_path(test, yr, type)
if use_saved:
Result = process_forecasts_batch(models[yr], catalogs[yr], load_obj=result_path)
else:
Result = process_forecasts_batch(models[yr], catalogs[yr], save_obj=result_path)
Results[yr] = Result
plot_results(Result, years=yr, savepath=filepaths.get_csep_fig_path(test, yr, type))
plot_results(Result, years=yr, savepath=paths.get_csep_fig_path(test, yr, type))
plot_merged_batchs(merge_results_batchs(Results[years[0]], Results[years[1]]),
savepath=filepaths.get_csep_fig_path(test, "%i-%i" % tuple(years), types[0]))
savepath=paths.get_csep_fig_path(test, "%i-%i" % tuple(years), types[0]))
print('Scores 5yr')
get_score(Results[5], catalogs[5])
print('Scores 10yr')
......
......@@ -9,7 +9,7 @@ import itertools
import scipy.stats
import pickle
import os
from codes import get_catalogs, get_models, filepaths
from codes import get_catalogs, get_models, paths
def process_forecasts_batch(Model_batch, catalog, save_obj=False, load_obj=False):
......@@ -117,24 +117,24 @@ def run(use_saved=False):
test = 'M'
types = ['']
models = {5 : get_models.get_models_5yr(),
10 : get_models.get_models_10yr()}
models = {5 : get_models.five_years(),
10 : get_models.ten_years()}
catalogs = {5 : get_catalogs.filter_5yr_08_2009(get_catalogs.taroni2008()),
10 : get_catalogs.filter_10yr_01_2010(get_catalogs.bollettino())}
Results = {}
for yr, type in itertools.product(years, types):
result_path = filepaths.get_csep_result_path(test, yr, type)
result_path = paths.get_csep_result_path(test, yr, type)
if use_saved:
Result = process_forecasts_batch(models[yr],catalogs[yr], load_obj=result_path)
else:
Result = process_forecasts_batch(models[yr],catalogs[yr], save_obj=result_path)
Results[yr] = Result
plot_results(Result, years=yr, savepath=filepaths.get_csep_fig_path(test, yr, type))
plot_results(Result, years=yr, savepath=paths.get_csep_fig_path(test, yr, type))
plot_merged_batchs(merge_results_batchs(Results[years[0]], Results[years[1]]),
savepath=filepaths.get_csep_fig_path(test, "%i-%i" % tuple(years), types[0]))
savepath=paths.get_csep_fig_path(test, "%i-%i" % tuple(years), types[0]))
print('Scores 5yr')
get_score(Results[5])
print('Scores 10yr')
......
......@@ -8,7 +8,7 @@ import itertools
import pickle
import copy
import os
from codes import get_catalogs, get_models, filepaths
from codes import get_catalogs, get_models, paths
import scipy
......@@ -127,8 +127,8 @@ def run(use_saved=False):
types = [''] ## N-test does not have different types
## Get Models and Catalogs as dictionaries
models = {5 : get_models.get_models_5yr(),
10 : get_models.get_models_10yr()}
models = {5 : get_models.five_years(),
10 : get_models.ten_years()}
catalogs = {5 : get_catalogs.filter_5yr_08_2009(get_catalogs.taroni2008()),
10 : get_catalogs.filter_10yr_01_2010(get_catalogs.bollettino())}
......@@ -136,17 +136,17 @@ def run(use_saved=False):
Results = {}
for yr, type in itertools.product(years, types):
## Get the name of the python object where to save results, or to load them
result_path = filepaths.get_csep_result_path(test, yr, type)
result_path = paths.get_csep_result_path(test, yr, type)
if use_saved:
Result = process_forecasts_batch(models[yr],catalogs[yr], load_obj=result_path)
else:
Result = process_forecasts_batch(models[yr],catalogs[yr], save_obj=result_path)
Results[yr] = Result
plot_results(Result, years=yr, savepath=filepaths.get_csep_fig_path(test, yr, type))
plot_results(Result, years=yr, savepath=paths.get_csep_fig_path(test, yr, type))
plot_merged_batchs(merge_results_batchs(Results[years[0]], Results[years[1]]),
savepath=filepaths.get_csep_fig_path(test, "%i-%i" % tuple(years), types[0]))
savepath=paths.get_csep_fig_path(test, "%i-%i" % tuple(years), types[0]))
print('Scores 5yr')
get_score(Results[5])
print('Scores 10yr')
......
......@@ -5,7 +5,7 @@ import pickle
import os
import numpy as np
import scipy.stats
from codes import get_catalogs, get_models, filepaths
from codes import get_catalogs, get_models, paths
import itertools
def pgs(Forecasts, Catalog, ref='avg', bin='spatial_magnitude', save_obj=False, load_obj=False):
......@@ -133,15 +133,15 @@ def run(use_saved=False):
test = 'PGS'
types = ['avg', 11]
models = {5 : get_models.get_models_5yr(),
10 : get_models.get_models_10yr()}
models = {5 : get_models.five_years(),
10 : get_models.ten_years()}
catalogs = {5 : get_catalogs.filter_5yr_08_2009(get_catalogs.taroni2008()),
10 : get_catalogs.filter_10yr_01_2010(get_catalogs.bollettino())}
Results = {}
for yr, typ in itertools.product(years, types):
result_path = filepaths.get_csep_result_path(test, yr, typ)
result_path = paths.get_csep_result_path(test, yr, typ)
if use_saved:
Result = pgs(models[yr], catalogs[yr], ref=typ, load_obj=result_path)
else:
......@@ -150,11 +150,11 @@ def run(use_saved=False):
if typ == int:
typ = models[yr][typ][0].name
plot_pgs(Result, yr, typ, savepath=filepaths.get_csep_fig_path(test, yr, 'ref%s'% typ))
plot_pgs(Result, yr, typ, savepath=paths.get_csep_fig_path(test, yr, 'ref%s' % typ))
for typ in types:
plot_merged_batchs(Results[(10, typ)], Results[(5, typ)], typ,
savepath=filepaths.get_csep_fig_path(test, '%i-%i' % (5, 10), typ))
savepath=paths.get_csep_fig_path(test, '%i-%i' % (5, 10), typ))
if __name__ == '__main__':
run()
......@@ -8,7 +8,7 @@ import copy
import scipy.stats
import pickle
import os
from codes import get_catalogs, get_models, filepaths
from codes import get_catalogs, get_models, paths
import itertools
def process_forecasts_batch(Model_batch, catalog, save_obj=False, load_obj=False):
......@@ -113,23 +113,23 @@ def run(use_saved=False):
test = 'S'
types = ['']
models = {5: get_models.get_models_5yr(),
10: get_models.get_models_10yr()}
models = {5: get_models.five_years(),
10: get_models.ten_years()}
catalogs = {5: get_catalogs.filter_5yr_08_2009(get_catalogs.taroni2008()),
10: get_catalogs.filter_10yr_01_2010(get_catalogs.bollettino())}
Results = {}
for yr, type in itertools.product(years, types):
result_path = filepaths.get_csep_result_path(test, yr, type)
result_path = paths.get_csep_result_path(test, yr, type)
if use_saved:
Result = process_forecasts_batch(models[yr], catalogs[yr], load_obj=result_path)
else:
Result = process_forecasts_batch(models[yr], catalogs[yr], save_obj=result_path)
Results[yr] = Result
plot_results(Result, years=yr, savepath=filepaths.get_csep_fig_path(test, yr, type))
plot_results(Result, years=yr, savepath=paths.get_csep_fig_path(test, yr, type))
plot_merged_batchs(merge_results_batchs(Results[years[0]], Results[years[1]]),
savepath=filepaths.get_csep_fig_path(test, "%i-%i" % tuple(years), types[0]))
savepath=paths.get_csep_fig_path(test, "%i-%i" % tuple(years), types[0]))
print('Scores 5yr')
get_score(Results[5])
print('Scores 10yr')
......
......@@ -7,7 +7,7 @@ from csep.utils import plots
import numpy as np
import pickle
import os
from codes import get_catalogs, get_models, filepaths
from codes import get_catalogs, get_models, paths
import itertools
def process_forecasts_batch(Model_batch, catalog, save_obj=False, load_obj=False):
......@@ -119,20 +119,20 @@ def run(use_saved=False):
types = [True, False] ## Ordered IG matrix
models = {5: get_models.get_models_5yr(),
10: get_models.get_models_10yr()}
models = {5: get_models.five_years(),
10: get_models.ten_years()}
catalogs = {5: get_catalogs.filter_5yr_08_2009(get_catalogs.taroni2008()),
10: get_catalogs.filter_10yr_01_2010(get_catalogs.bollettino())}
Results = {}
for yr in years:
result_path = filepaths.get_csep_result_path(test, yr)
result_path = paths.get_csep_result_path(test, yr)
if use_saved:
Result = process_forecasts_batch(models[yr], catalogs[yr], load_obj=result_path)
else:
Result = process_forecasts_batch(models[yr], catalogs[yr], save_obj=result_path)
Results[yr] = Result
tw_figs_path = os.path.join(filepaths.csep_figs, 'tw_single')
tw_figs_path = os.path.join(paths.csep_figs, 'tw_single')
os.makedirs(tw_figs_path, exist_ok=True)
# for yr in years:
......@@ -141,7 +141,7 @@ def run(use_saved=False):
# folder=tw_figs_path)
for yr, typ in itertools.product(years, types):
plot_all_results(Results[yr], years=yr, order=typ,
savepath=filepaths.get_csep_fig_path(test, yr, type=typ*'order'))
savepath=paths.get_csep_fig_path(test, yr, type=typ * 'order'))
if __name__ =='__main__':
use_saved = True
......
......@@ -3,7 +3,7 @@ import datetime
import csv
import numpy
import warnings
from codes import filepaths
from codes import paths
from csep.utils import time_utils, readers
......@@ -12,10 +12,10 @@ def get_magnitude_bins():
return bins
def horus():
return csep.load_catalog(filepaths.horus, type='ingv_horus')
return csep.load_catalog(paths.horus, type='ingv_horus')
def emrcmt():
return csep.load_catalog(filepaths.emrcmt, type='ingv_emrcmt')
return csep.load_catalog(paths.emrcmt, type='ingv_emrcmt')
def bollettino():
"""
......@@ -49,7 +49,7 @@ def bollettino():
out = []
evcat_id = []
n_event = 0
with open(filepaths.bollettino) as file_:
with open(paths.bollettino) as file_:
reader = csv.reader(file_, delimiter='|')
for n, line in enumerate(reader):
if is_header_line(line):
......@@ -110,7 +110,7 @@ def taroni2008():
'depth': (9, "<f4"),
'Mw': (8, "<f4")}
out = []
data = numpy.genfromtxt(filepaths.taroni2018, skip_header=1,
data = numpy.genfromtxt(paths.taroni2018, skip_header=1,
names=ind.keys(),
usecols=[i[0] for i in ind.values()],
dtype=[i[1] for i in ind.values()])
......
......@@ -2,44 +2,33 @@
import pickle
import os
import cartopy
import filepaths
import paths
import get_models
plot_properties = {'grid_labels': True,
'borders': True,
'feature_lw': 0.5,
'basemap': 'google-satellite',
'basemap': 'stock_img',
'cmap': 'rainbow',
'alpha_exp': 0.8,
'clim' : [-7, -1],
'clim' : [-8, 0],
'projection': cartopy.crs.Mercator()}
forecasts = get_models.get_models_5yr()
figures_dir = filepaths.forecast_figures[5]
# forecasts = get_models.five_years()
# figures_dir = paths.forecast_figures[5]
for model_i in forecasts:
plot_properties['filename'] = os.path.join(figures_dir, model_i.name)
plot_properties['title'] = model_i.name + ' ' + model_i.author
print(plot_properties['title'])
model_i.plot(plot_args=plot_properties)
# for model_i in forecasts:
# plot_properties['filename'] = os.path.join(figures_dir, model_i.name)
# plot_properties['title'] = model_i.name + ' ' + model_i.author
# print(plot_properties['title'])
# model_i.plot(plot_args=plot_properties)
forecasts = get_models.get_models_10yr()
figures_dir = filepaths.forecast_figures[10]
forecasts = get_models.ten_years()
figures_dir = paths.forecast_figures[10]
for model_i in forecasts:
plot_properties['filename'] = os.path.join(figures_dir, model_i.name)
plot_properties['filename'] = os.path.join(figures_dir, 'fig_bins/%s_8-0-15' % model_i.name)
plot_properties['title'] = model_i.name + ' ' + model_i.author
print(plot_properties['title'])
model_i.plot(plot_args=plot_properties)
# forecasts_dir = '../data/ten-year-models-10.01/store/'
# figures_dir = '../data/ten-year-models-10.01/figures/'
# for i in os.listdir(forecasts_dir):
# if i.endswith('obj'):
# with open(os.path.join(forecasts_dir , i), 'rb') as file_:
# plot_properties['filename'] = os.path.join(figures_dir, i.replace('.obj', ''))
# Forecast = pickle.load(file_)
# plot_properties['title'] = Forecast[1]['name'] + ' ' + Forecast[1]['author']
# print(plot_properties['title'])
# Forecast[0].plot(plot_args=plot_properties)
model_i.plot(show=True, levels=9, plot_args=plot_properties)
......@@ -4,7 +4,7 @@ import pickle
import xml.etree.ElementTree as et
import numpy as np
import ntpath
from codes import filepaths
from codes import paths
def forecast_xmlreader(filename_):
......@@ -104,27 +104,27 @@ def process_models():
# Reads the Batch of models an pickle.dump into a file
Batch_5yr_models = []
Batch_10yr_models = []
for model in filepaths.models_5yr:
for model in paths.five_years_src:
Forecast = forecast_xmlreader(model)
Batch_5yr_models.append(Forecast)
with open(filepaths.models_5yr_obj, 'wb') as obj:
with open(paths.models_five_years, 'wb') as obj:
pickle.dump(Batch_5yr_models, obj)
for model in filepaths.models_10yr:
for model in paths.ten_years_src:
Forecast = forecast_xmlreader(model)
Batch_10yr_models.append(Forecast)
with open(filepaths.models_10yr_obj, 'wb') as obj:
with open(paths.models_ten_years, 'wb') as obj:
pickle.dump(Batch_10yr_models, obj)
def get_models_5yr():
def five_years():
# Reads a python object file and returns a list
with open(filepaths.models_5yr_obj, 'rb') as obj:
with open(paths.models_five_years, 'rb') as obj:
Models = pickle.load(obj)
return Models
def get_models_10yr():
def ten_years():
# Reads a python object file and returns a list
with open(filepaths.models_10yr_obj, 'rb') as obj:
with open(paths.models_ten_years, 'rb') as obj:
Models = pickle.load(obj)
return Models
......
from codes import get_catalogs, get_models, filepaths
from codes import get_catalogs, get_models, paths
import pickle
import itertools
import matplotlib.pyplot as plt
......@@ -8,7 +8,7 @@ import matplotlib.patches as patches
from matplotlib.lines import Line2D
def get_results(years):
return {(yr, test) : pickle.load(open(item, 'rb')) for key, item in filepaths.res_path.items()}
return {(yr, test) : pickle.load(open(item, 'rb')) for key, item in paths.res_path.items()}
def norm(array):
return (array - array.min())/(array.max() -array.min())
......@@ -132,7 +132,7 @@ def plot_results(years, labels, ll_type=None, n_eqk = 1,
### Information Gain
T = np.array([[T_i.observed_statistic for T_i in Ref_model] for
Ref_model in filepaths.get_csep_result('T', 5)[0]]).T
Ref_model in paths.get_csep_result('T', 5)[0]]).T
if ref == 'avg':
t_score = np.sum(T, axis=1) / T.shape[0]
else:
......@@ -142,13 +142,13 @@ def plot_results(years, labels, ll_type=None, n_eqk = 1,
### Parimutuel Gambling score
PGS = filepaths.get_csep_result('PGS', years, ref)
PGS = paths.get_csep_result('PGS', years, ref)
pgs =np.array([i.test_distribution[0] for i in PGS]) ## << PGS in all bins
if lowcuts[0]:
pgs[pgs < lowcuts[0]] = lowcuts[0] # << For visualization purposes
## Conditional Likelihood
LL = filepaths.get_csep_result(l_cl, years)
LL = paths.get_csep_result(l_cl, years)
if ll_type == 'quantile':
ll_score = np.array([i.quantile for i in LL])
ll_label = r'$\delta_{%s}$' % l_cl
......@@ -162,9 +162,9 @@ def plot_results(years, labels, ll_type=None, n_eqk = 1,
## Consistency tests
Consistency_Results = []
for n, m, s in zip(filepaths.get_csep_result('N', years),
filepaths.get_csep_result('M', years),
filepaths.get_csep_result('S', years)):
for n, m, s in zip(paths.get_csep_result('N', years),
paths.get_csep_result('M', years),
paths.get_csep_result('S', years)):
model_cons = []
if n.quantile[0] > p/2. and n.quantile[1] < 1-p/2.:
model_cons.append('N')
......@@ -224,17 +224,17 @@ if __name__ == '__main__':
labels = ['Information Gain (t-test)', 'Net Return (PGS)',
'$\log(L_N)$ quantile', 'Poisson Consistency $(p=%.2f)$' % p]
plot_results(5, l_cl='CL', ll_type='quantile', labels=labels, ref='avg', lowcuts=[False, 0.1, False],
savepath=filepaths.get_csep_fig_path('Total', 5, 'avg_CLq'))
savepath=paths.get_csep_fig_path('Total', 5, 'avg_CLq'))
plot_results(10,l_cl='CL', ll_type='quantile', labels=labels, ref='avg', lowcuts=[False, 0.1, False],
savepath=filepaths.get_csep_fig_path('Total', 10, 'avg_CLq'))
plot_results(10, l_cl='CL', ll_type='quantile', labels=labels, ref='avg', lowcuts=[False, 0.1, False],
savepath=paths.get_csep_fig_path('Total', 10, 'avg_CLq'))
labels = ['Information Gain (t-test)', 'Net Return (PGS)',
'$\log(L_N)$ - $\log(L_N)_{ref}$', 'Poisson Consistency $(p=%.2f)$' % p]
plot_results(5, ref=11, l_cl='CL', labels=labels, lowcuts=[False, -1, -15],
savepath=filepaths.get_csep_fig_path('Total', 5, 'ref11_CL'))
savepath=paths.get_csep_fig_path('Total', 5, 'ref11_CL'))
plot_results(10, ref=11, l_cl='CL', labels=labels, lowcuts=[False, -2, -20],
savepath=filepaths.get_csep_fig_path('Total', 10, 'ref11_CL'))
savepath=paths.get_csep_fig_path('Total', 10, 'ref11_CL'))
......@@ -242,16 +242,16 @@ if __name__ == '__main__':
labels = ['Information Gain (t-test)', 'Net Return (PGS)',
'$\log(L)$ quantile', 'Poisson Consistency $(p=%.2f)$' % p]
plot_results(5, l_cl='L', ll_type='quantile', labels=labels, ref='avg', lowcuts=[False, 0.1, False],
savepath=filepaths.get_csep_fig_path('Total', 5, 'avg_Lq'))
plot_results(10,l_cl='L', ll_type='quantile', labels=labels, ref='avg', lowcuts=[False, -1, False],
savepath=filepaths.get_csep_fig_path('Total', 10, 'avg_Lq'))
savepath=paths.get_csep_fig_path('Total', 5, 'avg_Lq'))
plot_results(10, l_cl='L', ll_type='quantile', labels=labels, ref='avg', lowcuts=[False, -1, False],
savepath=paths.get_csep_fig_path('Total', 10, 'avg_Lq'))
labels = ['Information Gain (t-test)', 'Net Return (PGS)',
'$\log(L)$ - $\log(L)_{ref}$', 'Poisson Consistency $(p=%.2f)$' % p]
plot_results(5, ref=11, l_cl='L', labels=labels, lowcuts=[False, -1, -15],
savepath=filepaths.get_csep_fig_path('Total', 5, 'ref11_L'))
savepath=paths.get_csep_fig_path('Total', 5, 'ref11_L'))
plot_results(10, ref=11, l_cl='L', labels=labels, lowcuts=[False, -1, -15],
savepath=filepaths.get_csep_fig_path('Total', 10, 'ref11_L'))
savepath=paths.get_csep_fig_path('Total', 10, 'ref11_L'))
......@@ -3,6 +3,9 @@ import os
import itertools
import pickle
# Data years
years = [5, 10]
# Get absolute paths of Package
codes = os.path.dirname(os.path.realpath(__file__))
main = os.path.dirname(codes)
......@@ -19,17 +22,17 @@ taroni2018 = os.path.join(catalogs, 'taroni2018.txt')
# 5 year models
dir_models_5yr = os.path.join(data, 'five-year-models-10.01/source/forecasts/')
models_5yr = [os.path.join(dir_models_5yr,i) for i in
five_years_src = [os.path.join(dir_models_5yr, i) for i in
sorted(os.listdir(dir_models_5yr)) if i.endswith('xml')]
# 10 year models
dir_models_10yr = os.path.join(data, 'ten-year-models-10.01/source/forecasts/')
models_10yr = [os.path.join(dir_models_10yr,i) for i in
ten_years_src = [os.path.join(dir_models_10yr, i) for i in
sorted(os.listdir(dir_models_10yr)) if i.endswith('xml')]
# Processed models
models_5yr_obj = os.path.join(data, 'five-year-models-10.01/models_5yr.obj')
models_10yr_obj = os.path.join(data, 'ten-year-models-10.01/models_10yr.obj')
models_five_years = os.path.join(data, 'five-year-models-10.01/models_5yr.obj')
models_ten_years = os.path.join(data, 'ten-year-models-10.01/models_10yr.obj')
# Results folder
results = os.path.join(main, 'results')
......@@ -48,16 +51,33 @@ results = os.path.join(main, 'results')
store = os.path.join(results, 'stored_results')
stored_csep = os.path.join(store, 'csep_tests')
years = [5, 10]
store_years = {i: os.path.join(stored_csep, '%iyr') % i for i in years }
store_years = {i: os.path.join(stored_csep, '%iyr') % i for i in years}
tests = ['N', 'M', 'S', 'L', 'CL', 'T', 'PGS']
for i, j in store_years.items():
os.makedirs(j, exist_ok=True)
# Figures
figs = os.path.join(results, 'figures')
## Forecast figures
forecast_figures = {5: os.path.join(data, 'five-year-models-10.01/figures'),
10: os.path.join(data, 'ten-year-models-10.01/figures')}
for dir_ in forecast_figures.values():
os.makedirs(dir_, exist_ok=True)
## CSEP figures
csep_figs = os.path.join(figs, 'csep')
os.makedirs(csep_figs, exist_ok=True)
# Create dirs
# os.makedirs(stored_csep, exist_ok=True)
# os.makedirs(csep_figs, exist_ok=True)
def get_csep_result_path(test, year, type=False):
"""
Get the file path of a result
Get the file path of a result object
:param test: Name of the test
:param year: Year duration of the test
:param type: Particular type of test
......@@ -70,29 +90,25 @@ def get_csep_result_path(test, year, type=False):
return