#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Thu Aug 24 13:36:37 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 wyplot_lines import wyplot as wyplot_am2p1 from wyplot_lines_MADA_pdsi import wyplot as wyplot_mada # if __name__ == '__main__': tt.check('end import') # #start from here if __name__ == '__main__': from wyconfig import * #my plot settings fig,ax = plt.subplots() wyplot_am2p1(region='North China', ax=ax) wyplot_am2p1(region='Northeast China', ax=ax) #wyplot_am2p1(region='Mongolia', ax=ax) ax2 = ax.twinx() ls = '--' wyplot_mada(region='North China', ax=ax2, ls=ls) wyplot_mada(region='Northeast China', ax=ax2, ls=ls) #wyplot_mada(region='Mongolia', ax=ax2, ls=ls) ax.set_yticks(np.arange(-0.5, 0.51, 0.1)) ax2.set_yticks(np.arange(-2, 2.01, 0.4)) ax.set_ylim(-0.5,0.5) ax2.set_ylim(-2,2) ax2.set_title('') ax2.set_ylabel('MADA PDSI (dashed)') ax.legend() #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()