Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean-up parabolic bowl convergence plot #823

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions compass/ocean/tests/parabolic_bowl/viz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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()
sbrus89 marked this conversation as resolved.
Show resolved Hide resolved

ax.legend(loc='lower right')
ax.set_title('Layer thickness convergence')
Expand Down
Loading