Commit 531f7ed5 authored by Clément Haëck's avatar Clément Haëck
Browse files

Remove zones in total probability computation

parent 22d1c218
......@@ -18,8 +18,7 @@ import lib.data.front_probability
def main():
def add_args(parser):
parser.add_argument('-threshold_N', type=float, default=15.)
parser.add_argument('-threshold_S', type=float, default=6.)
parser.add_argument('-threshold', type=float, default=5.)
args = lib.get_args(['region', 'days', 'fixes',
'scale', 'number', 'coef'],
......@@ -27,25 +26,18 @@ def main():
sst = lib.data.ostia.get_data(args)
hi = lib.data.hi.get_data(args)
sep = lib.data.SN_separation.get_data(args)
sep = lib.data.SN_separation.smooth(sep, time_step=8)
ds = xr.merge([lib.fix_time_daily(d) for d in [sst, hi]],
join='inner')
sst, hi, sep = xr.align(
sst, hi, sep,
exclude=['lat', 'lon'], join='inner')
ds['HI'] = lib.data.hi.apply_coef(hi, lib.data.hi.get_coef(args))
frt = (ds.HI > args['threshold']) * 1.
frt = frt.where(np.isfinite(ds.sst))
HI = lib.data.hi.apply_coef(hi, lib.data.hi.get_coef(args))
zone_S = sst.sst > sep
frt = (HI.where(zone_S) > args['threshold_S'])
frt = frt.where(zone_S, HI > args['threshold_N'])
frt = frt.where(np.isfinite(sst.sst))
tot = (frt * 1.).mean('time')
tot = frt.mean('time')
var_name = 'p_frt'
tot = tot.to_dataset(name=var_name)
args['period'] = 'total'
outdir = lib.data.front_probability.get_root(args)
lib.check_output_dir(outdir)
......
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