diff --git a/diagnostics/physics/plot_gulf_stream.py b/diagnostics/physics/NWA12/plot_gulf_stream.py similarity index 91% rename from diagnostics/physics/plot_gulf_stream.py rename to diagnostics/physics/NWA12/plot_gulf_stream.py index 82493ac21..d58d448c4 100644 --- a/diagnostics/physics/plot_gulf_stream.py +++ b/diagnostics/physics/NWA12/plot_gulf_stream.py @@ -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): @@ -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') @@ -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)]) @@ -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 diff --git a/diagnostics/physics/ssh_eval.py b/diagnostics/physics/ssh_eval.py index fca460378..9c22b1dbd 100644 --- a/diagnostics/physics/ssh_eval.py +++ b/diagnostics/physics/ssh_eval.py @@ -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')