From 962063fa7dde68f633e7ea4c3f605c11f5e8fc8d Mon Sep 17 00:00:00 2001 From: Carolyn Begeman Date: Tue, 14 May 2024 10:21:49 -0500 Subject: [PATCH] fixup parabolic bowl convergence plot --- compass/ocean/tests/parabolic_bowl/viz/__init__.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/compass/ocean/tests/parabolic_bowl/viz/__init__.py b/compass/ocean/tests/parabolic_bowl/viz/__init__.py index 2c16e77d61..b811138278 100644 --- a/compass/ocean/tests/parabolic_bowl/viz/__init__.py +++ b/compass/ocean/tests/parabolic_bowl/viz/__init__.py @@ -220,9 +220,10 @@ def rmse_plots(self): fig, ax = plt.subplots(nrows=1, ncols=1) max_rmse = 0 + resolutions = self.resolutions for j, comp in enumerate(comparisons): - rmse = np.zeros(len(self.resolutions)) - for i, res in enumerate(self.resolutions): + rmse = np.zeros(len(resolutions)) + for i, res in enumerate(resolutions): rmse[i] = self.compute_rmse( 'h', @@ -231,19 +232,20 @@ def rmse_plots(self): if rmse[i] > max_rmse: max_rmse = rmse[i] - ax.loglog(self.resolutions, rmse, + ax.loglog(resolutions, rmse, linestyle='-', marker='o', label=comp) - rmse_1st_order = np.zeros(len(self.resolutions)) + rmse_1st_order = np.zeros(len(resolutions)) rmse_1st_order[0] = max_rmse - for i in range(len(self.resolutions) - 1): + for i in range(len(resolutions) - 1): rmse_1st_order[i + 1] = rmse_1st_order[i] / 2.0 - ax.loglog(self.resolutions, rmse_1st_order, + ax.loglog(resolutions, rmse_1st_order, linestyle='-', color='k', alpha=.25, label='1st order') ax.set_xlabel('Cell size (km)') ax.set_ylabel('RMSE (m)') + ax.invert_xaxis() ax.legend(loc='lower right') ax.set_title('Layer thickness convergence')