Skip to content

Commit

Permalink
Cleanup rpe analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
cbegeman committed Jan 30, 2023
1 parent a72891c commit 95334ea
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions compass/ocean/tests/overflow/rpe_test/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, test_case, resolution, nus):
for index, nu in enumerate(nus):
self.add_input_file(
filename=f'output_{index+1}.nc',
target=f'../rpe_test_{index+1}_nu_{nu}/output.nc')
target=f'../rpe_test_{index+1}_nu_{int(nu)}/output.nc')

self.add_output_file(
filename=f'sections_overflow_{resolution}.png')
Expand All @@ -73,7 +73,8 @@ def _plot(filename, nus, rpe):
nus : list of float
The viscosity values
rpe : float, dim len(nu) x len(time)
rpe : numpy.ndarray
The reference potential energy with size len(nu) x len(time)
"""

plt.switch_backend('Agg')
Expand Down Expand Up @@ -135,15 +136,10 @@ def _plot(filename, nus, rpe):
layer_thickness = ds.layerThickness
layer_thickness_cell1 = layer_thickness[cell1_index, :]
layer_thickness_cell2 = layer_thickness[cell2_index, :]
layer_thickness_x = layer_thickness_cell2[1:, :]

ssh = ds.ssh
ssh_cell1 = ssh[cell1_index]
ssh_cell2 = ssh[cell2_index]
ssh_x = ssh_cell2[1:]

z_index = xarray.DataArray(data=np.arange(n_vert_levels),
dims='nVertLevels')

z_interface = np.zeros((nEdges_x, n_vert_levels + 1))
z_interface[:, 0] = 0.5 * (ssh_cell1.values + ssh_cell2.values)
Expand Down

0 comments on commit 95334ea

Please sign in to comment.