#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Thu May 21 11:24:22 EDT 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 from xtc import tc_count from misc.cim import cim, sem #confidence interval of the mean # if __name__ == '__main__': tt.check('end import') #start from here def get_ntc(basin='NA'): #ifile = '/tigress/wenchang/analysis/TC/HIRAM/amipHadISST_tigercpu_intelmpi_18_540PE/netcdf/HIRAM.amipHadISST_tigercpu_intelmpi_18_540PE.tc_tracks.TS.1971-2018.nc' ifile = '/tigress/wenchang/analysis/TC/HIRAM/CTL1990s_v201910_plus2K_tigercpu_intelmpi_18_540PE/netcdf/tc_tracks.TS.0101-0150.nc' ds = xr.open_dataset(ifile) if 'vmax' in ds and 'windmax' not in ds: ds = ds.rename(vmax='windmax') da = ds.pipe(tc_count, basin=basin, ws=17) return da if __name__ == '__main__': from wyconfig import * #my plot settings source = 'HiRAM_plus2K' basin = 'NA' figname = __file__.replace('.py', f'_{basin}_{tt.today()}.png') da = get_ntc(basin=basin) da.groupby('time.year').sum('time').plot() plt.title(source, loc='left') plt.savefig(figname) print('[saved]:', figname) tt.check(f'**Done**') plt.show()