diff --git a/compass/ocean/tests/isomip_plus/forward.py b/compass/ocean/tests/isomip_plus/forward.py index c36d94a5ad..c1ea540438 100644 --- a/compass/ocean/tests/isomip_plus/forward.py +++ b/compass/ocean/tests/isomip_plus/forward.py @@ -1,8 +1,8 @@ import os import shutil import time -import numpy as np +import numpy as np import xarray from compass.model import run_model @@ -177,11 +177,12 @@ def run(self): units='PSU', vmin=33.8, vmax=34.7, cmap='cmo.haline') tol = 1e-10 dsIce = xarray.open_dataset( - os.path.join(self.work_dir, 'land_ice_fluxes.nc')) + os.path.join(self.work_dir, + 'land_ice_fluxes.nc')) plotter.plot_horiz_series( dsIce.topDragMagnitude, 'topDragMagnitude', 'topDragMagnitude', True, - vmin=0+tol, vmax=np.max(dsIce.topDragMagnitude.values), + vmin=0 + tol, vmax=np.max(dsIce.topDragMagnitude.values), cmap_set_under='k') plotter.plot_horiz_series( dsIce.landIceHeatFlux, @@ -197,26 +198,26 @@ def run(self): plotter.plot_horiz_series( dsIce.landIceFreshwaterFlux, 'landIceFreshwaterFlux', 'landIceFreshwaterFlux', True, - vmin=0+tol, - vmax=1e-4, cmap_set_under='k', cmap_scale='log') + vmin=0 + tol, vmax=1e-4, + cmap_set_under='k', cmap_scale='log') plotter.plot_horiz_series( dsIce.landIceFraction, 'landIceFraction', 'landIceFraction', True, - vmin=0+tol, vmax=1-tol, + vmin=0 + tol, vmax=1 - tol, cmap='cmo.balance', cmap_set_under='k', cmap_set_over='r') if 'landIceFloatingFraction' in dsIce.keys(): - plotter.plot_horiz_series(dsIce.landIceFloatingFraction, - 'landIceFloatingFraction', - 'landIceFloatingFraction', - True, vmin=0+tol, vmax=1-tol, - cmap='cmo.balance', - cmap_set_under='k', cmap_set_over='r') + plotter.plot_horiz_series( + dsIce.landIceFloatingFraction, + 'landIceFloatingFraction', 'landIceFloatingFraction', + True, vmin=0 + tol, vmax=1 - tol, + cmap='cmo.balance', cmap_set_under='k', cmap_set_over='r') if self.name == 'simulation': - update_evaporation_flux(in_forcing_file='forcing_data_init.nc', - out_forcing_file='forcing_data_updated.nc', - out_forcing_link='forcing_data.nc') + update_evaporation_flux( + in_forcing_file='forcing_data_init.nc', + out_forcing_file='forcing_data_updated.nc', + out_forcing_link='forcing_data.nc') replacements = {'config_do_restart': '.true.', 'config_start_time': "'file'"} diff --git a/compass/ocean/tests/isomip_plus/initial_state.py b/compass/ocean/tests/isomip_plus/initial_state.py index b28c212fd7..60dfed87d2 100644 --- a/compass/ocean/tests/isomip_plus/initial_state.py +++ b/compass/ocean/tests/isomip_plus/initial_state.py @@ -1,7 +1,7 @@ import os import shutil -import cmocean +import cmocean # noqa: F401 import numpy as np import xarray as xr from mpas_tools.cime.constants import constants @@ -116,7 +116,8 @@ def _compute_initial_condition(self): # when min_land_ice_fraction = 0 mask = ds.landIceFraction > min_land_ice_fraction - floating_mask = np.logical_and(ds.landIceFloatingFraction > 0, + floating_mask = np.logical_and( + ds.landIceFloatingFraction > 0, ds.landIceFraction >= min_land_ice_fraction) ds['landIceMask'] = mask.astype(int) @@ -184,7 +185,8 @@ def _compute_initial_condition(self): ds['salinity'] = \ (1.0 - frac) * init_top_sal + frac * init_bot_sal # for thin film cells, set temperature to freezing point - ds['temperature'] = xr.where(thin_film_mask, thin_film_temp, ds.temperature) + ds['temperature'] = xr.where(thin_film_mask, thin_film_temp, + ds.temperature) # compute coriolis coriolis_parameter = section.getfloat('coriolis_parameter') @@ -235,7 +237,7 @@ def _plot(self, ds): ds['totalColThickness'] = ds['ssh'] ds['totalColThickness'].values = \ ds['layerThickness'].sum(dim='nVertLevels') - tol=1e-10 + tol = 1e-10 plotter.plot_horiz_series(ds.landIceMask, 'landIceMask', 'landIceMask', True) @@ -253,7 +255,7 @@ def _plot(self, ds): True, vmin=0, vmax=700) plotter.plot_horiz_series(ds.ssh + ds.bottomDepth, 'H', 'H', True, - vmin=min_column_thickness+tol, vmax=700, + vmin=min_column_thickness + tol, vmax=700, cmap_set_under='r', cmap_scale='log') plotter.plot_horiz_series(ds.totalColThickness, 'totalColThickness', 'totalColThickness', @@ -261,24 +263,24 @@ def _plot(self, ds): vmax=700, cmap_set_under='r') plotter.plot_horiz_series(ds.landIceFraction, 'landIceFraction', 'landIceFraction', - True, vmin=0+tol, vmax=1-tol, + True, vmin=0 + tol, vmax=1 - tol, cmap='cmo.balance', cmap_set_under='k', cmap_set_over='r') plotter.plot_horiz_series(ds.landIceFloatingFraction, 'landIceFloatingFraction', 'landIceFloatingFraction', - True, vmin=0+tol, vmax=1-tol, + True, vmin=0 + tol, vmax=1 - tol, cmap='cmo.balance', cmap_set_under='k', cmap_set_over='r') plotter.plot_horiz_series(ds.landIceGroundedFraction, 'landIceGroundedFraction', 'landIceGroundedFraction', - True, vmin=0+tol, vmax=1-tol, + True, vmin=0 + tol, vmax=1 - tol, cmap='cmo.balance', cmap_set_under='k', cmap_set_over='r') plotter.plot_horiz_series(ds.oceanFracObserved, 'oceanFracObserved', 'oceanFracObserved', - True, vmin=0+tol, vmax=1-tol, + True, vmin=0 + tol, vmax=1 - tol, cmap='cmo.balance', cmap_set_under='k', cmap_set_over='r') plotter.plot_layer_interfaces() @@ -286,7 +288,7 @@ def _plot(self, ds): plotter.plot_3d_field_top_bot_section( ds.layerThickness, nameInTitle='layerThickness', prefix='h', units='m', - vmin=min_column_thickness + 1e-10, vmax=50, + vmin=min_column_thickness + tol, vmax=50, cmap='cmo.deep_r', cmap_set_under='r') plotter.plot_3d_field_top_bot_section(