#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Thu Mar 4 13:50:28 EST 2021 if __name__ == '__main__': from misc.timer import Timer tt = Timer(f'start {__file__}') import sys, os.path, os, glob, datetime import xarray as xr, numpy as np, pandas as pd, matplotlib.pyplot as plt #more imports from geoplots import mapplot # if __name__ == '__main__': tt.check('end import') # #start from here ifile = '/tigress/wenchang/data/ibtracs/v04r00/analysis/v2/IBTrACS.ALL.v04r00.tracksByYear.1980-2019.nc' ds = xr.open_dataset(ifile) #look for Katrina's track: number 61 storm in 2005 #ds.sel(year=2005).pipe(lambda x: x.where(x.isel(stage=0).month==8)).windmax.max('stage').argmax('storm') #sys.exit() if __name__ == '__main__': from wyconfig import * #my plot settings fig, ax = plt.subplots() ds.sel(year=2005).isel(storm=60) \ .pipe(lambda x: x.assign(windmax0=x.windmax.fillna(0))) \ .plot.scatter(ax=ax, x='lon', y='lat', hue='windmax', markersize='windmax0') mapplot() ax.set_title('Katrina track: 2005-08') figname = __file__.replace('.py', f'_{tt.today()}.png') if len(sys.argv) > 1 and sys.argv[1] == 'savefig': plt.savefig(figname) print('[saved]:', figname) tt.check(f'**Done**') plt.show()