Skip to content

Commit

Permalink
Apply suggestions from Xylar's code review
Browse files Browse the repository at this point in the history
Co-authored-by: Xylar Asay-Davis <[email protected]>
  • Loading branch information
cbegeman and xylar authored Aug 31, 2023
1 parent 9715be6 commit bb0cd4c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions compass/ocean/iceshelf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def compute_land_ice_pressure_and_draft(ssh, modify_mask, ref_density):


def adjust_ssh(variable, iteration_count, step, update_pio=True,
convert_to_cdf5=False, deltaSSH_threshold=None):
convert_to_cdf5=False, delta_ssh_threshold=None):
"""
Adjust the sea surface height or land-ice pressure to be dynamically
consistent with one another. A series of short model runs are performed,
Expand Down Expand Up @@ -187,8 +187,8 @@ def adjust_ssh(variable, iteration_count, step, update_pio=True,
logger.info(f' {string}')
log_file.write(f'{string}\n')

if deltaSSH_threshold is not None:
if abs(deltaSSHMax) < deltaSSH_threshold:
if delta_ssh_threshold is not None:
if abs(deltaSSHMax) < delta_ssh_threshold:
break

logger.info(" - Complete\n")
Expand Down
4 changes: 2 additions & 2 deletions compass/ocean/tests/ice_shelf_2d/default/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def __init__(self, test_group, resolution, coord_type,
self.resolution = resolution
self.coord_type = coord_type
if resolution >= 1e3:
res_name = f'{int(resolution / 1e3)}km'
res_name = f'{resolution / 1e3:g}km'
else:
res_name = f'{int(resolution)}m'
res_name = f'{resolution:g}m'
subdir = f'{res_name}/{coord_type}/{name}'
super().__init__(test_group=test_group, name=name,
subdir=subdir)
Expand Down
4 changes: 2 additions & 2 deletions compass/ocean/tests/ice_shelf_2d/restart_test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def __init__(self, test_group, resolution, coord_type):
self.resolution = resolution
self.coord_type = coord_type
if resolution >= 1e3:
res_name = f'{int(resolution / 1e3)}km'
res_name = f'{resolution / 1e3:g}km'
else:
res_name = f'{int(resolution)}m'
res_name = f'{resolution:g}m'
subdir = f'{res_name}/{coord_type}/{name}'
super().__init__(test_group=test_group, name=name,
subdir=subdir)
Expand Down
3 changes: 2 additions & 1 deletion compass/ocean/tests/ice_shelf_2d/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def run(self):
delssh = dsOut.ssh - dsOut.ssh[0, :]
s_vmin = np.nanmin(delssh.values)
s_vmax = np.nanmax(delssh.values)
plotter.plot_horiz_series(delssh, 'delssh', 'delssh', True,
plotter.plot_horiz_series(da=delssh, nameInTitle='delssh',
prefix='delssh', oceanDomain=True,
cmap='cmo.curl',
vmin=-1. * max(abs(s_vmin), abs(s_vmax)),
vmax=max(abs(s_vmin), abs(s_vmax)),
Expand Down

0 comments on commit bb0cd4c

Please sign in to comment.