#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Sun Nov 15 00:21:56 EST 2020 if __name__ == '__main__': from misc.timer import Timer tt = Timer(f'start {__file__}') import sys, os.path, os, glob import xarray as xr, numpy as np, pandas as pd #import matplotlib.pyplot as plt #more imports import xtc from geoplots import mapplot # if __name__ == '__main__': tt.check('end import') # #start from here ifile = 'HIRAM.amipHadISST_tigercpu_intelmpi_18_540PE.tc_tracks.allstorms.1971-2018.nc' ds = xr.open_dataset(ifile).sel(en=1) ds_ = ds.tc.selTS(stormHour=72, wcHour=48, wcWindContHour=36, windthd=17, latMax=40) da = ds_.tc.density(genesis_on=True, genesis_condition=(ds_.windmax>17)&(ds_.tm>0)) da_mclim = da.groupby('time.month').mean('time') da_aclim = da_mclim.sum('month').assign_attrs(long_name='TC genesis density', units='# per 10$^\circ$x10$^\circ$ per year') if __name__ == '__main__': from wyconfig import * #my plot settings plt.figure() da_aclim.plot.contourf(levels=np.logspace(-5, 5, 11, base=2)) mapplot() plt.title('HiRAM AMIP 1971-2018, en01, HarrisTracks') tt.check(f'**Done**') plt.show()