#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Fri Nov 7 01:34:17 PM EST 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 # if __name__ == '__main__': try: tt.check('end import') except: pass # #start from here ifile = 'restore_mask.nc' da = xr.open_dataarray(ifile) if __name__ == '__main__': from wyconfig import * #my plot settings from geoplots import mapplot, yticks2lat fig,axes = plt.subplots(1, 2) ax = axes[0] da.assign_attrs(units='').plot(x='geolon_t', y='geolat_t', levels=11, extend='max', ax=ax) plt.sca(ax) mapplot() ax = axes[1] ax.plot([0, 0, 1, 1, 0, 0], [da.geolat_t.min(), -45, -30, 30, 45, da.geolat_t.max()]) ax.set_xlabel(da.attrs['long_name']) plt.sca(ax) yticks2lat(axes[0].get_yticks()) ax.set_ylim(axes[0].get_ylim()) #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()