Skip to content

Commit

Permalink
Reduce memory burden with FES2014 files
Browse files Browse the repository at this point in the history
  • Loading branch information
jpolton committed Jan 20, 2022
1 parent 5615de8 commit 017e253
Show file tree
Hide file tree
Showing 4 changed files with 306 additions and 351 deletions.
2 changes: 1 addition & 1 deletion inputs/namelist_local.bdy
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
! unstructured open boundaries tidal parameters
!------------------------------------------------------------------------------
ln_tide = .true. ! =T : produce bdy tidal conditions
sn_tide_model = 'FES' ! Name of tidal model (FES|TPXO)
sn_tide_model = 'FES2014' ! Name of tidal model (FES2014|TPXO7p2)
clname(1) = 'M2' ! constituent name
clname(2) = 'S2'
clname(3) = 'K2'
Expand Down
43 changes: 20 additions & 23 deletions pynemo/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,19 +215,13 @@ def process_bdy(setup_filepath=0, mask_gui=False):
# Extract source data on dst grid

if settings['tide']:
if settings['tide_model'].lower()=='tpxo':
if (settings['tide_model'].lower() == 'tpxo7p2') or \
(settings['tide_model'].lower() == 'fes2014'):
cons = tide.nemo_bdy_tide_rot(
Setup, DstCoord, bdy_ind['t'], bdy_ind['u'], bdy_ind['v'],
settings['clname'])
elif settings['tide_model'].lower()=='fes':
cons = tide.nemo_bdy_tide_rot(
Setup, DstCoord, bdy_ind['t'], bdy_ind['u'], bdy_ind['v'],
settings['clname'])
#logger.error('Tidal model: %s, not yet implemented',
# settings['tide_model'])
return
settings['clname'])
else:
logger.error('Tidal model: %s, not recognised',
logger.error('Tidal model: %s, not recognised',
settings['tide_model'])
return

Expand Down Expand Up @@ -382,19 +376,22 @@ def write_tidal_data(setup_var, dst_coord_var, grid, tide_cons, cons):
const_name = setup_var.settings['clname'][tide_con]
const_name = const_name.replace("'", "").upper()

for key,val in list(tmap.items()):

fout_tide = setup_var.settings['dst_dir']+ \
setup_var.settings['fn']+ \
'_bdytide_'+const_name+'_grd_'+ \
val['nam'].upper()+'.nc'

nemo_bdy_tide_ncgen.CreateBDYTideNetcdfFile(fout_tide,
val['nx'],
dst_coord_var.lonlat[key]['lon'].shape[1], # "key" is the grd value
dst_coord_var.lonlat[key]['lon'].shape[0],
val['des']+tide_con,
setup_var.settings['fv'], key.upper())
for key, val in list(tmap.items()):

fout_tide = setup_var.settings['dst_dir'] + \
setup_var.settings['fn'] + \
'_bdytide_' + \
setup_var.settings['tide_model'] + '_' + \
const_name + '_grd_' + \
val['nam'].upper() + '.nc'

nemo_bdy_tide_ncgen.CreateBDYTideNetcdfFile(fout_tide,
val['nx'],
dst_coord_var.lonlat[key]['lon'].shape[1],
# "key" is the grd value
dst_coord_var.lonlat[key]['lon'].shape[0],
val['des'] + tide_con,
setup_var.settings['fv'], key.upper())

# Set the index for the con(stituent) to save
if val['nam'] == "z":
Expand Down
Loading

0 comments on commit 017e253

Please sign in to comment.