Skip to content

Commit 824648b

Browse files
committed
Make isomip plotting more flexible
1 parent a28a73a commit 824648b

File tree

1 file changed

+5
-1
lines changed
  • compass/ocean/tests/isomip_plus/viz

1 file changed

+5
-1
lines changed

compass/ocean/tests/isomip_plus/viz/plot.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ def __init__(self, inFolder, streamfunctionFolder, outFolder, expt,
239239
self.sectionY = sectionY
240240
self.showProgress = showProgress
241241

242+
if 'Time' in dsMesh.dims:
243+
dsMesh = dsMesh.isel(Time=0)
242244
self.dsMesh = dsMesh
243245
self.ds = ds
244246

@@ -508,7 +510,9 @@ def plot_horiz_series(self, da, nameInTitle, prefix, oceanDomain,
508510
The time indices at which to plot. If not provided, set to all.
509511
"""
510512

511-
nTime = self.ds.sizes['Time']
513+
if 'Time' not in da.dims:
514+
da = da.expand_dims(dim='Time', axis=0)
515+
nTime = da.sizes['Time']
512516
if self.showProgress:
513517
widgets = ['plotting {}: '.format(nameInTitle),
514518
progressbar.Percentage(), ' ',

0 commit comments

Comments
 (0)