Commit a872c884 authored by Modellers Operational's avatar Modellers Operational

Updates to CMEMS boundary generation for AMM15

parent 2a19fa72
......@@ -29,7 +29,12 @@ interval = 1/float(sys.argv[8])
adjust_tides = sys.argv[9].split(',')
no_nests = int(sys.argv[10])
try:
amm_7 = sys.argv[11]
amm_7_raw = sys.argv[11]
if amm_7_raw == 'True':
amm_7 = True
else:
amm_7 = False
except:
amm_7 = False
......@@ -50,10 +55,11 @@ aqua_prep.add_nests(no_nests)
aqua_prep.add_nests_harmonics(fvcom_harmonics, harmonics_vars=['u', 'v', 'ua', 'va', 'zeta'], constituents=constituents, pool_size=20)
# Make the regular readers for the CMEMS data
if amm_7:
fvcom_cmems_names = {'salinity':['SAL', 'vosaline'], 'temp':['TEM', 'votemper'],
'v':['CUR', 'vomecrty'], 'u':['CUR', 'vozocrtx'],
'zeta':['SSH', 'sossheig']}
'v':['CUR', 'vomecrty'], 'u':['CUR', 'vozocrtx'],
'zeta':['SSH', 'sossheig']}
else:
fvcom_cmems_names = {'salinity':['SAL', 'so'], 'temp':['TEM', 'thetao'],
'v':['CUR', 'vo'], 'u':['CUR', 'uo'],
......@@ -63,34 +69,34 @@ dt_list = [start_date + dt.timedelta(days = int(i)) for i in np.arange(-1, (end_
datestr_list = [this_date.strftime('%Y%m%d') for this_date in dt_list]
for this_fvcom, this_var in fvcom_cmems_names.items():
cmems_file_list = []
for this_date in datestr_list:
if this_var[0] == 'SSH':
poss_files = gb.glob('{}/*{}*{}*/*{}.nc'.format(cmems_data_dir, 'hi', this_var[0], this_date))
else:
poss_files = gb.glob('{}/*{}*{}*/*{}.nc'.format(cmems_data_dir, cmems_time_res, this_var[0], this_date))
# Handle that sometimes theres multiple files for one day from different forecast runs
if len(poss_files) > 1:
chosen_file = poss_files[0]
for this_file in poss_files[1:]:
if this_file > chosen_file:
chosen_file = this_file
cmems_file_list.append(chosen_file)
elif len(poss_files) == 1:
cmems_file_list.append(poss_files[0])
if this_var[0] =='SSH':
reg_reader = pf.preproc.Regular2DReader
else:
reg_reader = pf.preproc.RegularReader
this_data_reader = reg_reader(cmems_file_list[0], [this_var[1]])
if len(cmems_file_list) > 1:
for this_file in cmems_file_list[1:]:
this_data_reader = reg_reader(this_file, [this_var[1]]) >> this_data_reader
aqua_prep.add_nests_regular(this_fvcom, this_data_reader, this_var[1], constrain_coordinates=True)
cmems_file_list = []
for this_date in datestr_list:
if this_var[0] == 'SSH':
poss_files = gb.glob('{}/*{}*{}*/*{}.nc'.format(cmems_data_dir, 'hi', this_var[0], this_date))
else:
poss_files = gb.glob('{}/*{}*{}*/*{}.nc'.format(cmems_data_dir, cmems_time_res, this_var[0], this_date))
# Handle that sometimes theres multiple files for one day from different forecast runs
if len(poss_files) > 1:
chosen_file = poss_files[0]
for this_file in poss_files[1:]:
if this_file > chosen_file:
chosen_file = this_file
cmems_file_list.append(chosen_file)
elif len(poss_files) == 1:
cmems_file_list.append(poss_files[0])
if this_var[0] =='SSH':
reg_reader = pf.preproc.Regular2DReader
else:
reg_reader = pf.preproc.RegularReader
this_data_reader = reg_reader(cmems_file_list[0], [this_var[1]])
if len(cmems_file_list) > 1:
for this_file in cmems_file_list[1:]:
this_data_reader = reg_reader(this_file, [this_var[1]]) >> this_data_reader
aqua_prep.add_nests_regular(this_fvcom, this_data_reader, this_var[1], constrain_coordinates=True)
# Depth avg the velocities
aqua_prep.avg_nest_force_vel()
......
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