Commit 448dd0de authored by Clément Haëck's avatar Clément Haëck
Browse files

Fix create_data*set*

parent 7db99e42
......@@ -20,5 +20,5 @@ def add_idx_dim(ds, filename, finder):
return ds
lib.data.create_data(__name__, PREGEX, ROOT, ARGS,
lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS,
open_mf_kw=dict(preprocess_finder=add_idx_dim))
......@@ -18,7 +18,7 @@ def ROOT(args):
auto_attr = lib.data.create_data(__name__, PREGEX, ROOT, ARGS,
auto_attr = lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS,
defaults=DEFAULTS)
......
......@@ -16,7 +16,7 @@ def ROOT(args):
return lib.data.get_default_directory(args, 'SN_separation')
lib.data.create_data(__name__, PREGEX, ROOT, ARGS)
lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS)
def smooth(ds, time_step=8):
......
......@@ -22,5 +22,5 @@ def add_dims(ds, filename, finder):
return ds
lib.data.create_data(__name__, PREGEX, ROOT, ARGS,
lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS,
open_mf_kw=dict(preprocess_finder=add_dims))
......@@ -15,4 +15,4 @@ def ROOT(args):
return lib.data.get_default_directory(args, 'Clouds_maps')
lib.data.create_data(__name__, PREGEX, ROOT, ARGS)
lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS)
......@@ -19,4 +19,4 @@ def ROOT(args):
return root
lib.data.create_data(__name__, PREGEX, ROOT, ARGS, defaults=DEFAULTS)
lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS, defaults=DEFAULTS)
......@@ -20,4 +20,4 @@ def ROOT(args):
lib.data.get_time_folder(args)]
lib.data.create_data(__name__, PREGEX, ROOT, ARGS)
lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS)
......@@ -20,5 +20,5 @@ def preprocess(ds):
return ds
lib.data.create_data(__name__, PREGEX, ROOT, ARGS,
lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS,
open_mf_kw=dict(preprocess=preprocess))
......@@ -24,7 +24,7 @@ def ROOT(args):
return root
lib.data.create_data(__name__, PREGEX, ROOT, ARGS)
lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS)
......
......@@ -20,24 +20,29 @@ def PREGEX(args):
"scale_%(scale:fmt=.1f)/",
"coef_%(coef:fmt=d)/"]
if args['dim2']:
pregex.append("hist_2D_GS3")
else:
if args['kind'] == '2thr':
pregex += ["hist_GS3",
"_thr_%(thr_lo:fmt=.2f)_%(thr_hi:fmt=.2f)"]
elif args['kind'] == '2d':
pregex.append("hist_2D_GS3")
elif args['kind'] == 'thr':
pregex += ["hist_GS3",
"_thr_%(threshold:fmt=.2f)"]
else:
raise ValueError("Unknown hist pregex type '{}'".format(args['dim']))
pregex += ["_%(time:Y)",
"%(nomask:opt=:_nomask)" if args['nomask'] else "",
"_nomask" if args['nomask'] else "",
".nc"]
return pregex.join('')
return ''.join(pregex)
def ROOT(args):
return lib.data.get_default_directory(args, 'Hists')
auto_attr = lib.data.create_data(__name__, PREGEX, ROOT, ARGS)
auto_attr = lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS)
def get_data(args=None, remove_dims=None, **kwargs):
......
......@@ -20,5 +20,5 @@ def preprocess(ds):
return ds.expand_dims('time')
lib.data.create_data(__name__, PREGEX, ROOT, ARGS,
lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS,
open_mf_kw=dict(preprocess=preprocess))
......@@ -20,7 +20,7 @@ def ROOT(args):
return lib.data.get_default_directory(args, 'MUR')
auto_attr = lib.data.create_data(__name__, PREGEX, ROOT, ARGS)
auto_attr = lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS)
def get_data(args=None, **kwargs):
......
......@@ -10,6 +10,8 @@ import lib.data
ARGS = {'region', 'days', 'processed'}
DEFAULTS = dict(processed=True)
grid = '4km_EPSG32662'
grid_original = '4km_EPSG4326'
def PREGEX(args):
......@@ -17,14 +19,9 @@ def PREGEX(args):
'_processed' if args['processed'] else '')
return pregex
def ROOT(args):
root = [lib.root_data, args['region'],
'OSTIA', lib.data.get_time_folder(args)]
return root
grid = '4km_EPSG32662'
grid_original = '4km_EPSG4326'
def ROOT(args):
return lib.data.get_default_directory(args, 'OSTIA')
lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS, DEFAULTS)
......@@ -22,4 +22,4 @@ def ROOT(args):
time_folder=False)
lib.data.create_data(__name__, PREGEX, ROOT, ARGS)
lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS)
......@@ -21,4 +21,4 @@ def ROOT(args):
return root
lib.data.create_data(__name__, PREGEX, ROOT, ARGS, defaults=DEFAULTS)
lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS, defaults=DEFAULTS)
......@@ -37,7 +37,7 @@ def preprocess(ds, filename, finder, lat=None, lon=None):
return ds
auto_attr = lib.data.create_data(__name__, PREGEX, ROOT, ARGS)
auto_attr = lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS)
def get_data(args=None, **kwargs):
......
......@@ -23,5 +23,5 @@ def add_dims(ds, filename, finder):
return ds
lib.data.create_data(__name__, PREGEX, ROOT, ARGS,
lib.data.create_dataset(__name__, PREGEX, ROOT, ARGS,
open_mf_kw=dict(preprocess_finder=add_dims))
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