#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Wed Jun 28 16:18:21 EDT 2023 if __name__ == '__main__': import sys,os from misc.timer import Timer tt = Timer(f'[{os.getcwd()}] start ' + ' '.join(sys.argv)) 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 fig_bars_dprecip_dF import wyplot as plot_bars_deprecip_dF from fig_lines_precip import wyplot as plot_lines_precip # if __name__ == '__main__': tt.check('end import') # #start from here if __name__ == '__main__': from wyconfig import * #my plot settings lowpass_on = True residual_on = False ncol_legend = 2 figsize = 10, 6 fig, axes = plt.subplots(2, 2, figsize=figsize) ax = axes[0,0] plot_bars_deprecip_dF(ax=ax) ax.set_title('(a)') ax = axes[0,1] plot_lines_precip(case='co2x2', TsOption='glbmean', ax=ax, lowpass_on=lowpass_on, residual_on=residual_on, ncol_legend=ncol_legend) #ax.set_title('(b) $T_s$: global mean surface temperature') ax.set_title('(b) $T_s$: GMST') ax = axes[1,0] plot_lines_precip(case='co2x2', TsOption='oceanmean', legend_on=True, ax=ax, lowpass_on=lowpass_on, residual_on=residual_on, ncol_legend=ncol_legend) #ax.set_title('(c) $T_s$: global mean sea surface temperature') ax.set_title('(c) $T_s$: GMSST') ax = axes[1,1] plot_lines_precip(case='co2x2', TsOption='tropoceanmean', legend_on=True, ax=ax, lowpass_on=lowpass_on, residual_on=residual_on, ncol_legend=ncol_legend) #ax.set_title('(d) $T_s$: tropical mean sea surface temperature') ax.set_title('(d) $T_s$: TMSST') for ax in axes.flat[1:]: ax.set_ylim(-3,11) #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) tt.check(f'**Done**') print() if 'notshowfig' in sys.argv or 'n' in sys.argv: pass else: if 'plt' in globals(): plt.show()