Skip to content

Commit

Permalink
wip, added tools to select mom6 levels
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumevernieres committed Oct 2, 2024
1 parent 8f0541c commit 84600b6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions ush/python/pygfs/task/marine_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def _prep_variational_yaml(self: Task) -> None:
envconfig_jcb['cyc'] = os.getenv('cyc')
envconfig_jcb['SOCA_NINNER'] = self.task_config.SOCA_NINNER
envconfig_jcb['obs_list'] = ['adt_rads_all']
envconfig_jcb['MOM6_LEVS'] = mdau.get_mom6_levels(str(self.task_config.OCNRES))

# Write obs_list_short
save_as_yaml(parse_obs_list_file(self.task_config.MARINE_OBS_LIST_YAML), 'obs_list_short.yaml')
Expand Down
22 changes: 22 additions & 0 deletions ush/python/pygfs/utils/marine_da_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,25 @@ def clean_empty_obsspaces(config, target, app='var'):

# save cleaned yaml
save_as_yaml(config, target)

@logit(logger)
def get_mom6_levels(ocnres: str) -> int:
"""
Temporary function that returns the number of vertical levels in MOM6 given the horizontal resolution.
This is requiered by the diffusion saber block that now makes use of oops::util::FieldSetHelpers::writeFieldSet
and requires the number of levels in the configuration. I have been told this will be changed in the future.
"""

# get the number of vertical levels in MOM6 according to the horizontal resolution
if ocnres == '500':
nlev = 25
elif ocnres == '100':
nlev = 75
elif ocnres == '050':
nlev = 75
elif ocnres == '025':
nlev = 75
else:
raise ValueError("FATAL ERROR: Invalid ocnres value. Aborting.")

return nlev

0 comments on commit 84600b6

Please sign in to comment.