#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Mon Jul 21 04:27:23 PM EDT 2025 if __name__ == '__main__': import sys,os try: from misc.timer import Timer tt = Timer(f'[{os.getcwd()}] start ' + ' '.join(sys.argv)) except: pass import sys, os.path, os, glob, datetime import xarray as xr, numpy as np, pandas as pd, matplotlib.pyplot as plt #more imports wython = '/tigress/wenchang/wython' if wython not in sys.path: sys.path.append(wython); print('added to python path:', wython) #from misc import get_kws_from_argv from wyplot_lines_context import wyplot as plot_lines from wyplot_map_sst_change import wyplot as plot_map # if __name__ == '__main__': try: tt.check('end import') except: pass # #start from here if __name__ == '__main__': from wyconfig import * #my plot settings from geoplots.cartopy.api import cartoproj from misc import axlabel proj = cartoproj('robin', central_longitude=210) #dproj = cartoproj() fig = plt.figure(figsize=(6,6.8), dpi=100) gs = fig.add_gridspec(2,1) axes = [] ax = fig.add_subplot(gs[0]) plot_lines(ax) axes.append(ax) ax = fig.add_subplot(gs[1], projection=proj) plot_map(ax=ax, cbar_kwargs=dict(orientation='horizontal', shrink=0.8)) axes.append(ax) for ax,label in zip(axes, list('ab')): axlabel(ax, label+')', x=-0.1, y=1.05) #savefig if 'savefig' in sys.argv or 's' in sys.argv: figname = __file__.replace('.py', f'.png') if 'overwritefig' in sys.argv or 'o' in sys.argv: wysavefig(figname, overwritefig=True) else: wysavefig(figname) try: tt.check(f'**Done**') except: pass print() if 'notshowfig' in sys.argv or 'n' in sys.argv: pass else: if 'plt' in globals(): plt.show()