Skip to content

Commit

Permalink
Fix hovmoller plot comparison
Browse files Browse the repository at this point in the history
Sometimes, runs have slightly different Time values in
timeSeriesStatsMonthly (seemingly related to restarts). When
this happens, the hovmoller differences are only at times that
match exactly, leading to a diff field with the wrong size.

This merge fixes the issue by first checking to make sure the
two runs start and end at (approximately) the same time, then
using the time from the "main" run for the "reference" run, too.
  • Loading branch information
xylar committed Sep 25, 2022
1 parent 3ade01b commit 72c2948
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mpas_analysis/ocean/plot_hovmoller_subtask.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,14 @@ def run_task(self):
assert(np.all(refMask.values == mask.values))
refField = refField.where(mask, drop=True)
assert(field.shape == refField.shape)
# make sure the start and end time sare the same
assert(int(field.Time.values[0]) == int(refField.Time.values[0]))
assert(int(field.Time.values[-1]) == int(refField.Time.values[-1]))
# we're seeing issues with slightly different times between runs
# so let's copy them
refField['Time'] = field.Time
diff = field - refField
assert(field.shape == diff.shape)
refTitle = self.controlConfig.get('runs', 'mainRunName')
diffTitle = 'Main - Control'

Expand Down

0 comments on commit 72c2948

Please sign in to comment.