#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Mon Oct 28 14:32:06 EDT 2024 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 # if __name__ == '__main__': try: tt.check('end import') except: pass # #start from here ifile = 'temp_sfc_correction.nc' da = xr.open_dataarray(ifile).groupby('time.month').mean('time') if __name__ == '__main__': from wyconfig import * #my plot settings from geoplots import mapplot g = da.plot(x='geolon_t', y='geolat_t', col='month', col_wrap=4, robust=True, levels=21, dpi=70) for ax in g.axes.flat: plt.sca(ax) mapplot() ax.set_xlabel('') ax.set_ylabel('') #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()