Commit 1c6f2eb7 authored by Clément Haëck's avatar Clément Haëck
Browse files

Up plot

parent 43945655
......@@ -9,21 +9,29 @@ import lib
import lib.data.hists as lh
args = dict(region='GS', days=1)
def add_args(parser):
parser.add_argument('-thr_lo', type=float, default=5.)
parser.add_argument('-thr_hi', type=float, default=10.)
args = lib.get_args(['region', 'days', 'fixes'], add_args)
args['fixes']['thr_lo'] = args['thr_lo']
args['fixes']['thr_hi'] = args['thr_hi']
fixes = dict(
scale=30.,
number=2,
coef=0,
zone=r'GS3_.',
Y=2007,
thr_lo=6.,
thr_hi=11.
thr_hi=10.
)
fixes.update(args['fixes'])
args['fixes'] = fixes
def get_data(var):
fixes['var'] = var
ds = lh.get_data(args, fixes=fixes)
args['fixes']['var'] = var
ds = lh.get_data(args)
ds = ds.squeeze(['scale', 'number', 'coef', 'thr_lo', 'thr_hi'])
ds = lh.resample_8D_multiple_years(ds)
......@@ -36,6 +44,10 @@ def get_data(var):
ds['med'] = ds.med.where(ds.N.sel(mask='mid') > 10)
ds = ds.drop_vars(['hist', 'N', 'pdf'])
ds = ds.groupby("time.dayofyear").mean()
ds = lh.restore_time(ds)
return ds
......@@ -94,7 +106,7 @@ axes[0, 0].set_title('SOUTH')
axes[0, 1].set_title('JET')
axes[0, 2].set_title('NORTH')
fig.suptitle("Thresholds: {:.2f} - {:.2f}".format(*[fixes['thr_'+h]
fig.suptitle("Thresholds: {:.2f} - {:.2f}".format(*[args['fixes']['thr_'+h]
for h in ['lo', 'hi']]))
labels = ['Low', 'Mid', 'Hi']
......@@ -107,5 +119,6 @@ fig.legend(handles, labels, bbox_to_anchor=[0., 1.], loc='upper left',
fig.canvas.draw()
fig.savefig(path.join(lib.root_plot, 'Hists', 'median_GS3_2thr',
'fig_thr_{:.2f}_{:.2f}.png'
.format(*[fixes['thr_'+h] for h in ['lo', 'hi']])),
.format(*[args['fixes']['thr_'+h]
for h in ['lo', 'hi']])),
dpi=150)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment