#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Thu Oct 22 11:21:38 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 import xtc # if __name__ == '__main__': tt.check('end import') # #start from here # read allstorms tracks file ds = xr.open_dataset('HIRAM.amipHadISST_tigercpu_intelmpi_18_540PE.tc_tracks.allstorms.1971-2018.nc') # filter to keep only TC tracks ds_tc = ds.tc.filter(stormHour=72+12, wcHour=48+12, wcWindContHour=36+12, windthd=17).tc.deflate() # save the TC tracks ofile = 'tc_tracks.TS84-60-48-17.1971-2018.nc' encoding = {data_name:{'dtype': 'float32', 'zlib':True, 'complevel':1} for data_name in list(ds_tc.data_vars)} ds_tc.to_netcdf(ofile, encoding=encoding) if __name__ == '__main__': #from wyconfig import * #my plot settings tt.check(f'**Done**') #plt.show()