Skip to content

Commit

Permalink
switched to dict
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumevernieres committed Oct 3, 2024
1 parent 303d417 commit 24839f5
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions ush/python/pygfs/utils/marine_da_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,16 @@ def get_mom6_levels(ocnres: str) -> int:
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.")
# Currently implemented resolutions
ocnres_to_nlev = {
'500': 25,
'100': 75,
'050': 75,
'025': 75
}
try:
nlev = ocnres_to_nlev.get(ocnres)
except KeyError:
raise KeyError("FATAL ERROR: Invalid ocnres value. Aborting.")

return nlev

0 comments on commit 24839f5

Please sign in to comment.