Commit 4d3269bc authored by Clément Haëck's avatar Clément Haëck
Browse files

Rename jet_zones to SN_separation

parent 6f259004
...@@ -26,7 +26,7 @@ mod = importlib.import_module('lib.data.' + args['data']) ...@@ -26,7 +26,7 @@ mod = importlib.import_module('lib.data.' + args['data'])
ds = mod.get_data(args) ds = mod.get_data(args)
if args['data'] == 'jet_zones': if args['data'] == 'SN_separation':
ds = mod.smooth(ds, 8).to_dataset() ds = mod.smooth(ds, 8).to_dataset()
grp = ds.groupby("time.dayofyear") grp = ds.groupby("time.dayofyear")
......
...@@ -5,7 +5,7 @@ import xarray as xr ...@@ -5,7 +5,7 @@ import xarray as xr
import lib import lib
import lib.data.clouds import lib.data.clouds
import lib.data.jet_zones import lib.data.SN_separation
import lib.data.ostia import lib.data.ostia
import lib.data.globcolour import lib.data.globcolour
import lib.zones import lib.zones
...@@ -19,9 +19,9 @@ def main(): ...@@ -19,9 +19,9 @@ def main():
zone = lib.zones.get_data(args, grid=grid)['total'] zone = lib.zones.get_data(args, grid=grid)['total']
land = lib.zones.get_land(args, grid=grid)['land_large'] land = lib.zones.get_land(args, grid=grid)['land_large']
thr = lib.data.jet_zones.get_data(args) thr = lib.data.SN_separation.get_data(args)
thr = lib.fix_time_daily(thr) thr = lib.fix_time_daily(thr)
threshold = lib.data.jet_zones.smooth(thr) threshold = lib.data.SN_separation.smooth(thr)
st = lib.data.ostia.get_data(args) st = lib.data.ostia.get_data(args)
gc = lib.data.globcolour.get_data(args) gc = lib.data.globcolour.get_data(args)
......
...@@ -14,7 +14,7 @@ from scipy.optimize import curve_fit ...@@ -14,7 +14,7 @@ from scipy.optimize import curve_fit
import xarray as xr import xarray as xr
import lib import lib
import lib.data.jet_zones import lib.data.SN_separation
import lib.data.ostia import lib.data.ostia
import lib.zones import lib.zones
...@@ -36,7 +36,7 @@ def main(): ...@@ -36,7 +36,7 @@ def main():
output_dtypes=[float]) output_dtypes=[float])
sep.name = 'threshold' sep.name = 'threshold'
ofile = lib.data.jet_zones.get_filename(args['fixes']) ofile = lib.data.SN_separation.get_filename(args['fixes'])
lib.check_output_dir(ofile, file=True) lib.check_output_dir(ofile, file=True)
sep.to_dataset().to_netcdf(ofile) sep.to_dataset().to_netcdf(ofile)
......
...@@ -6,7 +6,7 @@ import xarray as xr ...@@ -6,7 +6,7 @@ import xarray as xr
import lib import lib
import lib.data.globcolour import lib.data.globcolour
import lib.data.hi import lib.data.hi
import lib.data.jet_zones import lib.data.SN_separation
import lib.data.ostia import lib.data.ostia
import lib.data.tseries import lib.data.tseries
import lib.zones import lib.zones
...@@ -32,8 +32,8 @@ def mean_gyre(da, args, variable): ...@@ -32,8 +32,8 @@ def mean_gyre(da, args, variable):
def mean_GS(da, da_mask, args, variable): def mean_GS(da, da_mask, args, variable):
threshold = lib.data.jet_zones.get_data(args) threshold = lib.data.SN_separation.get_data(args)
threshold = lib.data.jet_zones.smooth(threshold) threshold = lib.data.SN_separation.smooth(threshold)
threshold = lib.fix_time_daily(threshold) threshold = lib.fix_time_daily(threshold)
threshold, _ = xr.align(threshold, da_mask.time, join='right') threshold, _ = xr.align(threshold, da_mask.time, join='right')
......
...@@ -10,7 +10,7 @@ import pandas as pd ...@@ -10,7 +10,7 @@ import pandas as pd
import lib import lib
import lib.data.front_probability import lib.data.front_probability
import lib.data.hi import lib.data.hi
import lib.data.jet_zones import lib.data.SN_separation
import lib.data.ostia import lib.data.ostia
from lib.xarray_utils import save_chunks_by_date from lib.xarray_utils import save_chunks_by_date
...@@ -31,7 +31,7 @@ def main(): ...@@ -31,7 +31,7 @@ def main():
ds = lib.data.hi.get_data(args) ds = lib.data.hi.get_data(args)
sst = lib.data.ostia.get_data(args) sst = lib.data.ostia.get_data(args)
thr = lib.data.jet_zones.get_data(args)['threshold'] thr = lib.data.SN_separation.get_data(args)['threshold']
hi = lib.data.hi.apply_coef(ds, lib.data.hi.get_coef(args)) hi = lib.data.hi.apply_coef(ds, lib.data.hi.get_coef(args))
hi = hi.where(sst.analysed_sst < thr) hi = hi.where(sst.analysed_sst < thr)
......
...@@ -9,7 +9,7 @@ from scipy.optimize import curve_fit ...@@ -9,7 +9,7 @@ from scipy.optimize import curve_fit
import xarray as xr import xarray as xr
import lib import lib
import lib.data.jet_zones import lib.data.SN_separation
import lib.data.ostia import lib.data.ostia
import lib.zones import lib.zones
...@@ -21,7 +21,7 @@ def main(): ...@@ -21,7 +21,7 @@ def main():
sst = lib.data.ostia.get_data(args) sst = lib.data.ostia.get_data(args)
ofile = lib.data.jet_zones.get_filename(args['fixes']) ofile = lib.data.SN_separation.get_filename(args['fixes'])
sst['zone'] = lib.zones.get_data(args, grid=lib.data.ostia.grid)['total'] sst['zone'] = lib.zones.get_data(args, grid=lib.data.ostia.grid)['total']
sst = sst.sel(lat=slice(32, None)) sst = sst.sel(lat=slice(32, None))
......
...@@ -6,7 +6,7 @@ import numpy as np ...@@ -6,7 +6,7 @@ import numpy as np
import xarray as xr import xarray as xr
import lib import lib
import lib.data.jet_zones import lib.data.SN_separation
import lib.data.ostia import lib.data.ostia
import lib.zones import lib.zones
...@@ -17,7 +17,7 @@ def main(): ...@@ -17,7 +17,7 @@ def main():
args['fixes']['Y'] = args['year'] args['fixes']['Y'] = args['year']
sst = lib.data.ostia.get_data(args) sst = lib.data.ostia.get_data(args)
ofile = lib.data.jet_zones.get_filename(args['fixes']) ofile = lib.data.SN_separation.get_filename(args['fixes'])
zone_obj = lib.zones.zones['GS'] zone_obj = lib.zones.zones['GS']
sst['zone'] = lib.zones.get_data(args, grid=lib.data.ostia.grid)['GS'] sst['zone'] = lib.zones.get_data(args, grid=lib.data.ostia.grid)['GS']
......
...@@ -11,7 +11,7 @@ import lib ...@@ -11,7 +11,7 @@ import lib
import lib.data.hi import lib.data.hi
import lib.data.hists import lib.data.hists
import lib.data.images import lib.data.images
import lib.data.jet_zones import lib.data.SN_separation
import lib.data.modis import lib.data.modis
import lib.zones import lib.zones
...@@ -44,9 +44,9 @@ def main(): ...@@ -44,9 +44,9 @@ def main():
land = lib.zones.get_land(args, grid=lib.data.modis.grid)['land_large'].persist() land = lib.zones.get_land(args, grid=lib.data.modis.grid)['land_large'].persist()
# Get threshold # Get threshold
thr = lib.data.jet_zones.get_data(args) thr = lib.data.SN_separation.get_data(args)
thr = lib.fix_time_daily(thr) thr = lib.fix_time_daily(thr)
threshold = lib.data.jet_zones.smooth(thr, 8) threshold = lib.data.SN_separation.smooth(thr, 8)
coef = lib.data.hi.get_coef(args) coef = lib.data.hi.get_coef(args)
......
...@@ -9,7 +9,7 @@ import lib.data.hists ...@@ -9,7 +9,7 @@ import lib.data.hists
import lib.data.hi import lib.data.hi
import lib.data.globcolour import lib.data.globcolour
import lib.data.ostia import lib.data.ostia
import lib.data.jet_zones import lib.data.SN_separation
import lib.zones import lib.zones
VAR_RANGE = { VAR_RANGE = {
...@@ -37,8 +37,8 @@ def main(): ...@@ -37,8 +37,8 @@ def main():
print('Load SST', flush=True) print('Load SST', flush=True)
st = lib.data.ostia.get_data(args) st = lib.data.ostia.get_data(args)
print('Load Threshold', flush=True) print('Load Threshold', flush=True)
thr = lib.data.jet_zones.get_data(args) thr = lib.data.SN_separation.get_data(args)
threshold = lib.data.jet_zones.smooth(thr, 8) threshold = lib.data.SN_separation.smooth(thr, 8)
print('Load Zones', flush=True) print('Load Zones', flush=True)
# Retrieve zones, one for each grid # Retrieve zones, one for each grid
zone_hi = get_zone(lib.data.ostia.grid, args) zone_hi = get_zone(lib.data.ostia.grid, args)
......
...@@ -14,7 +14,7 @@ import lib.data.hists ...@@ -14,7 +14,7 @@ import lib.data.hists
import lib.data.hi import lib.data.hi
import lib.data.globcolour import lib.data.globcolour
import lib.data.ostia import lib.data.ostia
import lib.data.jet_zones import lib.data.SN_separation
import lib.data.pft import lib.data.pft
import lib.zones import lib.zones
...@@ -52,9 +52,9 @@ def main(): ...@@ -52,9 +52,9 @@ def main():
pft = lib.data.pft.get_data(args, days=8, concentration=True) pft = lib.data.pft.get_data(args, days=8, concentration=True)
pft = lib.fix_time_daily(pft) pft = lib.fix_time_daily(pft)
print('Load Threshold', flush=True) print('Load Threshold', flush=True)
thr = lib.data.jet_zones.get_data(args) thr = lib.data.SN_separation.get_data(args)
thr = lib.fix_time_daily(thr) thr = lib.fix_time_daily(thr)
threshold = lib.data.jet_zones.smooth(thr, 8) threshold = lib.data.SN_separation.smooth(thr, 8)
print('Load Zones', flush=True) print('Load Zones', flush=True)
zone_gc = get_zone(lib.data.globcolour.grid, args) zone_gc = get_zone(lib.data.globcolour.grid, args)
......
...@@ -35,7 +35,7 @@ def get_data(module): ...@@ -35,7 +35,7 @@ def get_data(module):
return cli, cli_std return cli, cli_std
thr, thr_std = get_data('jet_zones') thr, thr_std = get_data('SN_separation')
clouds, clouds_std = get_data('clouds') clouds, clouds_std = get_data('clouds')
ts, ts_std = get_data('tseries') ts, ts_std = get_data('tseries')
......
...@@ -13,7 +13,7 @@ import xarray as xr ...@@ -13,7 +13,7 @@ import xarray as xr
import lib import lib
import lib.data.ostia import lib.data.ostia
import lib.data.globcolour import lib.data.globcolour
import lib.data.jet_zones import lib.data.SN_separation
import Plots.util as plot_util import Plots.util as plot_util
from Plots.Images.examples import examples from Plots.Images.examples import examples
from Compute.gs_zones_gauss import _get_separation from Compute.gs_zones_gauss import _get_separation
...@@ -35,7 +35,7 @@ fixes = dict( ...@@ -35,7 +35,7 @@ fixes = dict(
st = lib.data.ostia.get_data(args, fixes=fixes) st = lib.data.ostia.get_data(args, fixes=fixes)
gc = lib.data.globcolour.get_data(args, fixes=fixes) gc = lib.data.globcolour.get_data(args, fixes=fixes)
thr = lib.data.jet_zones.get_data(args, fixes=fixes) thr = lib.data.SN_separation.get_data(args, fixes=fixes)
sst = st.analysed_sst.isel(time=0) sst = st.analysed_sst.isel(time=0)
chl = gc.CHL.isel(time=0) chl = gc.CHL.isel(time=0)
......
...@@ -12,7 +12,7 @@ import lib ...@@ -12,7 +12,7 @@ import lib
import lib.data.globcolour import lib.data.globcolour
import lib.data.ostia import lib.data.ostia
import lib.data.hi import lib.data.hi
import lib.data.jet_zones import lib.data.SN_separation
import Plots.util as plot_util import Plots.util as plot_util
...@@ -37,8 +37,8 @@ hi['HI'] = lib.data.hi.apply_coef(hi, lib.data.hi.get_coef(args)) ...@@ -37,8 +37,8 @@ hi['HI'] = lib.data.hi.apply_coef(hi, lib.data.hi.get_coef(args))
chl = gc.CHL[0] chl = gc.CHL[0]
sst = st.analysed_sst[0] sst = st.analysed_sst[0]
thr = lib.data.jet_zones.get_data(fixes=fixes) thr = lib.data.SN_separation.get_data(fixes=fixes)
thr = lib.data.jet_zones.smooth(thr) thr = lib.data.SN_separation.smooth(thr)
thr = lib.fix_time_daily(thr) thr = lib.fix_time_daily(thr)
threshold = thr.sel(time=datetime(fixes['Y'], fixes['m'], fixes['d'])).values threshold = thr.sel(time=datetime(fixes['Y'], fixes['m'], fixes['d'])).values
......
...@@ -8,7 +8,7 @@ import xarray as xr ...@@ -8,7 +8,7 @@ import xarray as xr
import lib import lib
import lib.data.globcolour import lib.data.globcolour
import lib.data.jet_zones import lib.data.SN_separation
import lib.data.ostia import lib.data.ostia
plt.switch_backend('agg') plt.switch_backend('agg')
...@@ -18,7 +18,7 @@ args['fixes']['Y'] = args['year'] ...@@ -18,7 +18,7 @@ args['fixes']['Y'] = args['year']
gc = lib.data.globcolour.get_data(args) gc = lib.data.globcolour.get_data(args)
st = lib.data.ostia.get_data(args) st = lib.data.ostia.get_data(args)
thr = lib.data.jet_zones.get_data(args) thr = lib.data.SN_separation.get_data(args)
gc = lib.fix_time_daily(gc) gc = lib.fix_time_daily(gc)
st = lib.fix_time_daily(st) st = lib.fix_time_daily(st)
...@@ -26,7 +26,7 @@ thr = lib.fix_time_daily(thr) ...@@ -26,7 +26,7 @@ thr = lib.fix_time_daily(thr)
gc, st, thr = xr.align(gc, st, thr, join="inner", exclude=['lat', 'lon']) gc, st, thr = xr.align(gc, st, thr, join="inner", exclude=['lat', 'lon'])
thr['threshold'] = lib.data.jet_zones.smooth(thr) thr['threshold'] = lib.data.SN_separation.smooth(thr)
# gc = gc.chunk(dict(time=6)) # gc = gc.chunk(dict(time=6))
# st = st.chunk(dict(time=6)) # st = st.chunk(dict(time=6))
......
...@@ -9,7 +9,7 @@ import xarray as xr ...@@ -9,7 +9,7 @@ import xarray as xr
import lib import lib
import lib.data.globcolour import lib.data.globcolour
import lib.data.hi import lib.data.hi
import lib.data.jet_zones import lib.data.SN_separation
import lib.data.ostia import lib.data.ostia
plt.switch_backend('agg') plt.switch_backend('agg')
...@@ -21,7 +21,7 @@ args['fixes']['Y'] = args['year'] ...@@ -21,7 +21,7 @@ args['fixes']['Y'] = args['year']
gc = lib.data.globcolour.get_data(args) gc = lib.data.globcolour.get_data(args)
st = lib.data.ostia.get_data(args) st = lib.data.ostia.get_data(args)
hi = lib.data.hi.get_data(args) hi = lib.data.hi.get_data(args)
thr = lib.data.jet_zones.get_data(args) thr = lib.data.SN_separation.get_data(args)
gc = lib.fix_time_daily(gc) gc = lib.fix_time_daily(gc)
st = lib.fix_time_daily(st) st = lib.fix_time_daily(st)
...@@ -32,7 +32,7 @@ gc, st, hi, thr = xr.align(gc, st, hi, thr, join="inner", ...@@ -32,7 +32,7 @@ gc, st, hi, thr = xr.align(gc, st, hi, thr, join="inner",
exclude=['lat', 'lon']) exclude=['lat', 'lon'])
thr['threshold'] = lib.data.jet_zones.smooth(thr) thr['threshold'] = lib.data.SN_separation.smooth(thr)
# gc = gc.chunk(dict(time=6)) # gc = gc.chunk(dict(time=6))
# st = st.chunk(dict(time=6)) # st = st.chunk(dict(time=6))
......
...@@ -9,7 +9,7 @@ import lib ...@@ -9,7 +9,7 @@ import lib
import lib.data.ostia import lib.data.ostia
import lib.data.hi import lib.data.hi
import lib.data.globcolour import lib.data.globcolour
import lib.data.jet_zones import lib.data.SN_separation
fixes = dict( fixes = dict(
...@@ -34,7 +34,7 @@ st = st.sel(lat=slice(lat_min, None)) ...@@ -34,7 +34,7 @@ st = st.sel(lat=slice(lat_min, None))
gc = gc.sel(lat=slice(None, lat_min)) gc = gc.sel(lat=slice(None, lat_min))
hi = hi.sel(lat=slice(None, lat_min)) hi = hi.sel(lat=slice(None, lat_min))
th = lib.data.jet_zones.get_data(fixes=fixes) th = lib.data.SN_separation.get_data(fixes=fixes)
th = lib.fix_time_daily(th) th = lib.fix_time_daily(th)
th = th.sel(time=datetime(fixes['Y'], fixes['m'], fixes['d'])) th = th.sel(time=datetime(fixes['Y'], fixes['m'], fixes['d']))
st['mask'] = st.analysed_sst > th.threshold.values st['mask'] = st.analysed_sst > th.threshold.values
......
...@@ -5,7 +5,7 @@ import matplotlib.pyplot as plt ...@@ -5,7 +5,7 @@ import matplotlib.pyplot as plt
import lib import lib
import lib.data.ostia import lib.data.ostia
import lib.data.jet_zones import lib.data.SN_separation
plt.switch_backend('agg') plt.switch_backend('agg')
...@@ -14,11 +14,11 @@ fixes = dict( ...@@ -14,11 +14,11 @@ fixes = dict(
Y=2007 Y=2007
) )
odir = path.join(lib.root_plot, 'jet_zones') odir = path.join(lib.root_plot, 'SN_separation')
st = lib.data.ostia.get_data(fixes=fixes) st = lib.data.ostia.get_data(fixes=fixes)
thr = lib.data.jet_zones.get_data(fixes=fixes) thr = lib.data.SN_separation.get_data(fixes=fixes)
st['thr'] = lib.data.jet_zones.smooth(thr, 8) st['thr'] = lib.data.SN_separation.smooth(thr, 8)
st = st.isel(time=slice(None, None, 10)) st = st.isel(time=slice(None, None, 10))
st = st.sel(lat=slice(30, None)) st = st.sel(lat=slice(30, None))
st['GS_N'] = st.analysed_sst > st.thr st['GS_N'] = st.analysed_sst > st.thr
......
...@@ -5,13 +5,13 @@ import lib ...@@ -5,13 +5,13 @@ import lib
import lib.data import lib.data
ARGS_DIR = {'region', 'days'} ARGS_DIR = {'region', 'days'}
pregex = 'jet_zones_%(Y).nc' pregex = 'SN_separation_%(Y).nc'
grid = '4km_EPSG4326' grid = '4km_EPSG4326'
def get_root(args=None, **kwargs): def get_root(args=None, **kwargs):
args = lib.data.process_args(ARGS_DIR, args, **kwargs) args = lib.data.process_args(ARGS_DIR, args, **kwargs)
root = path.join(lib.root_data, args['region'], 'Jet_zones', root = path.join(lib.root_data, args['region'], 'SN_separation',
lib.data.get_time_folder(args)) lib.data.get_time_folder(args))
return root return root
......
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