#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Wed May 13 01:09:08 PM EDT 2026 import sys wython = '/tigress/wenchang/wython' if wython not in sys.path: sys.path.append(wython); print('added to python path:', wython) if __name__ == '__main__': 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 #from misc import get_kws_from_argv # if __name__ == '__main__': try: tt.check('end import') except: pass # #start from here #settings isGenesis = True if 'genesis' in sys.argv else False #process ifile = '/projects/w/wenchang/analysis/TC/AM2.5/CTL1990s_solar2pctminus_tigercpu_intelmpi_18_540PE/netcdf/tc_density.TS17.0101-0150.yearly.nc' ds = xr.open_dataset(ifile) if isGenesis: da = ds.density_g else: da = ds.density ifile = '/projects/w/wenchang/analysis/TC/AM2.5/CTL1990s_tigercpu_intelmpi_18_540PE/netcdf/tc_density.TS17.0101-0300.yearly.nc' ds0 = xr.open_dataset(ifile) if isGenesis: da0 = ds0.density_g else: da0 = ds0.density #plot if __name__ == '__main__': from wyconfig import * #my plot settings from geoplots import mapplot xr.set_options(keep_attrs=True) daa = (da.mean('year') - da0.mean('year')) daa.plot() mapplot() #savefig if 'savefig' in sys.argv or 's' in sys.argv: figname = __file__.replace('.py', f'.png') if isGenesis: figname = figname.replace('.png', '__genesis.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()