#!/usr/bin/env python # Wenchang Yang (wenchang@princeton.edu) # Wed Dec 18 23:32:43 EST 2019 import sys, os.path, os, datetime import xarray as xr, numpy as np, pandas as pd #import matplotlib.pyplot as plt from wy_vecchi_indices import sst_to_vecchi_indices #print() ifiles = 'LME_SST/b.e11.B1850C5CN.f19_g16.0850cntl.001.*.nc' fullForcingRef = [False, True][-1] ofile = 'LME_TC.0850cntl.nc' if fullForcingRef: ofile = ofile.replace('.nc', '.fullForcingRef.nc') #sstName = 'SST' #xName = 'nlon' #yName = 'nlat' #latName = 'TLAT' #lonName = 'TLONG' #areaName = 'TAREA' #shiftTimeAxis = True #CESM data time axis is one month late and needs a backward shift yearsRef = slice(1901, 2000) # reference years in calculation of sst anomaly for TC indices #def sst_to_vecchi_indices(ifiles, ofile=None, sstName='SST', xName='nlon', yName='nlat', lonName='TLONG', latName='TLAT', areaName='TAREA', shiftTimeAxis=True, yearsRef=None): if __name__ == '__main__': tformat = '%Y-%m-%d %H:%M:%S' t0 = datetime.datetime.now() print('[start]:', t0.strftime(tformat)) sst_to_vecchi_indices(ifiles, ofile, yearsRef=yearsRef, fullForcingRef=fullForcingRef) t1 = datetime.datetime.now() print('[end]:', t1.strftime(tformat)) print('[total time used]:', f'{(t1-t0).seconds:,} seconds') print()