#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Fri Jun 20 04:30:55 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 geoplots.cartopy.api import cartoproj from wyplot_map_era5_tmin import wyplot as plot_map_tmin_era5 from wyplot_map_era5_tmax import wyplot as plot_map_tmax_era5 from wyplot_lines_tmaxtmin import wyplot as plot_lines_tmintmax from wyplot_map_tmin_diff_am2p5c360 import wyplot as plot_map_tmin_diff_am2p5c360 from wyplot_map_tmax_diff_am2p5c360 import wyplot as plot_map_tmax_diff_am2p5c360 # if __name__ == '__main__': try: tt.check('end import') except: pass # #start from here if __name__ == '__main__': from wyconfig import * #my plot settings proj = cartoproj('robin') fig = plt.figure(figsize=(12,9), dpi=100) gs = fig.add_gridspec(nrows=3, ncols=6) axes = [] ax = fig.add_subplot(gs[0,0:3], projection=proj) im = plot_map_tmin_era5(ax=ax, add_colorbar=False) axes.append(ax) ax = fig.add_subplot(gs[0,3:], projection=proj) im = plot_map_tmax_era5(ax=ax, add_colorbar=False) axes.append(ax) fig.colorbar(im, ax=axes, label='$^\circ$C', extend='both') ax = fig.add_subplot(gs[1,1:5]) plot_lines_tmintmax(ax=ax) ax.set_ylabel('$^\circ$C') axes.append(ax) ax = fig.add_subplot(gs[2,0:3], projection=proj) im = plot_map_tmin_diff_am2p5c360(ax=ax, add_colorbar=False) axes.append(ax) ax = fig.add_subplot(gs[2,3:], projection=proj) im = plot_map_tmax_diff_am2p5c360(ax=ax, add_colorbar=False) axes.append(ax) fig.colorbar(im, ax=axes[-2:], label='$^\circ$C', extend='both') #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()