#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Wed May 25 13:52:06 EDT 2022 if __name__ == '__main__': import sys from misc.timer import Timer tt = Timer('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 # if __name__ == '__main__': tt.check('end import') # #start from here ifile = 'wind_AM2.5_CTL1990s_tigercpu_intelmpi_18_540PE_0101-0150_monthly.nc' da0 = xr.open_dataarray(ifile).load() ifile = 'wind_HIRAM_CTL1990s_v201910_tigercpu_intelmpi_18_540PE_0101-0150_monthly.nc' da = xr.open_dataarray(ifile).load() if __name__ == '__main__': from wyconfig import * #my plot settings mclim = lambda x: x.groupby('time.month').mean('time') daa = da.pipe(mclim) - da0.pipe(mclim) daa.plot(col='month', col_wrap=6) #savefig if len(sys.argv)>1 and 'savefig' in sys.argv[1:]: figname = __file__.replace('.py', f'.png') if 'overwritefig' in sys.argv[1:]: wysavefig(figname, overwritefig=True) else: wysavefig(figname) tt.check(f'**Done**') print() if 'notshowfig' in sys.argv: pass else: plt.show()