Skip to content

Commit 5b0345c

Browse files
committed
Add cmap set under to viz
1 parent 688b789 commit 5b0345c

File tree

1 file changed

+26
-13
lines changed
  • polaris/tasks/ocean/drying_slope

1 file changed

+26
-13
lines changed

polaris/tasks/ocean/drying_slope/viz.py

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ def run(self):
138138
np.logical_and(cell1_is_valid, cell2_is_valid), 1, 0
139139
)
140140

141+
vert_levels = self.config.getint('vertical_grid', 'vert_levels')
142+
hmin = self.config.getfloat(
143+
'drying_slope_barotropic', 'thin_film_thickness'
144+
)
145+
hmax = vert_levels * hmin * 10.0
141146
out_filenames = []
142147
if not self.damping_coeffs:
143148
out_filenames.append('output.nc')
@@ -150,16 +155,17 @@ def run(self):
150155
x, y = self._plot_transects(ds_mesh=ds_mesh, ds=ds)
151156

152157
nt = int(ds.sizes['Time'])
153-
for tidx in np.arange(0,nt,nt/20, dtype=int):
154-
#for tidx in np.arange(-10,0,1):
158+
for tidx in np.arange(0, nt, nt / 10, dtype=int):
159+
# for tidx in np.arange(-10,0,1):
160+
# for tidx in [-2]:
161+
# for atime in self.times:
162+
# # Plot MPAS-O data
163+
# mpastime = ds.daysSinceStartOfSim.values
164+
# simtime = pd.to_timedelta(mpastime)
165+
# s_day = 86400.0
166+
# time = simtime.total_seconds()
167+
# tidx = np.argmin(np.abs(time / s_day - float(atime)))
155168
for zidx in [0, 9]:
156-
#for atime in self.times:
157-
# Plot MPAS-O data
158-
#mpastime = ds.daysSinceStartOfSim.values
159-
#simtime = pd.to_timedelta(mpastime)
160-
#s_day = 86400.0
161-
#time = simtime.total_seconds()
162-
#tidx = np.argmin(np.abs(time / s_day - float(atime)))
163169
plot_horiz_field(
164170
ds_mesh,
165171
ds.wettingVelocityFactor,
@@ -218,10 +224,14 @@ def run(self):
218224
plot_horiz_field(
219225
ds_mesh,
220226
ds.ssh + ds_mesh.bottomDepth,
221-
cmap_title='H',
222227
out_file_name=f'wct_horiz_t{tidx:04g}.png',
223228
t_index=tidx,
224229
field_mask=cell_mask,
230+
vmin=hmax,
231+
vmax=2.0,
232+
cmap='viridis',
233+
cmap_title='H',
234+
cmap_set_under='r',
225235
)
226236

227237
def _plot_transects(self, ds_mesh, ds):
@@ -248,9 +258,12 @@ def _plot_transects(self, ds_mesh, ds):
248258
simtime = pd.to_timedelta(mpastime)
249259
time_hours = simtime.total_seconds() / 3600.0
250260
nt = int(ds.sizes['Time'])
251-
for tidx in np.arange(0,nt,nt/10, dtype=int):
252-
#for tidx in range(ds.sizes['Time']):
253-
if np.nanmax(np.abs(ds.layerThickness.isel(Time=tidx).values)) > 1.e3:
261+
for tidx in np.arange(0, nt, nt / 10, dtype=int):
262+
# for tidx in range(ds.sizes['Time']):
263+
if (
264+
np.nanmax(np.abs(ds.layerThickness.isel(Time=tidx).values))
265+
> 1.0e3
266+
):
254267
print(f'layerThickness corrupted at time {tidx}')
255268
ds_transect = compute_transect(
256269
x=x,

0 commit comments

Comments
 (0)