#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Mon Jul 3 13:22:33 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_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 figsize = 10, 11 dpi = 80 fig,axes = plt.subplots(4, 2, figsize=figsize, dpi=dpi, sharey='row') #cases = ['co2x2', 'co2x4', 'co2xp5', 'co2xp25'] #labels = ['2xCO2', '4xCO2', '0.5xCO2', '0.25xCO2'] cases = ['p2p0solar', 'p6p0solar', 'm2p0solar', 'm6p0solar'] labels = ['$+2$% solar', '$+6$% solar', '$-2$% solar', '$-6$% solar'] TsOptions = ['glbmean', 'tropoceanmean'] for ii,case in enumerate(cases): for jj,TsOption in enumerate(TsOptions): ax = axes[ii, jj] plot_lines_precip(case=case, TsOption=TsOption, ax=ax, lowpass_on=False, residual_on=False) #ylabel if jj==0: ax.set_ylabel(f'{labels[ii]} global precip change [%]') else: ax.set_ylabel('') #xlabel if ii == 3: ax.set_xlabel('year') else: ax.set_xlabel('') #col title ax = axes[0,0] ax.set_title('$T_s$: global mean surface temperature') ax = axes[0,1] ax.set_title('$T_s$: tropical mean sea surface temperature') #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()