#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Thu Oct 23 03:05:07 PM EDT 2025 if __name__ == '__main__': import sys,os 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 wython = '/tigress/wenchang/wython' if wython not in sys.path: sys.path.append(wython); print('added to python path:', wython) #from misc import get_kws_from_argv from xtc.distance import tc_distance # if __name__ == '__main__': try: tt.check('end import') except: pass # #start from here ifile = '/projects/w/wenchang/analysis/TC/AM2.5C360/CTL1990s_tigercpu_intelmpi_18_1080PE/netcdf/tc_tracks.TS.0101-0200.nc' lon0, lat0 = 360-80.1918, 25.7617 ds = xr.open_dataset(ifile).load() ds196 = ds.sel(year=196) L = (tc_distance(ds196, lat0, lon0)<50*1000).any('stage') if __name__ == '__main__': from wyconfig import * #my plot settings from geoplots import mapplot fig,ax = plt.subplots(figsize=(8,4)) im = ds196.sel(storm=L).plot.scatter(x='lon', y='lat', c=ds196.sel(storm=L).windmax.values[:,:79], s=20) ax = plt.gca() ax.set_xlim(200, 360) ax.set_ylim(0, 90) mapplot(fill_continents=False) plt.colorbar(im, label='m/s') ax.set_title('TC track from AM2.5C360 CTL1990: year 196, #3 of NA storms') #savefig if 'savefig' in sys.argv or 's' in sys.argv: figname = __file__.replace('.py', f'.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()