Skip to content

Commit

Permalink
Made names of ssh_eval plots consistent with other scripts, mv gulf_s…
Browse files Browse the repository at this point in the history
…tream plot ot NWA12
  • Loading branch information
Utheri Wagura authored and Utheri Wagura committed Oct 25, 2024
1 parent 0abf850 commit 3932c5a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import AxesGrid

# Need to append physics dir to path to access plot common
import sys
sys.path.append("..")
from plot_common import open_var, add_ticks, save_figure

def compute_gs(ssh, data_grid=None):
Expand Down Expand Up @@ -61,7 +64,7 @@ def plot_gulf_stream(pp_root, label):
)

# Get model grid
model_grid = xarray.open_dataset( '../data/geography/ocean_static.nc' )
model_grid = xarray.open_dataset( '../../data/geography/ocean_static.nc' )

# Get model thetao data TODO: maki this comment better
model_thetao = open_var(pp_root, 'ocean_monthly_z', 'thetao')
Expand All @@ -84,15 +87,15 @@ def plot_gulf_stream(pp_root, label):
)

# Get Glorys data
glorys_t200 = xarray.open_dataarray('../data/diagnostics/glorys_T200.nc')
glorys_t200 = xarray.open_dataarray('../../data/diagnostics/glorys_T200.nc')

# Get satellite points
#satellite_ssh_index, satellite_ssh_points = compute_gs(satellite['adt'])
#satellite_ssh_points.to_netcdf('../data/obs/satellite_ssh_points.nc')
#satellite_ssh_index.to_pickle('../data/obs/satellite_ssh_index.pkl')
#read pre-calculate satellite_ssh_index and points
satellite_ssh_points = xarray.open_dataset('../data/obs/satellite_ssh_points.nc')
satellite_ssh_index = pd.read_pickle('../data/obs/satellite_ssh_index.pkl')
satellite_ssh_points = xarray.open_dataset('../../data/obs/satellite_ssh_points.nc')
satellite_ssh_index = pd.read_pickle('../../data/obs/satellite_ssh_index.pkl')
satellite_rolled = satellite_ssh_index.rolling(25, center=True, min_periods=25).mean().dropna()

#satellite = xarray.open_mfdataset([f'/net2/acr/altimetry/SEALEVEL_GLO_PHY_L4_MY_008_047/adt_{y}_{m:02d}.nc' for y in range(1993, 2020) for m in range(1, 13)])
Expand Down Expand Up @@ -142,7 +145,8 @@ def plot_gulf_stream(pp_root, label):
ax.set_ylabel('Index (positive north)')
ax.legend(ncol=4, loc='lower right', frameon=False, fontsize=8)

save_figure('gulfstream_eval', label=label, pdf=True)
# default to saving figures in current dir instead of dedicated figures dir
save_figure('gulfstream_eval', label=label, pdf=True, output_dir = ".")

if __name__ == '__main__':
from argparse import ArgumentParser
Expand Down
4 changes: 2 additions & 2 deletions diagnostics/physics/ssh_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ def plot_ssh_eval(pp_root, config, label):
)

# MODEL
p = grid[0].pcolormesh(model_grid.geolon_c, model_grid.geolat_c, model_ssh_ave, cmap=cmap, norm=norm, transform = proj )
p0 = grid[0].pcolormesh(model_grid.geolon_c, model_grid.geolat_c, model_ssh_ave, cmap=cmap, norm=norm, transform = proj )
cbar = autoextend_colorbar(grid.cbar_axes[0], p)
cbar.ax.set_title('SSH (m)', fontsize=10)
grid[0].set_title('(a) Model mean SSH')
logger.info("Successfully plotted model data")

# GLORYS
p = grid[1].pcolormesh(glorys_lonc, glorys_latc, glorys_zos_ave, cmap=cmap, norm=norm, transform = proj )
p1 = grid[1].pcolormesh(glorys_lonc, glorys_latc, glorys_zos_ave, cmap=cmap, norm=norm, transform = proj )
cbar = autoextend_colorbar(grid.cbar_axes[1], p)
cbar.ax.set_title('SSH (m)', fontsize=10)
grid[1].set_title('(b) GLORYS12 mean SSH')
Expand Down

0 comments on commit 3932c5a

Please sign in to comment.