Module load and IBTRACs read in
# close warming info
import warnings
warnings.filterwarnings("ignore")
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
%matplotlib inline
#
from netCDF4 import Dataset
from matplotlib import gridspec
from scipy.optimize import curve_fit
from mpl_toolkits.basemap import Basemap
from datetime import datetime, timedelta
from termcolor import cprint
from matplotlib.patches import Polygon
from matplotlib.colors import BoundaryNorm
from matplotlib.colorbar import Colorbar
from sklearn import preprocessing
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import statsmodels.formula.api as sm
import matplotlib.mlab as mlab
import matplotlib.colors as mcolors
import matplotlib, copy, scipy, scipy.stats, statsmodels, random, glob
import geopy.distance
import statsmodels.api as sm
from statsmodels.stats.outliers_influence import summary_table
from lmfit import Model, Parameters
import cdsapi
import atmos
from pcmin_fullterm import pcmin
from patsy import dmatrices
#from pcmin import pcmin
#from tcpi_allterm import pcmin, pcmin3_kflag
# define the year period
START_YEAR = 1982
END_YEAR = 2019
INDEX_year = np.arange(START_YEAR,END_YEAR+1)
# basin names
BASIN_NAMEs = ['NA','EP','WP','NI','SI','SP','NH','SH','GB']
# Creat CAT_KT that contains the upper and lower winds for different categories
tmp = np.zeros((2,7))
tmp[0,0] = -1000.
tmp[1,0] = 33.
tmp[0,1] = 34.
tmp[1,1] = 63.
tmp[0,2] = 64.
tmp[1,2] = 82.
tmp[0,3] = 83.
tmp[1,3] = 95.
tmp[0,4] = 96.
tmp[1,4] = 112.
tmp[0,5] = 113.
tmp[1,5] = 136.
tmp[0,6] = 137.
tmp[1,6] = 10000.
CAT_KT = pd.DataFrame(tmp,index=['LOWER','UPPER'],columns=['TD','TS','CAT1','CAT2','CAT3','CAT4','CAT5'])
#
ibt = pd.read_csv('./ibtracs.ALL.list.v04r00.csv',skiprows=[1],keep_default_na=False,na_values=[' '])
#C find the duration from INTENSITY_START to INTENSITY_END, duration unit is hour
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', None)
pd.set_option('display.max_colwidth', -1)
Global function define
DEF: trend and CI
from scipy.stats import t
from scipy.signal import detrend
def get_trend_and_ci_weight(X,Y,sample_weight):
X = np.asarray(X)
X_ORIGINAL = X
Y = np.asarray(Y)
sample_weight = np.asarray(sample_weight)
mask = ~np.isnan(X) & ~np.isnan(Y)
X = X[mask]
Y = Y[mask]
sample_weight = sample_weight[mask]
X = sm.add_constant(X)
res = sm.WLS(Y,X,sample_weight).fit()
st, data, ss2 = summary_table(res, alpha=0.05)
fittedvalues = data[:,2]
predict_mean_se = data[:,3]
predict_mean_ci_low, predict_mean_ci_upp = data[:,4:6].T
p=res.pvalues[1]
slope = res.params[1]
intercept = res.params[0]
fittedvalues = slope*X_ORIGINAL + intercept
conf_int_slope = res.params[1]-res.conf_int()[1,0]
if check_autocorrelation_durbin_watson( Y) == False :
df = len(Y) - 2
else:
lagauto = abs(pd.Series(detrend(Y)).autocorr(lag=1))
df = (len(Y) - 2) * ( (1-lagauto)/(1+lagauto) )
return X_ORIGINAL, fittedvalues,slope,res.bse[1] * t.ppf(1 - 0.025, df=df),p
from scipy.stats import t
from scipy.signal import detrend
def get_trend_and_ci_weight_CITHRES(X,Y,sample_weight,CITHRES):
X = np.asarray(X)
X_ORIGINAL = X
Y = np.asarray(Y)
sample_weight = np.asarray(sample_weight)
mask = ~np.isnan(X) & ~np.isnan(Y)
X = X[mask]
Y = Y[mask]
sample_weight = sample_weight[mask]
X = sm.add_constant(X)
res = sm.WLS(Y,X,sample_weight).fit()
st, data, ss2 = summary_table(res, alpha=1-CITHRES)
fittedvalues = data[:,2]
predict_mean_se = data[:,3]
predict_mean_ci_low, predict_mean_ci_upp = data[:,4:6].T
p=res.pvalues[1]
slope = res.params[1]
intercept = res.params[0]
fittedvalues = slope*X_ORIGINAL + intercept
conf_int_slope = res.params[1]-res.conf_int()[1,0]
if check_autocorrelation_durbin_watson( Y) == False :
df = len(Y) - 2
else:
lagauto = abs(pd.Series(detrend(Y)).autocorr(lag=1))
df = (len(Y) - 2) * ( (1-lagauto)/(1+lagauto) )
return X_ORIGINAL, fittedvalues,slope,res.bse[1] * t.ppf(1 - (1-CITHRES)/2, df=df)
from scipy.signal import detrend
from statsmodels.stats.stattools import durbin_watson
def check_autocorrelation_durbin_watson(resids):
xxx = detrend(resids)
dw_output = durbin_watson(xxx,axis=0)
if dw_output>=1.427 and dw_output<=4-1.427:
is_autocorrelated=False
else:
is_autocorrelated=True
return is_autocorrelated
def check_autocorrelation_plot(var):
from statsmodels.graphics.tsaplots import plot_acf
plot_acf(detrend(var))
def poisson_reg(X,Y):
X = np.asarray(X)
Y = np.asarray(Y)
exog, endog = sm.add_constant(X), Y
res = sm.GLM(endog, exog, family=sm.families.Poisson()).fit()
ci = (abs(res.params[1] - res.conf_int()[1][0]) + abs(res.params[1] - res.conf_int()[1][1]))/2
p=res.pvalues[1]
mean = res.params[1]
pred = res.predict()
#print(res.summary())
return pred, mean, ci, p
DEF: moving speed and LMI to LI trajectory length
def CALC_MOVING_SPEED(tmp_lat,tmp_lon):
tmp_u = np.nan * np.zeros(shape=tmp_lat.shape)
tmp_v = np.nan * np.zeros(shape=tmp_lat.shape)
tmp_uv = np.nan * np.zeros(shape=tmp_lat.shape)
tmp_tra= np.zeros(shape=tmp_lat.shape)
for RRR in range(len(tmp_lat)-1):
coords_1 = (tmp_lat[RRR+1], tmp_lon[RRR])
coords_2 = (tmp_lat[RRR] , tmp_lon[RRR])
# poleward speed is positive
tmp_v[RRR] = np.sign(np.abs(tmp_lat[RRR+1])-np.abs(tmp_lat[RRR]))*geopy.distance.vincenty(coords_1, coords_2).m/3./3600.
coords_1 = (tmp_lat[RRR ], tmp_lon[RRR ])
coords_2 = (tmp_lat[RRR+1], tmp_lon[RRR+1])
##
# here RRR+1 means we calculate the velocity and distance moved in the PAST 3 hrs
##
tmp_tra [RRR+1] = geopy.distance.vincenty(coords_1, coords_2).km
tmp_uv [RRR+1] = tmp_tra [RRR+1]*1e3/3./3600.
# westward speed is positive
tmp_u[RRR+1] = -np.sign(tmp_lon[RRR+1]-tmp_lon[RRR])*np.sqrt(tmp_uv[RRR+1]**2-tmp_v[RRR+1]**2)
return tmp_u,tmp_v,tmp_uv,tmp_tra
DEF: bootstrap
def bootstrapping_compare_mean_CI_star(sample1,sample2,CI_THRES):
sample1 = np.asarray(sample1)
sample2 = np.asarray(sample2)
DIFF_MEAN_RESAMPLE = []
for LLL in range(10000):
resample1=np.random.choice(sample1,size=sample1.shape,replace=True)
resample2=np.random.choice(sample2,size=sample2.shape,replace=True)
DIFF_MEAN_RESAMPLE.extend([np.nanmean(resample2) - np.nanmean(resample1)])
output_ci1 = scipy.stats.scoreatpercentile(DIFF_MEAN_RESAMPLE,(100.-CI_THRES)/2.)
output_ci2 = scipy.stats.scoreatpercentile(DIFF_MEAN_RESAMPLE,100.-(100.-CI_THRES)/2.)
return np.nanmean(DIFF_MEAN_RESAMPLE)-output_ci1,output_ci2-np.nanmean(DIFF_MEAN_RESAMPLE),np.nanmean(DIFF_MEAN_RESAMPLE)
DEF: bootstrap2
def bootstrapping_compare_halfchange(sample1,sample2):
sample1_0 = np.asarray(sample1[:len(sample1)//2])
sample1_1 = np.asarray(sample1[len(sample1)//2:])
DIFF_MEAN_RESAMPLE_1 = []
for LLL in range(100):
resample1_0=np.random.choice(sample1_0,size=sample1_0.shape,replace=True)
resample1_1=np.random.choice(sample1_1,size=sample1_0.shape,replace=True)
DIFF_MEAN_RESAMPLE_1.extend([np.nanmean(resample1_1) - np.nanmean(resample1_0)])
sample2_0 = np.asarray(sample2[:len(sample2)//2])
sample2_1 = np.asarray(sample2[len(sample2)//2:])
DIFF_MEAN_RESAMPLE_2 = []
for LLL in range(100):
resample2_0=np.random.choice(sample2_0,size=sample2_0.shape,replace=True)
resample2_1=np.random.choice(sample2_1,size=sample2_0.shape,replace=True)
DIFF_MEAN_RESAMPLE_2.extend([np.nanmean(resample2_1) - np.nanmean(resample2_0)])
DIFF_MEAN_RESAMPLE_1 = np.asarray(DIFF_MEAN_RESAMPLE_1)
DIFF_MEAN_RESAMPLE_2 = np.asarray(DIFF_MEAN_RESAMPLE_2)
plt.hist([DIFF_MEAN_RESAMPLE_1,DIFF_MEAN_RESAMPLE_2])
stats,p = scipy.stats.ttest_ind(DIFF_MEAN_RESAMPLE_1,DIFF_MEAN_RESAMPLE_2)
return np.nanmean(DIFF_MEAN_RESAMPLE_2),np.nanmean(DIFF_MEAN_RESAMPLE_1),np.nanmean(DIFF_MEAN_RESAMPLE_2)-np.nanmean(DIFF_MEAN_RESAMPLE_1),p
chi2 poisson distribution fit text
def chi2_poisson_fit(data):
from scipy.optimize import curve_fit
from scipy.special import factorial
from scipy.stats import poisson
# the bins should be of integer width, because poisson is an integer distribution
bins = np.arange(np.nanmin(data),np.nanmax(data)+2) - 0.5
entries, bin_edges, patches = plt.hist(data, bins=bins, density=True, label='Data')
# calculate bin centres
bin_middles = 0.5 * (bin_edges[1:] + bin_edges[:-1])
def fit_function(k, lamb):
'''poisson function, parameter lamb is the fit parameter'''
return poisson.pmf(k, lamb)
# fit with curve_fit
parameters, cov_matrix = curve_fit(fit_function, bin_middles, entries,p0=[5])
# plot poisson-deviation with fitted parameter
x_plot = np.arange(np.nanmin(data), np.nanmax(data)+1)
#_=plt.plot(
# x_plot,
# fit_function(x_plot, *parameters),
# marker='o', linestyle='',
# label='Fit result',
#)
#_=plt.legend()
Nexp = fit_function(bin_middles, *parameters)
entries = entries * len(Y)
Nexp = Nexp * len(Y)
r = entries - Nexp
chisq = np.sum(r**2/Nexp)
df = len(data) - 2
return print("chisq =",chisq,"df =",df)
Data pre processing
The filters are:
newbt is the new cleaned variable
newbt_lf is the new cleaned landfall TCs
newbt_nonlf is the new cleaned non landfall TCs
def index_for_last_max(x):
x=np.asarray(x)
return len(x)-np.nanargmax(x[::-1])-1
def mark_landfall(x):
DIST2LAND = x.DIST2LAND.values[:]
WIND = x.USA_WIND.values[:]
# use 1 to mark landfall time after the last LMI
LF_MARKER = np.zeros(shape=DIST2LAND.shape)
for RRR in range(index_for_last_max(WIND),len(WIND)):
if DIST2LAND[RRR]==0 and DIST2LAND[RRR-1]>0.:
LF_MARKER[RRR] = 1
x['LF_MARKER'] = list(LF_MARKER)
return x
def lf_after_lmi(x):
RRR_LMI= x.iloc[::-1].USA_WIND.idxmax()
tmp_x=x[x.LF_MARKER==1]
RRR_LF = tmp_x.USA_WIND.idxmax()
output_wind = [];
if RRR_LF-RRR_LMI >= 0 :
return True
else:
return False
print("Strongest LI before the last LMI!!!!:",x.SID.values[0])
newbt = ibt[(ibt.SEASON >= START_YEAR)&(ibt.SEASON <= END_YEAR)]
newbt = newbt[newbt.BASIN!='SA']
newbt = newbt[np.abs(newbt.USA_LAT) <= 40]
newbt = newbt[
newbt.ISO_TIME.str.contains('00:00:00') |
newbt.ISO_TIME.str.contains('03:00:00') |
newbt.ISO_TIME.str.contains('06:00:00') |
newbt.ISO_TIME.str.contains('09:00:00') |
newbt.ISO_TIME.str.contains('12:00:00') |
newbt.ISO_TIME.str.contains('15:00:00') |
newbt.ISO_TIME.str.contains('18:00:00') |
newbt.ISO_TIME.str.contains('21:00:00')
]
newbt = newbt.groupby('SID').filter(lambda x: np.nanmax(x.USA_WIND) >= CAT_KT.CAT1.LOWER)
newbt = newbt[~np.isnan(newbt.USA_WIND.values)]
newbt = newbt.groupby('SID').apply (lambda x: mark_landfall(x))
# lf
newbt_lf = newbt .groupby('SID').filter(lambda x: np.any(x.LF_MARKER == 1))
newbt_lf = newbt_lf.groupby('SID').filter(lambda x: lf_after_lmi(x))
# non lf
newbt_nonlf = newbt .groupby('SID').filter(lambda x: np.all(x.LF_MARKER != 1))
Check annual number
TABLE = pd.DataFrame(index=list(INDEX_year)+list(['Total']),columns=BASIN_NAMEs)
for YYY,YEAR in enumerate(INDEX_year):
for BBB,BASIN in enumerate(BASIN_NAMEs[:-3]):
TABLE.iloc[YYY,BBB] = newbt_lf[(newbt_lf.SEASON==YEAR)&(newbt_lf.BASIN==BASIN)].groupby('SID').ngroups
TABLE.iloc[-1,0:6] = np.sum(TABLE.iloc[:-1,0:6])
TABLE.iloc[:,6] = np.sum(TABLE.iloc[:,:4],axis=1).astype(int)
TABLE.iloc[:,7] = np.sum(TABLE.iloc[:,4:6],axis=1).astype(int)
TABLE.iloc[:,8] = np.sum(TABLE.iloc[:,6:8],axis=1).astype(int)
TABLE
| NA | EP | WP | NI | SI | SP | NH | SH | GB | |
|---|---|---|---|---|---|---|---|---|---|
| 1982 | 0 | 1 | 13 | 2 | 2 | 1 | 16 | 3 | 19 |
| 1983 | 2 | 4 | 8 | 0 | 1 | 1 | 14 | 2 | 16 |
| 1984 | 2 | 4 | 4 | 2 | 3 | 1 | 12 | 4 | 16 |
| 1985 | 5 | 1 | 11 | 0 | 2 | 2 | 17 | 4 | 21 |
| 1986 | 1 | 3 | 7 | 0 | 1 | 2 | 11 | 3 | 14 |
| 1987 | 2 | 1 | 8 | 1 | 0 | 1 | 12 | 1 | 13 |
| 1988 | 4 | 2 | 6 | 1 | 2 | 2 | 13 | 4 | 17 |
| 1989 | 3 | 3 | 13 | 1 | 3 | 2 | 20 | 5 | 25 |
| 1990 | 1 | 2 | 15 | 1 | 1 | 1 | 19 | 2 | 21 |
| 1991 | 0 | 0 | 9 | 1 | 0 | 1 | 10 | 1 | 11 |
| 1992 | 1 | 4 | 12 | 3 | 1 | 2 | 20 | 3 | 23 |
| 1993 | 1 | 5 | 15 | 2 | 0 | 0 | 23 | 0 | 23 |
| 1994 | 1 | 1 | 11 | 1 | 4 | 0 | 14 | 4 | 18 |
| 1995 | 4 | 1 | 11 | 4 | 3 | 0 | 20 | 3 | 23 |
| 1996 | 4 | 6 | 9 | 2 | 6 | 1 | 21 | 7 | 28 |
| 1997 | 1 | 4 | 11 | 1 | 3 | 3 | 17 | 6 | 23 |
| 1998 | 5 | 1 | 9 | 5 | 0 | 0 | 20 | 0 | 20 |
| 1999 | 3 | 1 | 7 | 3 | 5 | 2 | 14 | 7 | 21 |
| 2000 | 2 | 0 | 7 | 2 | 6 | 1 | 11 | 7 | 18 |
| 2001 | 2 | 1 | 11 | 2 | 1 | 0 | 16 | 1 | 17 |
| 2002 | 3 | 1 | 6 | 0 | 3 | 0 | 10 | 3 | 13 |
| 2003 | 3 | 4 | 9 | 0 | 2 | 1 | 16 | 3 | 19 |
| 2004 | 5 | 1 | 13 | 3 | 5 | 1 | 22 | 6 | 28 |
| 2005 | 9 | 1 | 12 | 0 | 2 | 1 | 22 | 3 | 25 |
| 2006 | 1 | 2 | 11 | 2 | 2 | 2 | 16 | 4 | 20 |
| 2007 | 4 | 1 | 11 | 3 | 7 | 0 | 19 | 7 | 26 |
| 2008 | 5 | 1 | 9 | 1 | 5 | 0 | 16 | 5 | 21 |
| 2009 | 1 | 2 | 9 | 1 | 3 | 0 | 13 | 3 | 16 |
| 2010 | 4 | 0 | 7 | 3 | 3 | 2 | 14 | 5 | 19 |
| 2011 | 3 | 1 | 7 | 1 | 2 | 1 | 12 | 3 | 15 |
| 2012 | 4 | 2 | 11 | 0 | 4 | 0 | 17 | 4 | 21 |
| 2013 | 2 | 2 | 10 | 4 | 2 | 1 | 18 | 3 | 21 |
| 2014 | 0 | 3 | 8 | 1 | 1 | 1 | 12 | 2 | 14 |
| 2015 | 1 | 4 | 11 | 2 | 4 | 3 | 18 | 7 | 25 |
| 2016 | 4 | 3 | 12 | 1 | 1 | 1 | 20 | 2 | 22 |
| 2017 | 6 | 1 | 9 | 1 | 2 | 2 | 17 | 4 | 21 |
| 2018 | 3 | 4 | 11 | 4 | 2 | 1 | 22 | 3 | 25 |
| 2019 | 1 | 1 | 10 | 2 | 2 | 2 | 14 | 4 | 18 |
| Total | 103 | 79 | 373 | 63 | 96 | 42 | 618 | 138 | 756 |
get ADT_HURSAT ready
def from_lmi_to_lf(x):
RRR_LMI= x.iloc[::-1].USA_WIND.idxmax()
tmp_x=x[x.LF_MARKER==1]
RRR_LF = tmp_x.USA_WIND.idxmax()
output_wind = [];
pick = x[(x.index>=RRR_LMI)&(x.index<=RRR_LF)]
output_wind = pick.USA_WIND.values[:]
output_wind = np.asarray(output_wind)
output_lat = pick.USA_LAT.values[:]
output_lat = np.asarray(output_lat )
output_lon = pick.USA_LON.values[:]
output_lon = np.asarray(output_lon )
return x.USA_WIND.max(),output_wind, x.SEASON.values[0],x[x.index==RRR_LMI].DIST2LAND.values[0],x.SID.values[0],output_lat,output_lon,x[x.index==RRR_LMI].BASIN.values[0]
VMAX_PMIN_SERIES = newbt_lf.groupby('SID').apply(lambda x: from_lmi_to_lf(x))
VMAX_PMIN_SERIES = VMAX_PMIN_SERIES.dropna()
def nonlandfall_lmi(x):
RRR_LMI= x.iloc[::-1].USA_WIND.idxmax()
return x[x.index==RRR_LMI].USA_WIND.values[0],x[x.index==RRR_LMI].SEASON.values[0],x[x.index==RRR_LMI].BASIN.values[0]
VMAX_NONLF = newbt_nonlf.groupby('SID').apply(lambda x: nonlandfall_lmi(x))
VMAX_NONLF = VMAX_NONLF.dropna()
speed_inverse = []
trajectory_inverse = []
trajectory_inverse_delta = []
lat_LMI_inverse = []
lat_LI_inverse = []
for CCC in range(len(VMAX_PMIN_SERIES)):
_,_,tmp_uv,tmp_tra = CALC_MOVING_SPEED(VMAX_PMIN_SERIES[CCC][5],VMAX_PMIN_SERIES[CCC][6])
speed_inverse .extend([np.nanmean(tmp_uv)])
trajectory_inverse .extend([np.nansum(tmp_tra)])
trajectory_inverse_delta .append(tmp_tra)
lat_LMI_inverse .extend([abs(VMAX_PMIN_SERIES[CCC][5][0])])
lat_LI_inverse .extend([abs(VMAX_PMIN_SERIES[CCC][5][-1])])
speed_inverse = np.asarray(speed_inverse)
trajectory_inverse = np.asarray(trajectory_inverse)
lat_LMI_inverse = np.asarray(lat_LMI_inverse)
lat_LI_inverse = np.asarray(lat_LI_inverse)
time_inverse_calc = []
test = []
for CCC in range(len(VMAX_PMIN_SERIES)):
# set what kind of translation speed you want: case variable or global mean
#tmp = trajectory_inverse_delta[CCC]*1e3 / speed_inverse[CCC]
tmp = trajectory_inverse_delta[CCC]*1e3 / np.nanmean(speed_inverse)
tmptmp = []
for RRR in range(0,len(trajectory_inverse_delta[CCC])):
tmptmp.extend([np.nansum(tmp[:RRR+1])])
time_inverse_calc.append(tmptmp)
test.extend([tmptmp[-1]/3600])
test = np.asarray(test)
def func_linear(x,A,B):
return A-B*x
def func_exp(x,A,B):
return A*np.exp(-B*x)
def func_inverse(x,A,B):
return 1./(1./A+B*x)
#
def fit_decay(vmax_in,METHOD,year_in,t_in):
epsilon = 1e-10
vmax_in = np.asarray(vmax_in) * .51444
#
if METHOD == 'INVERSE':
gmodel = Model(func_inverse)
pars = Parameters()
if len(vmax_in) == 1:
pars.add('A' , value=vmax_in[0] , min=0. , max=vmax_in[0]*2 , vary=False)
else:
# change this line if want to vary LMI in the fit
pars.add('A' , value=vmax_in[0] , min=0. , max=vmax_in[0]*2 , vary=False)
pars.add('B' , value=1e-7 , min=2e-8 , max=6e-7 , vary=True)
#
result = gmodel.fit(vmax_in, pars, x=t_in )
vmax_pred = result.best_fit
#
A = result.params.valuesdict()['A']
B = result.params.valuesdict()['B']
if (result.params['B'].stderr == None):
B_sd = np.nan
else:
B_sd = result.params['B'].stderr
slope, intercept, r_value, p_value, std_err = scipy.stats.linregress(vmax_in, vmax_pred)
rmse = np.sqrt(np.mean((vmax_pred-vmax_in)**2))
bias = np.mean(vmax_pred-vmax_in)
rmse_lf = abs(vmax_pred[-1]-vmax_in[-1])
bias_lf = (vmax_pred[-1]-vmax_in[-1])
interp_vmax_in = np.interp(np.linspace((np.arange(len(vmax_in))*6.*3600)[0],(np.arange(len(vmax_in))*6.*3600)[-1],11),(np.arange(len(vmax_in))*6.*3600),vmax_in )
interp_vmax_pred = np.interp(np.linspace(t_in[0],t_in[-1],11),t_in,vmax_pred)
return r_value**2, p_value, rmse, bias, A, B, rmse_lf, bias_lf, year_in,interp_vmax_in,interp_vmax_pred,vmax_in,vmax_pred, B_sd
r_value_linear = []; p_value_linear = []; rmse_linear = []; bias_linear = []; A_linear = []; B_linear = []; rmself_linear = []; biaslf_linear = []; year_linear = []; dur_linear = []; hl_linear = [];interp_vmax_in_linear =[];interp_vmax_pred_linear =[];vmax_in_linear =[];vmax_pred_linear =[];
r_value_exp = []; p_value_exp = []; rmse_exp = []; bias_exp = []; A_exp = []; B_exp = []; rmself_exp = []; biaslf_exp = []; year_exp = []; dur_exp = []; hl_exp = [];interp_vmax_in_exp =[];interp_vmax_pred_exp =[];vmax_in_exp =[];vmax_pred_exp =[];
r_value_inverse= []; p_value_inverse= []; rmse_inverse= []; bias_inverse= []; A_inverse= []; B_inverse= []; rmself_inverse= []; biaslf_inverse= []; year_inverse= []; dur_inverse= []; hl_inverse= [];interp_vmax_in_inverse=[];interp_vmax_pred_inverse=[];vmax_in_inverse=[];vmax_pred_inverse=[];B_sd_inverse=[];
r_value_inverse_dis= []; p_value_inverse_dis= []; rmse_inverse_dis= []; bias_inverse_dis= []; A_inverse_dis= []; B_inverse_dis= []; rmself_inverse_dis= []; biaslf_inverse_dis= []; year_inverse_dis= []; dur_inverse_dis= []; hl_inverse_dis= [];interp_vmax_in_inverse_dis=[];interp_vmax_pred_inverse_dis=[];vmax_in_inverse_dis=[];vmax_pred_inverse_dis=[];B_sd_inverse_dis=[];
#for CAT in range(len(tmp_vmax)): #range(len(tmp_vmax)): [2,3,4]: [0,1]:
if 1==1:
for CCC in range(len(VMAX_PMIN_SERIES)):
r_value, p_value, rmse, bias, A, B, rmse_lf, bias_lf, year_lf, interp_vmax_in,interp_vmax_pred,vmax_in,vmax_pred, B_sd = fit_decay(VMAX_PMIN_SERIES[CCC][1],'INVERSE',VMAX_PMIN_SERIES[CCC][2],np.arange(len(VMAX_PMIN_SERIES[CCC][1])) * 3 * 3600)
#
r_value_inverse.extend([r_value])
p_value_inverse.extend([p_value])
rmse_inverse .extend([rmse ])
bias_inverse .extend([bias ])
A_inverse .extend([A ])
B_inverse .extend([B ])
B_sd_inverse .extend([B_sd ])
rmself_inverse .extend([rmse_lf])
biaslf_inverse .extend([bias_lf])
year_inverse .extend([year_lf])
dur_inverse .extend([3*(len(VMAX_PMIN_SERIES[CCC][1])-1)])
hl_inverse .extend([3*np.nanargmin(abs(VMAX_PMIN_SERIES[CCC][1]-VMAX_PMIN_SERIES[CCC][1]/2))])
interp_vmax_in_inverse .append(interp_vmax_in)
interp_vmax_pred_inverse.append(interp_vmax_pred)
vmax_in_inverse .append(vmax_in)
vmax_pred_inverse.append(vmax_pred)
#
r_value, p_value, rmse, bias, A, B, rmse_lf, bias_lf, year_lf, interp_vmax_in,interp_vmax_pred,vmax_in,vmax_pred, B_sd = fit_decay(VMAX_PMIN_SERIES[CCC][1],'INVERSE',VMAX_PMIN_SERIES[CCC][2],time_inverse_calc[CCC])
#
r_value_inverse_dis.extend([r_value])
p_value_inverse_dis.extend([p_value])
rmse_inverse_dis .extend([rmse ])
bias_inverse_dis .extend([bias ])
A_inverse_dis .extend([A ])
B_inverse_dis .extend([B ])
B_sd_inverse_dis .extend([B_sd ])
rmself_inverse_dis .extend([rmse_lf])
biaslf_inverse_dis .extend([bias_lf])
year_inverse_dis .extend([year_lf])
dur_inverse_dis .extend([3*(len(VMAX_PMIN_SERIES[CCC][1])-1)])
hl_inverse_dis .extend([3*np.nanargmin(abs(VMAX_PMIN_SERIES[CCC][1]-VMAX_PMIN_SERIES[CCC][1]/2))])
interp_vmax_in_inverse_dis .append(interp_vmax_in)
interp_vmax_pred_inverse_dis.append(interp_vmax_pred)
vmax_in_inverse_dis .append(vmax_in)
vmax_pred_inverse_dis.append(vmax_pred)
B_inverse = np.asarray(B_inverse)
dur_inverse = np.asarray(dur_inverse)
B_inverse[dur_inverse==0] = np.nan
speed_inverse[dur_inverse==0] = np.nan
$y=V_o-Bt \quad$ $y=V_oe^{-Bt} \quad$ $y=\frac{1}{\frac{1}{V_o}+Bt}$
def fit_test(AREA):
tmp_r = []
tmp_rmse = []
tmp_bias = []
tmp_maelf = []
tmp_biaslf = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA) & (dur_inverse[CCC]>3): # dur_inverse[CCC]==3 means there is only one intensity reading during decay, ie having last LMI at landfall
tmp_r .extend([r_value_inverse_dis [CCC] ])
tmp_rmse .extend([rmse_inverse_dis [CCC] ])
tmp_bias .extend([bias_inverse_dis [CCC] ])
tmp_maelf .extend([rmself_inverse_dis [CCC] ])
tmp_biaslf .extend([biaslf_inverse_dis [CCC] ])
return np.round(np.nanmean(tmp_r),2),np.round(np.nanmean(tmp_rmse)),np.round(np.nanmean(tmp_bias)),np.round(np.nanmean(tmp_maelf)),np.round(np.nanmean(tmp_biaslf))
TABLE = pd.DataFrame(index=['r2','rmse (m s$^{-1}$)','bias (m s$^{-1}$)','mae (m s$^{-1}$) LF','bias (m s$^{-1}$) LF'],columns=['Global','NH','SH','WP','EP','NA','NI','SI','SP'])
for BBB,AREA in enumerate( [
['WP','EP','NA','NI','SI','SP'],
['WP','EP','NA','NI'],
['SI','SP'],
['WP'],
['EP'],
['NA'],
['NI'],
['SI'],
['SP'],
]):
output1,output2,output3,output4,output5 = fit_test(AREA)
TABLE.iloc[0,BBB] = output1
TABLE.iloc[1,BBB] = output2
TABLE.iloc[2,BBB] = output3
TABLE.iloc[3,BBB] = output4
TABLE.iloc[4,BBB] = output5
TABLE
| Global | NH | SH | WP | EP | NA | NI | SI | SP | |
|---|---|---|---|---|---|---|---|---|---|
| r2 | 0.87 | 0.87 | 0.88 | 0.89 | 0.85 | 0.77 | 0.91 | 0.87 | 0.88 |
| rmse (m s$^{-1}$) | 2 | 2 | 2 | 2 | 3 | 3 | 2 | 2 | 3 |
| bias (m s$^{-1}$) | -0 | -0 | 0 | -0 | -0 | -0 | -0 | 0 | 0 |
| mae (m s$^{-1}$) LF | 3 | 3 | 3 | 3 | 4 | 4 | 4 | 3 | 4 |
| bias (m s$^{-1}$) LF | 2 | 2 | 2 | 2 | 2 | -0 | 2 | 1 | 3 |
def from_lmi_to_lf(x):
RRR_LMI= x.iloc[::-1].USA_WIND.idxmax()
tmp_x=x[x.LF_MARKER==1]
RRR_LF = tmp_x.USA_WIND.idxmax()
output_wind = [];
pick = x[(x.index>=RRR_LMI)&(x.index<=RRR_LF)]
output_wind = pick.USA_WIND.values[:]
output_wind = np.asarray(output_wind)
output_lat = pick.USA_LAT.values[:]
output_lat = np.asarray(output_lat )
output_lon = pick.USA_LON.values[:]
output_lon = np.asarray(output_lon )
return x.USA_WIND.max(),output_wind, x.SEASON.values[0],x[x.index==RRR_LMI].DIST2LAND.values[0],x.SID.values[0],output_lat,output_lon,x[x.index==RRR_LMI].BASIN.values[0]
VMAX_PMIN_SERIES = newbt_lf.groupby('SID').apply(lambda x: from_lmi_to_lf(x))
VMAX_PMIN_SERIES = VMAX_PMIN_SERIES.dropna()
fig,ax=plt.subplots(1,2); fig.set_size_inches(7,3); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.3,hspace=0.3); fontsize = 8
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]*.514444])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
tmp_LMI = np.asarray(Y)
_=ax[0].plot(X,Y,'-',color='b',lw=1)
x_trend, y_trend,slope,ci,_ = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[0].plot(x_trend,y_trend,'-',lw=3,color='b',label='LMI ('+str(round(slope*10,1))+'±'+str(round(ci*10,1))+' m s$^{-1}$ decade$^{-1}$)')
#_=ax.fill_between(x_trend, ci_down, ci_up, facecolor='C0', alpha=.2, edgecolor='none', interpolate=True)
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
#tmp = np.asarray(tmp)
#tmp [(tmp>=33)] = np.nan
Y.extend([np.nanmean(tmp)])
sample_weight.extend([sum(~np.isnan(tmp))])
tmp_LI = np.asarray(Y)
_=ax[0].plot(X,Y,'-',color='r',lw=1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
print(p)
_=ax[0].plot(x_trend,y_trend,'-',lw=3,color='r',label='LI ('+str(round(slope*10,1))+'±'+str(round(ci*10,1))+' m s$^{-1}$ decade$^{-1}$)')
#_=ax.fill_between(x_trend, ci_down, ci_up, facecolor='C1', alpha=.2, edgecolor='none', interpolate=True)
_=ax[0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[0].legend(fontsize=fontsize,loc=2)
_=ax[0].set_xticks(range(1980,2021,5))
_=ax[0].set_ylim([25,70])
_=ax[0].set_xlim([1980,2020])
_=ax[0].set_xlabel('Year',fontsize=fontsize)
_=ax[0].set_ylabel('Observed intensity (m s$^{-1}$)',fontsize=fontsize)
_=ax[0].text(1973,70,'(a)',fontsize=fontsize+2,fontweight='bold')
#----------------------------------------------------------------------------------------------------------
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]])
Y.extend([sum(np.asarray(tmp)>=96)])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
_=ax[1].plot(X,Y,'-',color='C0',lw=1,zorder=6)
x_trend, y_trend,slope,ci,_ = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[1].plot(x_trend,y_trend,'-',lw=3,color='C0',label='Major LMI ('+str(round(slope*10,1))+'±'+str(round(ci*10,1))+' count decade$^{-1}$)',zorder=7)
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]])
Y.extend([sum(np.asarray(tmp)>=96)])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
_=ax[1].plot(X,Y,'-',color='C1',lw=1,zorder=6)
x_trend, y_trend,slope,ci,_ = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[1].plot(x_trend,y_trend,'-',lw=3,color='C1',label='Major LI ('+str(round(slope*10,1))+'±'+str(round(ci*10,1))+' count decade$^{-1}$)',zorder=7)
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]])
Y.extend([sum(np.asarray(tmp)>=135)])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
_=ax[1].plot(X,Y,'-',color='gray',lw=1,zorder=6)
x_trend, y_trend,slope,ci,_ = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[1].plot(x_trend,y_trend,'-',lw=3,color='gray',label='CAT-5 LMI ('+str(round(slope*10,1))+'±'+str(round(ci*10,1))+' count decade$^{-1}$)',zorder=7)
_=ax[1].legend(fontsize=fontsize)
_=ax[1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[1].legend(fontsize=fontsize,loc=2)
_=ax[1].set_xticks(range(1980,2021,5))
_=ax[1].set_ylim([0,24])
_=ax[1].set_yticks(np.arange(0,25,3))
_=ax[1].set_xlim([1980,2020])
_=ax[1].set_xlabel('Year',fontsize=fontsize)
_=ax[1].set_ylabel('Global TC counts',fontsize=fontsize)
_=ax[1].text(1973,24,'(b)',fontsize=fontsize+2,fontweight='bold')
plt.savefig('/home/sw1013/www/FIGURES/Figure_1.png',dpi=600,bbox_inches='tight')
#plt.savefig('/home/sw1013/www/FIGURES/Figure_1.pdf',dpi=600,bbox_inches='tight')
0.18419597367047671
fig,ax=plt.subplots(1,3); fig.set_size_inches(7,3); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.4,hspace=0.4); fontsize = 8
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]])
Y.extend([sum(np.asarray(tmp)>=96)]) #96
sample_weight.extend([1])
tmp_LI = np.asarray(Y)
_=ax.flatten()[0].plot(X,Y,'-',color='k',lw=1,zorder=6)
#x_trend, y_trend,slope,ci = get_trend_and_ci_weight(X,Y,sample_weight)
#_=ax.plot(x_trend,y_trend,'-',lw=3,color='k',label=str(round(slope*10,1))+'±'+str(round(ci*10,1))+' count decade$^{-1}$',zorder=7)
pred, mean, ci, p = poisson_reg(X,Y)
STR = ''
if abs(ci)<=abs(mean):
STR = ' ($p$<0.05)'
_=ax.flatten()[0].plot(X,pred,'-',color='k',lw=3,label='$T_D$='+str(round(np.log(2)/mean).astype(int))+' year'+STR,zorder=7)
print('β='+str(round(mean,3))+'±'+str(round(ci,3)),'p='+str(round(p,4)))
print(np.log(2)/(mean+ci),np.log(2)/(mean-ci))
_=ax.flatten()[0].legend(fontsize=fontsize)
_=ax.flatten()[0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[0].legend(fontsize=fontsize,loc=2)
_=ax.flatten()[0].set_xticks(range(1980,2021,10))
_=ax.flatten()[0].xaxis.set_minor_locator(plt.MultipleLocator(5))
_=ax.flatten()[0].set_ylim([0,8])
_=ax.flatten()[0].set_yticks(np.arange(0,9,1))
_=ax.flatten()[0].set_xlim([1980,2020])
_=ax.flatten()[0].set_xlabel('Year',fontsize=fontsize)
_=ax.flatten()[0].set_ylabel('Counts of global landfalling TCs\n(LI≥50 m s$^{-1}$)',fontsize=fontsize)
_=ax.flatten()[0].text(1967,8,'(A)',fontsize=fontsize+2,fontweight='bold')
# scipy.stats.kstest(preprocessing.scale(y_trend-Y),'norm')
# check_autocorrelation_durbin_watson(y_trend-Y)
# scipy.stats.kstest(preprocessing.scale(pred-Y),'norm')
# check_autocorrelation_durbin_watson(pred-Y)
#----------------------------------------------------------------------------------------------------------
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]])
Y.extend([sum(np.asarray(tmp)>=96)])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
YYYYYY = Y
_=ax.flatten()[1].plot(X,Y,'-',color='k',lw=1,zorder=6)
#x_trend, y_trend,slope,ci = get_trend_and_ci_weight(X,Y,sample_weight)
#_=ax[0].plot(x_trend,y_trend,'-',lw=3,color='k',label=str(round(slope*10,1))+'±'+str(round(ci*10,1))+' count decade$^{-1}$',zorder=7)
pred, mean, ci, p = poisson_reg(X,Y)
STR = ''
if abs(ci)<=abs(mean):
STR = ' ($p$<0.05)'
_=ax.flatten()[1].plot(X,pred,'-',color='k',lw=3,label='$T_D$='+str(round(np.log(2)/mean).astype(int))+' year'+STR,zorder=7)
print('β='+str(round(mean,3))+'±'+str(round(ci,3)))
_=ax.flatten()[1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[1].legend(fontsize=fontsize,loc=2)
_=ax.flatten()[1].set_xticks(range(1980,2021,10))
_=ax.flatten()[1].xaxis.set_minor_locator(plt.MultipleLocator(5))
_=ax.flatten()[1].set_ylim([3,21])
_=ax.flatten()[1].set_yticks(np.arange(3,22,2))
_=ax.flatten()[1].set_xlim([1980,2020])
_=ax.flatten()[1].set_xlabel('Year',fontsize=fontsize)
_=ax.flatten()[1].set_ylabel('Counts of global landfalling TCs\n(LMI≥50 m s$^{-1}$)',fontsize=fontsize)
_=ax.flatten()[1].legend(fontsize=fontsize)
_=ax.flatten()[1].text(1967,21,'(B)',fontsize=fontsize+2,fontweight='bold')
# scipy.stats.kstest(preprocessing.scale(y_trend-Y),'norm')
# check_autocorrelation_durbin_watson(y_trend-Y)
# scipy.stats.kstest(preprocessing.scale(pred-Y),'norm')
# check_autocorrelation_durbin_watson(pred-Y)
#----------------------------------------------------------------------------------------------
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp1 = []
tmp2 = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp1.extend([VMAX_PMIN_SERIES[CCC][1][0]])
tmp2.extend([VMAX_PMIN_SERIES[CCC][1][-1]])
if sum(np.asarray(tmp1)>=96) == 0:
Y.extend([np.nan])
else:
Y.extend([sum(np.asarray(tmp2)>=96) / sum(np.asarray(tmp1)>=96) * 100])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
YYYYYY = Y
_=ax.flatten()[2].plot(X,Y,'-',color='k',lw=1,zorder=6)
#x_trend, y_trend,slope,ci = get_trend_and_ci_weight(X,Y,sample_weight)
#_=ax[0].plot(x_trend,y_trend,'-',lw=3,color='k',label=str(round(slope*10,1))+'±'+str(round(ci*10,1))+' count decade$^{-1}$',zorder=7)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
STR = ''
if abs(ci)<=abs(mean):
STR = ' ($p$<0.05)'
else:
STR = ' ($p$='+str(round(p,2))+')'
_=ax.flatten()[2].plot(x_trend,y_trend,'-',lw=3,color='k',label=str(round(slope*10,1))+'% decade$^{-1}$\n'+STR)
print('β='+str(round(mean,3))+'±'+str(round(ci,3)))
_=ax.flatten()[2].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[2].legend(fontsize=fontsize,loc=2)
_=ax.flatten()[2].set_xticks(range(1980,2021,10))
_=ax.flatten()[2].xaxis.set_minor_locator(plt.MultipleLocator(5))
_=ax.flatten()[2].set_ylim([0,80])
_=ax.flatten()[2].set_yticks(np.arange(0,81,10))
_=ax.flatten()[2].set_xlim([1980,2020])
_=ax.flatten()[2].set_xlabel('Year',fontsize=fontsize)
_=ax.flatten()[2].set_ylabel('Count ratio of landfalling TCs (%)\nwith LI≥50 m s$^{-1}$ to LMI≥50 m s$^{-1}$',fontsize=fontsize)
_=ax.flatten()[2].legend(loc=1,fontsize=fontsize)
_=ax.flatten()[2].text(1967,80,'(C)',fontsize=fontsize+2,fontweight='bold')
_=plt.savefig('/home/sw1013/www/FIGURES/Figure_1.png',dpi=600,bbox_inches='tight')
β=0.021±0.016 p=0.0129 18.82048136119845 158.7162687700718 β=0.014±0.009 β=0.014±0.441
fig,ax=plt.subplots(1,2); fig.set_size_inches(7,3); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.3,hspace=0.3); fontsize = 8
# #----------------------------------------------------------------------------------------------
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
tmptmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp .extend([VMAX_PMIN_SERIES[CCC][1][-1]])
tmptmp.extend([VMAX_PMIN_SERIES[CCC][1][ 0]])
tmp = np.asarray(tmp)
tmptmp = np.asarray(tmptmp)
tmp [(tmptmp<=96)] = np.nan
Y.extend([np.nanmean(tmp*.5144444)])
sample_weight.extend([sum(~np.isnan(tmp))])
tmp_LI = np.asarray(Y)
_=ax.flatten()[0].plot(X,Y,'-',color='r',ms=4,lw=1,zorder=10)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
STR = ''
if abs(ci)<=abs(slope):
STR = ' ($p$<0.05)'
else:
STR = ' ($p$='+str(round(p,2))+')'
_=ax.flatten()[0].plot(x_trend,y_trend,'-',lw=3,color='r',label='LI '+str(round(slope*10,1))+' m s$^{-1}$ decade$^{-1}$'+STR,zorder=10)
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]])
tmp = np.asarray(tmp)
tmp [(tmp<=96)] = np.nan
Y.extend([np.nanmean(tmp*.5144444)])
sample_weight.extend([sum(~np.isnan(tmp))])
tmp_LMI = np.asarray(Y)
_=ax.flatten()[0].plot(X,Y,'-',color='k',ms=4,lw=1,zorder=10)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
STR = ''
if abs(ci)<=abs(slope):
STR = ' ($p$<0.05)'
_=ax.flatten()[0].plot(x_trend,y_trend,'-',lw=3,color='k',label='LMI (landfalling)\n'+str(round(slope*10,1))+' m s$^{-1}$ decade$^{-1}$'+STR,zorder=10)
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_NONLF)):
if (VMAX_NONLF[CCC][1] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_NONLF[CCC][0]])
tmp = np.asarray(tmp)
tmp [(tmp<=96)] = np.nan
Y.extend([np.nanmean(tmp*.5144444)])
sample_weight.extend([sum(~np.isnan(tmp))])
_=ax.flatten()[0].plot(X,Y,'-',color='gray',ms=4,lw=1,zorder=6)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
STR = ''
if abs(ci)<=abs(slope):
STR = ' ($p$<0.05)'
_=ax.flatten()[0].plot(x_trend,y_trend,'-',lw=3,color='gray',label='LMI (Non-landfalling)\n'+str(round(slope*10,1))+' m s$^{-1}$ decade$^{-1}$'+STR,zorder=6)
_=ax.flatten()[0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[0].set_xticks(range(1980,2021,5))
_=ax.flatten()[0].set_ylim([15,75])
_=ax.flatten()[0].set_yticks(np.arange(15,76,10))
_=ax.flatten()[0].set_yticklabels(np.arange(5,76,10),color='k')
_=ax.flatten()[0].tick_params(axis='y', colors='k')
_=ax.flatten()[0].set_xlim([1980,2020])
_=ax.flatten()[0].set_xlabel('Year',fontsize=fontsize)
_=ax.flatten()[0].set_ylabel('Annual mean intensity (LMI≥50 m s$^{-1}$)',fontsize=fontsize,color='k')
_=ax.flatten()[0].legend(fontsize=fontsize)
_=ax.flatten()[0].text(1973,76,'(A)',fontsize=fontsize+2,fontweight='bold')
# scipy.stats.kstest(preprocessing.scale(y_trend-Y),'norm')
# check_autocorrelation_durbin_watson(y_trend-Y)
#---------------------------------------------------------------------------------------------------------
Y = []
for YEAR in X:
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp = VMAX_PMIN_SERIES[CCC][1][-1]/VMAX_PMIN_SERIES[CCC][1][0] * 100
# Y.extend([tmp])
if VMAX_PMIN_SERIES[CCC][1][0]>=96:
Y.extend([tmp])
Y = np.asarray(Y)
hist,bin_edges=np.histogram(Y,bins=np.arange(0,101,10),density=False)
_=ax.flatten()[1].bar(bin_edges[:-1]+10/2,hist,color='b',width=9)
_=ax.flatten()[1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[1].set_xticks(range(0,100,10))
_=ax.flatten()[1].set_ylim([0,80])
#_=ax.flatten()[1].set_yticks(np.arange(115,76,5))
#_=ax.flatten()[1].set_yticklabels(np.arange(5,76,5),color='k')
_=ax.flatten()[1].set_xlim([0,100])
_=ax.flatten()[1].set_xticks(np.arange(0,101,10))
_=ax.flatten()[1].set_xlabel('Ratio (%) of LI to LMI (LMI≥50 m s$^{-1}$)',fontsize=fontsize)
_=ax.flatten()[1].set_ylabel('TC count',fontsize=fontsize,color='k')
_=ax.flatten()[1].text(-18,80,'(B)',fontsize=fontsize+2,fontweight='bold')
print(np.nanmean(Y))
_=plt.savefig('/home/sw1013/www/FIGURES/Figure_3.png',dpi=600,bbox_inches='tight')
67.57224413331328
fig,ax=plt.subplots(2,2); fig.set_size_inches(7,7); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.3,hspace=0.3); fontsize = 8
# #----------------------------------------------------------------------------------------------
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
tmptmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp .extend([VMAX_PMIN_SERIES[CCC][1][-1]])
tmptmp.extend([VMAX_PMIN_SERIES[CCC][1][ 0]])
tmp = np.asarray(tmp)
tmptmp = np.asarray(tmptmp)
tmp [(tmptmp<=96)] = np.nan
Y.extend([np.nanmean(tmp*.5144444)])
sample_weight.extend([sum(~np.isnan(tmp))])
tmp_LI = np.asarray(Y)
_=ax.flatten()[0].plot(X,Y,'-',color='r',ms=4,lw=1,zorder=10)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
STR = ''
if abs(ci)<=abs(slope):
STR = ' ($p$<0.05)'
else:
STR = ' ($p$='+str(round(p,2))+')'
_=ax.flatten()[0].plot(x_trend,y_trend,'-',lw=3,color='r',label='LI '+str(round(slope*10,1))+' m s$^{-1}$ decade$^{-1}$'+STR,zorder=10)
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]])
tmp = np.asarray(tmp)
tmp [(tmp<=96)] = np.nan
Y.extend([np.nanmean(tmp*.5144444)])
sample_weight.extend([sum(~np.isnan(tmp))])
tmp_LMI = np.asarray(Y)
_=ax.flatten()[0].plot(X,Y,'-',color='k',ms=4,lw=1,zorder=10)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
STR = ''
if abs(ci)<=abs(slope):
STR = ' ($p$<0.05)'
_=ax.flatten()[0].plot(x_trend,y_trend,'-',lw=3,color='k',label='LMI (landfalling)\n'+str(round(slope*10,1))+' m s$^{-1}$ decade$^{-1}$'+STR,zorder=10)
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_NONLF)):
if (VMAX_NONLF[CCC][1] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_NONLF[CCC][0]])
tmp = np.asarray(tmp)
tmp [(tmp<=96)] = np.nan
Y.extend([np.nanmean(tmp*.5144444)])
sample_weight.extend([sum(~np.isnan(tmp))])
_=ax.flatten()[0].plot(X,Y,'-',color='gray',ms=4,lw=1,zorder=6)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
STR = ''
if abs(ci)<=abs(slope):
STR = ' ($p$<0.05)'
_=ax.flatten()[0].plot(x_trend,y_trend,'-',lw=3,color='gray',label='LMI (Non-landfalling)\n'+str(round(slope*10,1))+' m s$^{-1}$ decade$^{-1}$'+STR,zorder=6)
_=ax.flatten()[0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[0].set_xticks(range(1980,2021,5))
_=ax.flatten()[0].set_ylim([15,75])
_=ax.flatten()[0].set_yticks(np.arange(15,76,10))
_=ax.flatten()[0].tick_params(axis='y', colors='k')
_=ax.flatten()[0].set_xlim([1980,2020])
_=ax.flatten()[0].set_xlabel('Year',fontsize=fontsize)
_=ax.flatten()[0].set_ylabel('Annual mean intensity (LMI≥50 m s$^{-1}$)',fontsize=fontsize,color='k')
_=ax.flatten()[0].legend(fontsize=fontsize)
_=ax.flatten()[0].text(1971,75,'(A)',fontsize=fontsize+2,fontweight='bold')
#---------------------------------------------------------------------------------------------------------
X = INDEX_year[:]
Y = tmp_LI/tmp_LMI*100
sample_weight = 1 + np.zeros(len(sample_weight))
_=ax.flatten()[1].plot(X,Y,'-',color='k',ms=4,lw=1,zorder=6)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
STR = ''
if abs(ci)<=abs(slope):
STR = ' ($p$<0.05)'
else:
STR = ' ($p$='+str(round(p,2))+')'
_=ax.flatten()[1].plot(x_trend,y_trend,'-',lw=3,color='k',label=str(round(slope*10,1))+' % decade$^{-1}$'+STR,zorder=6)
_=ax.flatten()[1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[1].set_xticks(range(1980,2021,5))
_=ax.flatten()[1].set_ylim([45,80])
# _=ax.flatten()[1].set_yticks(np.arange(15,76,10))
# _=ax.flatten()[1].set_yticklabels(np.arange(5,76,10),color='k')
_=ax.flatten()[1].set_xlim([1980,2020])
_=ax.flatten()[1].set_xlabel('Year',fontsize=fontsize)
_=ax.flatten()[1].set_ylabel('Ratio (%) of annual mean LI to LMI\n(LMI≥50 m s$^{-1}$)',fontsize=fontsize,color='k')
_=ax.flatten()[1].legend(fontsize=fontsize)
_=ax.flatten()[1].text(1971,80,'(B)',fontsize=fontsize+2,fontweight='bold')
#---------------------------------------------------------------------------------------------------------
Y1,Y2 = [],[]
for YEAR in X:
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp = VMAX_PMIN_SERIES[CCC][1][-1]/VMAX_PMIN_SERIES[CCC][1][0] * 100
if VMAX_PMIN_SERIES[CCC][1][0]>=96:
Y1.extend([tmp])
tmp = dis_inverse[CCC]
if VMAX_PMIN_SERIES[CCC][1][0]>=96:
Y2.extend([tmp])
Y1,Y2 = np.asarray(Y1),np.asarray(Y2)
hist,bin_edges=np.histogram(Y1,bins=np.arange(0,101,10),density=False)
_=ax.flatten()[2].bar(bin_edges[:-1]+10/2,hist,color='gray',width=9)
_=ax.flatten()[2].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[2].set_xticks(range(0,100,10))
_=ax.flatten()[2].set_ylim([0,80])
#_=ax.flatten()[2].set_yticks(np.arange(115,76,5))
#_=ax.flatten()[2].set_yticklabels(np.arange(5,76,5),color='k')
_=ax.flatten()[2].set_xlim([100,0])
_=ax.flatten()[2].set_xticks(np.arange(0,101,10))
_=ax.flatten()[2].set_xlabel('Ratio (%) of individual LI to LMI (LMI≥50 m s$^{-1}$)',fontsize=fontsize)
_=ax.flatten()[2].set_ylabel('TC count',fontsize=fontsize,color='k')
_=ax.flatten()[2].text(122.5,80,'(C)',fontsize=fontsize+2,fontweight='bold')
print(np.nanmean(Y))
#---------------------------------------------------------------------------------------------------------
Y1,Y2 = [],[]
for YEAR in X:
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp = VMAX_PMIN_SERIES[CCC][1][-1]
if VMAX_PMIN_SERIES[CCC][1][0]>=96:
Y1.extend([tmp*.5144444])
tmp = VMAX_PMIN_SERIES[CCC][1][ 0]
if VMAX_PMIN_SERIES[CCC][1][0]>=96:
Y2.extend([tmp*.5144444])
Y1,Y2 = np.asarray(Y1),np.asarray(Y2)
_=ax.flatten()[3].boxplot([Y2,Y1],showfliers=False,whis=[5,95])
_=ax.flatten()[3].set_xticks(np.arange(1,3))
_=ax.flatten()[3].set_xticklabels(['LMI\n(LMI≥50 m s$^{-1}$)','LI\n(LMI≥50 m s$^{-1}$)'],fontsize=fontsize)
_=ax.flatten()[3].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[3].set_ylabel('Intensity (m s$^{-1}$)',fontsize=fontsize)
_=ax.flatten()[3].set_ylim([10,90])
_=ax.flatten()[3].text(.05,90,'(D)',fontsize=fontsize+2,fontweight='bold')
_=plt.savefig('/home/sw1013/www/FIGURES/Figure_3.png',dpi=600,bbox_inches='tight')
67.08253153554458
np.nanpercentile(Y1,95)
np.nanpercentile(Y1,5)
65.3344388
16.10210972
fig,ax=plt.subplots(2,2); fig.set_size_inches(7,7); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.3,hspace=0.3); fontsize = 8
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][1][-1]>=64):
tmp.extend([lat_LMI_inverse[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([sum(~np.isnan(tmp))]) #
tmp_LMI = np.asarray(Y)
_=ax[0][0].plot(X,Y,'o',color='b',lw=1,alpha=0.6)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[0][0].plot(x_trend,y_trend,'-',lw=3,color='b',label='LMI ('+str(round(slope*10,1))+' deg decade$^{-1}$, $p$='+str(round(p,2))+')')
#_=ax.fill_between(x_trend, ci_down, ci_up, facecolor='C0', alpha=.2, edgecolor='none', interpolate=True)
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][1][-1]>=64):
tmp.extend([lat_LI_inverse[CCC]])
#tmp = np.asarray(tmp)
#tmp [(tmp>=33)] = np.nan
Y.extend([np.nanmean(tmp)])
sample_weight.extend([sum(~np.isnan(tmp))])#
tmp_LI = np.asarray(Y)
_=ax[0][0].plot(X,Y,'o',color='r',lw=1,alpha=0.6)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[0][0].plot(x_trend,y_trend,'-',lw=3,color='r',label='Landfall ('+str(round(slope*10,1))+' deg decade$^{-1}$, $p$='+str(round(p,2))+')')
#_=ax.fill_between(x_trend, ci_down, ci_up, facecolor='C1', alpha=.2, edgecolor='none', interpolate=True)
_=ax[0][0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[0][0].legend(fontsize=fontsize,loc=2)
_=ax[0][0].set_xticks(range(1980,2021,5))
_=ax[0][0].set_ylim([16,30])
_=ax[0][0].set_xlim([1980,2020])
_=ax[0][0].set_xlabel('Year',fontsize=fontsize)
_=ax[0][0].set_ylabel('Absolute latitude (deg)',fontsize=fontsize)
_=ax[0][0].text(1973,30,'(A)',fontsize=fontsize+2,fontweight='bold')
_=ax[0][0].set_title('LMI ≥ 33 m s$^{-1}$',fontsize=fontsize)
#----------------------------------------------------------------------------------------------------------
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][1][-1]>=96):
tmp.extend([lat_LMI_inverse[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([sum(~np.isnan(tmp))]) #
tmp_LMI = np.asarray(Y)
_=ax[0][1].plot(X,Y,'o',color='b',lw=1,alpha=0.6)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[0][1].plot(x_trend,y_trend,'-',lw=3,color='b',label='LMI ('+str(round(slope*10,1))+' deg decade$^{-1}$, $p$='+str(round(p,2))+')')
#_=ax.fill_between(x_trend, ci_down, ci_up, facecolor='C0', alpha=.2, edgecolor='none', interpolate=True)
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][1][-1]>=96):
tmp.extend([lat_LI_inverse[CCC]])
#tmp = np.asarray(tmp)
#tmp [(tmp>=33)] = np.nan
Y.extend([np.nanmean(tmp)])
sample_weight.extend([sum(~np.isnan(tmp))])#
tmp_LI = np.asarray(Y)
_=ax[0][1].plot(X,Y,'o',color='r',lw=1,alpha=0.6)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[0][1].plot(x_trend,y_trend,'-',lw=3,color='r',label='Landfall ('+str(round(slope*10,1))+' deg decade$^{-1}$, $p$='+str(round(p,2))+')')
#_=ax.fill_between(x_trend, ci_down, ci_up, facecolor='C1', alpha=.2, edgecolor='none', interpolate=True)
_=ax[0][1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[0][1].legend(fontsize=fontsize,loc=2)
_=ax[0][1].set_xticks(range(1980,2021,5))
_=ax[0][1].set_ylim([16,30])
_=ax[0][1].set_xlim([1980,2020])
_=ax[0][1].set_xlabel('Year',fontsize=fontsize)
_=ax[0][1].set_ylabel('Absolute latitude (deg)',fontsize=fontsize)
_=ax[0][1].text(1973,30,'(B)',fontsize=fontsize+2,fontweight='bold')
_=ax[0][1].set_title('LMI ≥ 50 m s$^{-1}$',fontsize=fontsize)
#----------------------------------------------------------------------------------------------------------
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][1][-1]>=64):
tmp.extend([lat_LMI_inverse[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([sum(~np.isnan(tmp))]) #len(tmp)
tmp_LMI = np.asarray(Y)
_=ax[1][0].plot(X,Y,'o',color='b',lw=1,alpha=0.6)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[1][0].plot(x_trend,y_trend,'-',lw=3,color='b',label='LMI ('+str(round(slope*10,1))+' deg decade$^{-1}$, $p$='+str(round(p,2))+')')
#_=ax.fill_between(x_trend, ci_down, ci_up, facecolor='C0', alpha=.2, edgecolor='none', interpolate=True)
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][1][-1]>=64):
tmp.extend([lat_LI_inverse[CCC]])
#tmp = np.asarray(tmp)
#tmp [(tmp>=33)] = np.nan
Y.extend([np.nanmean(tmp)])
sample_weight.extend([sum(~np.isnan(tmp))])#sum(~np.isnan(tmp))
tmp_LI = np.asarray(Y)
_=ax[1][0].plot(X,Y,'o',color='r',lw=1,alpha=0.6)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[1][0].plot(x_trend,y_trend,'-',lw=3,color='r',label='Landfall ('+str(round(slope*10,1))+' deg decade$^{-1}$, $p$='+str(round(p,2))+')')
#_=ax.fill_between(x_trend, ci_down, ci_up, facecolor='C1', alpha=.2, edgecolor='none', interpolate=True)
_=ax[1][0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[1][0].legend(fontsize=fontsize,loc=2)
_=ax[1][0].set_xticks(range(1980,2021,5))
_=ax[1][0].set_ylim([10,30])
_=ax[1][0].set_xlim([1980,2020])
_=ax[1][0].set_xlabel('Year',fontsize=fontsize)
_=ax[1][0].set_ylabel('Absolute latitude (deg)',fontsize=fontsize)
_=ax[1][0].text(1972,30,'(C)',fontsize=fontsize+2,fontweight='bold')
_=ax[1][0].set_title('LI ≥ 33 m s$^{-1}$',fontsize=fontsize)
#----------------------------------------------------------------------------------------------------------
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][1][-1]>=96):
tmp.extend([lat_LMI_inverse[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([sum(~np.isnan(tmp))]) #len(tmp)
tmp_LMI = np.asarray(Y)
_=ax[1][1].plot(X,Y,'o',color='b',lw=1,alpha=0.6)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[1][1].plot(x_trend,y_trend,'-',lw=3,color='b',label='LMI ('+str(round(slope*10,1))+' deg decade$^{-1}$, $p$='+str(round(p,2))+')')
#_=ax.fill_between(x_trend, ci_down, ci_up, facecolor='C0', alpha=.2, edgecolor='none', interpolate=True)
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][1][-1]>=96):
tmp.extend([lat_LI_inverse[CCC]])
#tmp = np.asarray(tmp)
#tmp [(tmp>=33)] = np.nan
Y.extend([np.nanmean(tmp)])
sample_weight.extend([sum(~np.isnan(tmp))])#sum(~np.isnan(tmp))
tmp_LI = np.asarray(Y)
_=ax[1][1].plot(X,Y,'o',color='r',lw=1,alpha=0.6)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[1][1].plot(x_trend,y_trend,'-',lw=3,color='r',label='Landfall ('+str(round(slope*10,1))+' deg decade$^{-1}$, $p$='+str(round(p,2))+')')
#_=ax.fill_between(x_trend, ci_down, ci_up, facecolor='C1', alpha=.2, edgecolor='none', interpolate=True)
_=ax[1][1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[1][1].legend(fontsize=fontsize,loc=2)
_=ax[1][1].set_xticks(range(1980,2021,5))
_=ax[1][1].set_ylim([10,30])
_=ax[1][1].set_xlim([1980,2020])
_=ax[1][1].set_xlabel('Year',fontsize=fontsize)
_=ax[1][1].set_ylabel('Absolute latitude (deg)',fontsize=fontsize)
_=ax[1][1].text(1972,30,'(D)',fontsize=fontsize+2,fontweight='bold')
_=ax[1][1].set_title('LI ≥ 50 m s$^{-1}$',fontsize=fontsize)
plt.savefig('/home/sw1013/www/FIGURES/Figure_supp_8.png',dpi=600,bbox_inches='tight')
#plt.savefig('/home/sw1013/www/FIGURES/Figure_1.pdf',dpi=600,bbox_inches='tight')
#fig,ax=plt.subplots(1,1); fig.set_size_inches(3,3); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
#Afig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.3,hspace=0.3); fontsize = 8
THRESs = np.arange(64,117)
MEAN_LI = []
CI95_LI = []
MEAN_LI_P = []
CI95_LI_P = []
for THRES in THRESs:
print(THRES,end=' ')
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]])
Y.extend([sum(np.asarray(tmp)>=THRES)])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
x_trend, y_trend,slope,ci = get_trend_and_ci_weight_CITHRES(X,Y,sample_weight,0.95)
MEAN_LI.extend([round(slope*10,2)])
CI95_LI.extend([round(ci *10,2)])
pred, mean, ci, p = poisson_reg(X,Y)
MEAN_LI_P.extend([round(np.log(2)/mean,2)])
if abs(mean)<abs(ci):
CI95_LI_P.extend([False])
else:
CI95_LI_P.extend([True])
MEAN_LI = np.asarray(MEAN_LI )
CI95_LI = np.asarray(CI95_LI )
MEAN_LI_P = np.asarray(MEAN_LI_P )
CI95_LI_P = np.asarray(CI95_LI_P )
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------
MEAN_LMI = []
CI95_LMI = []
MEAN_LMI_P = []
CI95_LMI_P = []
for THRES in THRESs:
print(THRES,end=' ')
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]])
Y.extend([sum(np.asarray(tmp)>=THRES)])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
x_trend, y_trend,slope,ci = get_trend_and_ci_weight_CITHRES(X,Y,sample_weight,0.95)
MEAN_LMI.extend([round(slope*10,2)])
CI95_LMI.extend([round(ci *10,2)])
pred, mean, ci,p = poisson_reg(X,Y)
MEAN_LMI_P.extend([round(np.log(2)/mean,2)])
if abs(mean)<abs(ci):
CI95_LMI_P.extend([False])
else:
CI95_LMI_P.extend([True])
MEAN_LMI = np.asarray(MEAN_LMI )
CI95_LMI = np.asarray(CI95_LMI )
MEAN_LMI_P = np.asarray(MEAN_LMI_P )
CI95_LMI_P = np.asarray(CI95_LMI_P )
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
fig,ax=plt.subplots(1,1); fig.set_size_inches(3,3); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.3,hspace=0.3); fontsize = 8
#+++++++++++++++++++
THRESs = np.arange(64,117)
THRESs = THRESs+1
#+++++++++++++++++++
_=ax.plot(THRESs*0.5144444,MEAN_LI_P,':',color='k' ,ms=3,lw=2,zorder=10)
tmp_X = copy.copy(THRESs.astype(float))
tmp_X[CI95_LI_P==False]=np.nan
tmp_Y = copy.copy(MEAN_LI_P)
tmp_Y[CI95_LI_P==False]=np.nan
lns3=ax.plot(tmp_X*0.5144444, tmp_Y,'-',color='k',ms=3,lw=2,label='LI',zorder=10,alpha=1)
_=ax.plot(THRESs*0.5144444,MEAN_LMI_P,':',color='b' ,ms=3,lw=2,zorder=10)
tmp_X = copy.copy(THRESs.astype(float))
tmp_X[CI95_LMI_P==False]=np.nan
tmp_Y = copy.copy(MEAN_LMI_P)
tmp_Y[CI95_LMI_P==False]=np.nan
lns4=ax.plot(tmp_X*0.5144444, tmp_Y,'-',color='b',ms=3,lw=2,label='LMI',zorder=10,alpha=1)
_=ax.legend(loc=1,fontsize=fontsize)#,bbox_to_anchor=(1.02, 1.28))
_=ax.set_yticks(np.arange(20,161,20))
_=ax.set_ylim([20,160])
_=ax.set_xlim([35,60])
#_=ax.set_xlim([(THRESs*0.5144444).min(),(THRESs*0.5144444).max()])
_=ax.tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.set_ylabel('Doubling time of annual TC landfall count (years)',fontsize=fontsize)
_=ax.set_xlabel('LI or LMI ≥ intensity threshold (m s$^{-1}$)',fontsize=fontsize)
plt.savefig('/home/sw1013/www/FIGURES/Figure_2.png',dpi=600,bbox_inches='tight')
fig,ax=plt.subplots(1,1); fig.set_size_inches(3,3); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.3,hspace=0.3); fontsize = 8
all_LMI=newbt_lf.groupby('SID').apply(lambda x: np.nanmax(x.USA_WIND))
all_YEAR = newbt_lf.groupby('SID').apply(lambda x: x.SEASON.iloc[np.nanargmax(x.USA_WIND)])
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(all_LMI)):
if (all_YEAR[CCC] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([all_LMI[CCC]*.514444])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
tmp_LMI = np.asarray(Y)
_=ax.plot(X,Y,'-',color='b',lw=1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax.plot(x_trend,y_trend,'-',lw=3,color='b',label='LMI ('+str(round(slope*10,1))+'±'+str(round(ci*10,1))+' m s$^{-1}$ decade$^{-1}$)')
all_LMI=newbt_nonlf.groupby('SID').apply(lambda x: np.nanmax(x.USA_WIND))
all_YEAR = newbt_nonlf.groupby('SID').apply(lambda x: x.SEASON.iloc[np.nanargmax(x.USA_WIND)])
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(all_LMI)):
if (all_YEAR[CCC] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([all_LMI[CCC]*.514444])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
tmp_LMI_nolf = np.asarray(Y)
_=ax.plot(X,Y,'-',color='brown',lw=1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax.plot(x_trend,y_trend,'-',lw=3,color='brown',label='LMI ('+str(round(slope*10,1))+'±'+str(round(ci*10,1))+' m s$^{-1}$ decade$^{-1}$)')
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
tmp_LI = np.asarray(Y)
_=ax.plot(X,Y,'-',color='r',lw=1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax.plot(x_trend,y_trend,'-',lw=3,color='r',label='LI ('+str(round(slope*10,1))+'±'+str(round(ci*10,1))+' m s$^{-1}$ decade$^{-1}$)')
#_=ax.fill_between(x_trend, ci_down, ci_up, facecolor='C1', alpha=.2, edgecolor='none', interpolate=True)
_=ax.tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.legend(fontsize=fontsize,loc=2)
_=ax.set_xticks(range(1980,2021,5))
_=ax.set_ylim([25,70])
_=ax.set_xlim([1980,2020])
_=ax.set_xlabel('Year',fontsize=fontsize)
_=ax.set_ylabel('Observed intensity (m s$^{-1}$)',fontsize=fontsize)
plt.savefig('/home/sw1013/www/FIGURES/Figure_1.png',dpi=600,bbox_inches='tight')
plt.savefig('/home/sw1013/www/FIGURES/Figure_1.pdf',dpi=600,bbox_inches='tight')
Moving smooth
tmp_LMI_LF = pd.DataFrame(data=[scipy.signal.detrend(tmp_LMI),scipy.signal.detrend(tmp_LI)],index=['LMI','LI'],columns=INDEX_year) .transpose()
TABLE = pd.DataFrame(index=['r','p'],columns=[1,3,5,6,7,9,11])
_,_,TABLE.iloc[0,0],TABLE.iloc[1,0],_=scipy.stats.linregress(tmp_LMI_LF.LMI,tmp_LMI_LF.LI)
for POS, LLL in enumerate ([3,5,6,7,9,11]):
tmp1 = tmp_LMI_LF.LMI.rolling(window=LLL,center=True).mean().iloc[int(LLL/2):-int(LLL/2)]
tmp2 = tmp_LMI_LF.LI .rolling(window=LLL,center=True).mean().iloc[int(LLL/2):-int(LLL/2)]
_,_,TABLE.iloc[0,POS+1],TABLE.iloc[1,POS+1],_=scipy.stats.linregress(tmp1,tmp2)
TABLE
| 1 | 3 | 5 | 6 | 7 | 9 | 11 | |
|---|---|---|---|---|---|---|---|
| r | 0.233788 | 0.365739 | 0.357108 | 0.353495 | 0.342061 | 0.317649 | 0.347358 |
| p | 0.157748 | 0.0282631 | 0.038143 | 0.0471762 | 0.0553321 | 0.0871686 | 0.0701237 |
def low_pass_weights(window, cutoff):
"""Calculate weights for a low pass Lanczos filter.
Args:
window: int
The length of the filter window.
cutoff: float
The cutoff frequency in inverse time steps.
"""
order = ((window - 1) // 2 ) + 1
nwts = 2 * order + 1
w = np.zeros([nwts])
n = nwts // 2
w[n] = 2 * cutoff
k = np.arange(1., n)
sigma = np.sin(np.pi * k / n) * n / (np.pi * k)
firstfactor = np.sin(2. * np.pi * cutoff * k) / (np.pi * k)
w[n-1:0:-1] = firstfactor * sigma
w[n+1:-1] = firstfactor * sigma
return w[1:-1]
tmp_year = 9
wt = low_pass_weights(30,1/tmp_year)
tmp_LMI_LF['LMI_DECADAL'] = np.convolve(wt, tmp_LMI_LF['LMI'], mode='same')
tmp_LMI_LF['LI_DECADAL' ] = np.convolve(wt, tmp_LMI_LF['LI' ], mode='same')
scipy.stats.linregress(tmp_LMI_LF['LMI_DECADAL'],tmp_LMI_LF['LI_DECADAL' ])
_=plt.figure(figsize=(5,3),dpi=100); fontsize=8
_=plt.plot(tmp_LMI_LF['LMI'] ,'--k',label='Annual LMI')
_=plt.plot(tmp_LMI_LF['LMI_DECADAL'],'-k' ,label='Filtered LMI')
_=plt.plot(tmp_LMI_LF['LI'] ,'--r',label='Annual ')
_=plt.plot(tmp_LMI_LF['LI_DECADAL'] ,'-r' ,label='')
_=plt.tick_params(axis='both', which='major', labelsize=fontsize)
_=plt.legend(fontsize=fontsize,loc=2)
_=plt.xticks(range(1980,2021,5))
_=plt.ylim([-10,10])
_=plt.xlim([1980,2020])
_=plt.xlabel('Year',fontsize=fontsize)
_=plt.ylabel('Annual TC counts',fontsize=fontsize)
LinregressResult(slope=0.38556060487722554, intercept=0.051855244807418974, rvalue=0.35496786702335237, pvalue=0.028754074187917467, stderr=0.16924176063012317)
Basin breakdown - Trend
def basin_LI_trend (AREA):
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]])
Y.extend([sum(np.asarray(tmp)>=96)]) #96
sample_weight.extend([1])
pred, mean, ci, p = poisson_reg(X,Y)
STR = ' ($p$='+str(round(p,2))+')'
if abs(ci)<=abs(mean):
STR = ' ($p$<0.05)'
output1 = str(round(np.log(2)/mean).astype(int))+STR
count = np.nansum(sample_weight)
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]])
Y.extend([sum(np.asarray(tmp)>=96)]) #96
sample_weight.extend([1])
pred, mean, ci, p = poisson_reg(X,Y)
STR = ' ($p$='+str(round(p,2))+')'
if abs(ci)<=abs(mean):
STR = ' ($p$<0.05)'
output2 = str(round(np.log(2)/mean).astype(int))+STR
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([dur_inverse[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
x_trend, y_trend, slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
p_str = '='+str('%.2f' %np.round(p,2))
if p<0.05:
p_str = '<0.05'
output3 = str(round(slope*10))+' ($p$'+p_str+')'
Ref_B = 2.3e-7
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([trajectory_inverse[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
x_trend, y_trend, slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
p_str = '='+str('%.2f' %np.round(p,2))
if p<0.05:
p_str = '<0.05'
output4 = str(round(slope*10))+' ($p$'+p_str+')'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([speed_inverse[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
x_trend, y_trend, slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
p_str = '='+str('%.2f' %np.round(p,2))
if p<0.05:
p_str = '<0.05'
output5 = str(round(slope*10))+' ($p$'+p_str+')'
return output1, output2,output3,output4,output5, count
TABLE = pd.DataFrame(index=['Major landfall doubling time (year)','Major LMI doubling time (year)','$T$ (hr per decade)','$d$ (km per decade)','$c$ (m s$^{-1}$ per decade)'],
columns=['Global','NH','SH','WP','EP','NA','NI','SI','SP'])
for BBB,AREA in enumerate( [
['WP','EP','NA','NI','SI','SP'],
['WP','EP','NA','NI'],
['SI','SP'],
['WP'],
['EP'],
['NA'],
['NI'],
['SI'],
['SP'],
]):
output1,output2,output3,output4,output5,output6 = basin_LI_trend(AREA)
TABLE.iloc[0,BBB] = output1
TABLE.iloc[1,BBB] = output2
TABLE.iloc[2,BBB] = output3
TABLE.iloc[3,BBB] = output4
TABLE.iloc[4,BBB] = output5
TABLE
#TABLE.to_clipboard()
Basin breakdown - Epoch
def basin_LI_epoch (AREA):
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp_before = []; tmp_after = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
if (VMAX_PMIN_SERIES[CCC][2] <= 2000) :
tmp_before.extend([VMAX_PMIN_SERIES[CCC][1][0]*.514444])
else:
tmp_after .extend([VMAX_PMIN_SERIES[CCC][1][0]*.514444])
mean = np.nanmean(tmp_after) - np.nanmean(tmp_before)
ci1,ci2,mean_check = bootstrapping_compare_mean_CI_star(tmp_before,tmp_after,95)
output1 = str(round(mean,1))+'±'+str(round((ci1+ci2)/2,1))
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp_before = []; tmp_after = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
if (VMAX_PMIN_SERIES[CCC][2] <= 2000) :
tmp_before.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
else:
tmp_after .extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
mean = np.nanmean(tmp_after) - np.nanmean(tmp_before)
ci1,ci2,mean_check = bootstrapping_compare_mean_CI_star(tmp_before,tmp_after,95)
output2 = str(round(mean,1))+'±'+str(round((ci1+ci2)/2,1))
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp_before = []; tmp_after = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
if (VMAX_PMIN_SERIES[CCC][2] <= 2000) :
tmp_before.extend([dur_inverse[CCC]])
else:
tmp_after .extend([dur_inverse[CCC]])
mean = np.nanmean(tmp_after) - np.nanmean(tmp_before)
ci1,ci2,mean_check = bootstrapping_compare_mean_CI_star(tmp_before,tmp_after,95)
output3 = str(round(mean,1))+'±'+str(round((ci1+ci2)/2,1))
Ref_B = 1.0e-7
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp_before = []; tmp_after = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
if (VMAX_PMIN_SERIES[CCC][2] <= 2000) :
tmp_before.extend([B_inverse[CCC]/Ref_B*10])
else:
tmp_after .extend([B_inverse[CCC]/Ref_B*10])
mean = np.nanmean(tmp_after) - np.nanmean(tmp_before)
ci1,ci2,mean_check = bootstrapping_compare_mean_CI_star(tmp_before,tmp_after,95)
output4 = str(round(mean,1))+'±'+str(round((ci1+ci2)/2,1))
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp_before = []; tmp_after = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
if (VMAX_PMIN_SERIES[CCC][2] <= 2000) :
tmp_before.extend([B_inverse[CCC]*dur_inverse[CCC]*3600*1000])
else:
tmp_after .extend([B_inverse[CCC]*dur_inverse[CCC]*3600*1000])
mean = np.nanmean(tmp_after) - np.nanmean(tmp_before)
ci1,ci2,mean_check = bootstrapping_compare_mean_CI_star(tmp_before,tmp_after,95)
output5 = str(round(mean,1))+'±'+str(round((ci1+ci2)/2,1))
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp_before = []; tmp_after = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
if (VMAX_PMIN_SERIES[CCC][2] <= 2000) :
tmp_before.extend([1./(VMAX_PMIN_SERIES[CCC][1][0]*.514444)*1000])
else:
tmp_after .extend([1./(VMAX_PMIN_SERIES[CCC][1][0]*.514444)*1000])
mean = np.nanmean(tmp_after) - np.nanmean(tmp_before)
ci1,ci2,mean_check = bootstrapping_compare_mean_CI_star(tmp_before,tmp_after,95)
output6 = str(round(mean,1))+'±'+str(round((ci1+ci2)/2,1))
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp_before = []; tmp_after = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
if (VMAX_PMIN_SERIES[CCC][2] <= 2000) :
tmp_before.extend([trajectory_inverse[CCC]])
else:
tmp_after .extend([trajectory_inverse[CCC]])
mean = np.nanmean(tmp_after) - np.nanmean(tmp_before)
ci1,ci2,mean_check = bootstrapping_compare_mean_CI_star(tmp_before,tmp_after,95)
output7 = str(int(round(mean)))+'±'+str(int(round((ci1+ci2)/2)))
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp_before = []; tmp_after = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
if (VMAX_PMIN_SERIES[CCC][2] <= 2000) :
tmp_before.extend([speed_inverse[CCC]])
else:
tmp_after .extend([speed_inverse[CCC]])
mean = np.nanmean(tmp_after) - np.nanmean(tmp_before)
ci1,ci2,mean_check = bootstrapping_compare_mean_CI_star(tmp_before,tmp_after,95)
output8 = str(round(mean,1))+'±'+str(round((ci1+ci2)/2,1))
return output1, output2,output3,output4,output5,output6,output7,output8
TABLE = pd.DataFrame(index=['LMI','LI','$\Delta$t','$\kappa$','$\Delta$t${\times}\kappa$','1/LMI','$\Delta$d','c'],columns=['Global','NH','SH','WP','EP','NA','NI','SI','SP'])
for BBB,AREA in enumerate( [
['WP','EP','NA','NI','SI','SP'],
['WP','EP','NA','NI'],
['SI','SP'],
['WP'],
['EP'],
['NA'],
['NI'],
['SI'],
['SP'],
]):
output1,output2,output3,output4,output5,output6,output7,output8 = basin_LI_epoch(AREA)
TABLE.iloc[0,BBB] = output1
TABLE.iloc[1,BBB] = output2
TABLE.iloc[2,BBB] = output3
TABLE.iloc[3,BBB] = output4
TABLE.iloc[4,BBB] = output5
TABLE.iloc[5,BBB] = output6
TABLE.iloc[6,BBB] = output7
TABLE.iloc[7,BBB] = output8
TABLE[['Global','WP','EP','NA','NI','SI','SP']].reindex(['LI','LMI','1/LMI','$\Delta$t${\times}\kappa$','$\Delta$d','$\Delta$t','$\kappa$','c'])
#TABLE.to_clipboard()
Basin breakdown - Epoch - counts
def basin_LI_epoch (AREA):
X = INDEX_year[:]
Y = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
Y.extend([sum(np.asarray(tmp)>=96*.514444)])
Y = np.asarray(Y)
tmp_before = Y[:19]
tmp_after = Y[20:]
mean = np.nanmean(tmp_after) - np.nanmean(tmp_before)
ci1,ci2,mean_check = bootstrapping_compare_mean_CI_star(tmp_before,tmp_after,95)
output1 = str(round(mean,1))+'±'+str(round((ci1+ci2)/2,1))
X = INDEX_year[:]
Y = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
Y.extend([sum(np.asarray(tmp)>=-99999)])
Y = np.asarray(Y)
tmp_before = Y[:19]
tmp_after = Y[20:]
mean = np.nanmean(tmp_after) - np.nanmean(tmp_before)
ci1,ci2,mean_check = bootstrapping_compare_mean_CI_star(tmp_before,tmp_after,95)
output2 = str(round(mean,1))+'±'+str(round((ci1+ci2)/2,1))
X = INDEX_year[:]
Y = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]*.514444])
Y.extend([sum(np.asarray(tmp)>=96*.514444)])
Y = np.asarray(Y)
tmp_before = Y[:19]
tmp_after = Y[20:]
mean = np.nanmean(tmp_after) - np.nanmean(tmp_before)
ci1,ci2,mean_check = bootstrapping_compare_mean_CI_star(tmp_before,tmp_after,95)
output3 = str(round(mean,1))+'±'+str(round((ci1+ci2)/2,1))
X = INDEX_year[:]
Y = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]*.514444])
Y.extend([sum(np.asarray(tmp)>=-99999)])
Y = np.asarray(Y)
tmp_before = Y[:19]
tmp_after = Y[20:]
mean = np.nanmean(tmp_after) - np.nanmean(tmp_before)
ci1,ci2,mean_check = bootstrapping_compare_mean_CI_star(tmp_before,tmp_after,95)
output4 = str(round(mean,1))+'±'+str(round((ci1+ci2)/2,1))
X = INDEX_year[:]
Y = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]*.514444])
#Y.extend([sum(np.asarray(tmp)>=113*.514444)]) # CAT5 135 kt
Y.extend([sum(np.asarray(tmp)>=np.nanpercentile(A_inverse,90))]) # CAT5 135 kt
Y = np.asarray(Y)
tmp_before = Y[:19]
tmp_after = Y[20:]
mean = np.nanmean(tmp_after) - np.nanmean(tmp_before)
ci1,ci2,mean_check = bootstrapping_compare_mean_CI_star(tmp_before,tmp_after,95)
output5 = str(round(mean,1))+'±'+str(round((ci1+ci2)/2,1))
return output1, output2,output3,output4,output5
TABLE = pd.DataFrame(index=['Major LI','All LI','Major LMI','All LMI','CAT5 LMI'],columns=['Global','NH','SH','WP','EP','NA','NI','SI','SP'])
for BBB,AREA in enumerate( [
['WP','EP','NA','NI','SI','SP'],
['WP','EP','NA','NI'],
['SI','SP'],
['WP'],
['EP'],
['NA'],
['NI'],
['SI'],
['SP'],
]):
output1,output2,output3,output4,output5 = basin_LI_epoch(AREA)
TABLE.iloc[0,BBB] = output1
TABLE.iloc[1,BBB] = output2
TABLE.iloc[2,BBB] = output3
TABLE.iloc[3,BBB] = output4
TABLE.iloc[4,BBB] = output5
TABLE[['Global','WP','EP','NA','NI','SI','SP']].reindex(['Major LI','All LI','Major LMI','All LMI','CAT5 LMI'])
#TABLE.to_clipboard()
Epochal LI, terciles
X = INDEX_year[:]
Y = []
sample_weight = []
AREA = ['WP','EP','NA','NI','SI','SP']
for YEAR in X:
tmp_before = []; tmp_after = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
if (VMAX_PMIN_SERIES[CCC][2] <= 2000) :
tmp_before.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
else:
tmp_after .extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
tmp_after = np.asarray(tmp_after)
tmp_before = np.asarray(tmp_before)
tmp_after = tmp_after [(tmp_after >np.nanpercentile(tmp_after ,66))&(tmp_after <=np.nanpercentile(tmp_after ,100))]
tmp_before = tmp_before[(tmp_before>np.nanpercentile(tmp_before,66))&(tmp_before<=np.nanpercentile(tmp_before,100))]
mean = np.nanmean(tmp_after) - np.nanmean(tmp_before)
ci1,ci2,mean_check = bootstrapping_compare_mean_CI_star(tmp_before,tmp_after,95)
str(round(mean,1))+'±'+str(round((ci1+ci2)/2,1))
Major landfall proportion
fig,ax=plt.subplots(1,2); fig.set_size_inches(7,3); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.3,hspace=0.3); fontsize = 8
#newbt_lf[(newbt_lf.SEASON==YEAR)&(newbt_lf.BASIN==BASIN)].groupby('SID').ngroups
#X = INDEX_year[:]
#Y = []
#sample_weight = []
#for YEAR in X:
# tmp = []
# for CCC in range(len(VMAX_PMIN_SERIES)):
# if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
# tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
# Y.extend([sum(np.asarray(tmp)>=33)])
# sample_weight.extend([1]) #[len(tmp)]
#tmp_LMI = np.asarray(Y)
#_=ax[0].plot(X,Y,'-',color='C0',lw=1)
#x_trend, y_trend,slope,ci = get_trend_and_ci_weight(X,Y,sample_weight)
#_=ax[0].plot(x_trend,y_trend,'-',lw=3,color='C0',label='All landfall ('+str(round(slope*10,1))+'±'+str(round(ci*10,1))+' decade$^{-1}$)')
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
Y.extend([sum(np.asarray(tmp)>=64*.514444)])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
_=ax[0].plot(X,Y,'-',color='C0',lw=1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[0].plot(x_trend,y_trend,'-',lw=3,color='C0',label='All landfall ('+str(round(slope*10,1))+'±'+str(round(ci*10,1))+' decade$^{-1}$)')
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
Y.extend([sum(np.asarray(tmp)>=96*.514444)])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
_=ax[0].plot(X,Y,'-',color='C1',lw=1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[0].plot(x_trend,y_trend,'-',lw=3,color='C1',label='Major landfall ('+str(round(slope*10,1))+'±'+str(round(ci*10,1))+' decade$^{-1}$)')
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
Y.extend([sum((np.asarray(tmp)<96*.514444)&(np.asarray(tmp)>=64*.514444))])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
_=ax[0].plot(X,Y,'-',color='C2',lw=1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[0].plot(x_trend,y_trend,'-',lw=3,color='C2',label='Minor landfall ('+str(round(slope*10,1))+'±'+str(round(ci*10,1))+' decade$^{-1}$)')
_=ax[0].legend(fontsize=fontsize)
_=ax[0].set_ylim([0,25])
_=ax[0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[0].legend(fontsize=fontsize,loc=2)
_=ax[0].set_xticks(range(1980,2021,5))
_=ax[0].set_ylim([0,25])
_=ax[0].set_xlim([1980,2020])
_=ax[0].set_xlabel('Year',fontsize=fontsize)
_=ax[0].set_ylabel('Global landfall counts',fontsize=fontsize)
#-------------------------------------------------------------------------------------------------------------------------------------------
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
Y.extend([sum(np.asarray(tmp)>=50)/len(tmp)])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
_=ax[1].plot(X,Y,'-',color='C1',lw=1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[1].plot(x_trend,y_trend,'-',lw=3,color='C1',label='Major landfall ('+str(round(slope*10*1e2,1))+'±'+str(round(ci*10*1e2,1))+'% decade$^{-1}$)')
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
Y.extend([sum((np.asarray(tmp)<96*.514444)&(np.asarray(tmp)>=64*.514444))/len(tmp)])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
_=ax[1].plot(X,Y,'-',color='C2',lw=1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[1].plot(x_trend,y_trend,'-',lw=3,color='C2',label='Minor landfall ('+str(round(slope*10*1e2,1))+'±'+str(round(ci*10*1e2,1))+'% decade$^{-1}$)')
_=ax[1].legend(fontsize=fontsize)
_=ax[1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[1].legend(fontsize=fontsize,loc=2)
_=ax[1].set_xticks(range(1980,2021,5))
_=ax[1].set_ylim([0,1])
_=ax[1].set_xlim([1980,2020])
_=ax[1].set_xlabel('Year',fontsize=fontsize)
_=ax[1].set_ylabel('Global landfall fraction',fontsize=fontsize)
fig,ax=plt.subplots(1,1); fig.set_size_inches(3,3); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.3,hspace=0.3); fontsize = 8
#-------------------------------------------------------------------------------------------------------------------------------------------
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]*.514444])
Y.extend([sum(np.asarray(tmp)>=96*.514444)/len(tmp)])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
_=ax.plot(X,Y,'-',color='C1',lw=1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax.plot(x_trend,y_trend,'-',lw=3,color='C1',label='Major LMI ('+str(round(slope*10*1e2,1))+'±'+str(round(ci*10*1e2,1))+'% decade$^{-1}$)')
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
Y.extend([sum(np.asarray(tmp)>=96*.514444)/len(tmp)])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
_=ax.plot(X,Y,'-',color='C2',lw=1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax.plot(x_trend,y_trend,'-',lw=3,color='C2',label='Major LI ('+str(round(slope*10*1e2,1))+'±'+str(round(ci*10*1e2,1))+'% decade$^{-1}$)')
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]*.514444])
Y.extend([sum(np.asarray(tmp)>=135*.514444)/len(tmp)])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
_=ax.plot(X,Y,'-',color='C3',lw=1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax.plot(x_trend,y_trend,'-',lw=3,color='C3',label='CAT5 LMI ('+str(round(slope*10*1e2,1))+'±'+str(round(ci*10*1e2,1))+'% decade$^{-1}$)')
_=ax.legend(fontsize=fontsize)
_=ax.tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.legend(fontsize=fontsize,loc=2)
_=ax.set_xticks(range(1980,2021,5))
_=ax.set_ylim([0,1.2])
_=ax.set_yticks(np.arange(0,1.1,.2))
_=ax.set_xlim([1980,2020])
_=ax.set_xlabel('Year',fontsize=fontsize)
_=ax.set_ylabel('Global landfall fraction',fontsize=fontsize)
fig,ax=plt.subplots(1,1); fig.set_size_inches(3,3); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.3,hspace=0.3); fontsize = 8
#-------------------------------------------------------------------------------------------------------------------------------------------
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]*.514444])
Y.extend([sum(np.asarray(tmp)>=96*.514444)/len(tmp)])
sample_weight.extend([1])
tmp_LMI = np.asarray(Y)
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]<CAT_KT.CAT3.LOWER):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
Y.extend([sum(np.asarray(tmp)>=96*.514444)/len(tmp)])
sample_weight.extend([1])
tmp_LI = np.asarray(Y)
Y = tmp_LI/tmp_LMI
_=ax.plot(X,Y,'-',color='C2',lw=1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax.plot(x_trend,y_trend,'-',lw=3,color='C2',label='Major LI / Major LMI ('+str(round(slope*10*1e2,1))+'±'+str(round(ci*10*1e2,1))+'% decade$^{-1}$)')
_=ax.legend(fontsize=fontsize)
_=ax.tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.legend(fontsize=fontsize,loc=2)
_=ax.set_xticks(range(1980,2021,5))
_=ax.set_ylim([0,.8])
_=ax.set_yticks(np.arange(0,.9,.1))
_=ax.set_xlim([1980,2020])
_=ax.set_xlabel('Year',fontsize=fontsize)
_=ax.set_ylabel('Global count fraction',fontsize=fontsize)
plt.savefig('/home/sw1013/www/FIGURES/Figure_supp_editor.png',dpi=600,bbox_inches='tight')
fig,ax=plt.subplots(1,3); fig.set_size_inches(7,2.5); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.35,hspace=0.3); fontsize = 8
interp_vmax_in_inverse = np.asarray(interp_vmax_in_inverse )
interp_vmax_pred_inverse = np.asarray(interp_vmax_pred_inverse)
dis_inverse = []
for CCC in range(len(VMAX_PMIN_SERIES)):
dis_inverse.extend([VMAX_PMIN_SERIES[CCC][3]])
dis_inverse=np.asarray(dis_inverse)
# tmp_LMI and tmp_LF of individual cases with B_inverse case sequence
tmp_LILMI = []
for CCC in range(len(B_inverse)):
tmp_LILMI.extend([interp_vmax_in_inverse[CCC][-1]/interp_vmax_in_inverse[CCC][ 0]])
tmp_LILMI=np.asarray(tmp_LILMI)
#
_=ax[2].plot(trajectory_inverse/1e3,tmp_LILMI,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax[2].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[2].set_ylabel('LI/LMI',fontsize=fontsize)
_=ax[2].set_xlabel('$d$ (10$^3$ km)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(tmp_LILMI,trajectory_inverse)
p_str = str(np.round(p,2))
if p<0.05:
p_str = '<0.05'
_=ax[2].text(7*.99,1*.99,'$r$='+str('%.2f' %np.round(r,2))+'\n$p$'+p_str,fontsize=fontsize,va='top',ha='right')
_=ax[2].text(-1.98,1,'(C)',fontsize=fontsize+2,fontweight='bold')
_=ax[2].set_ylim([0,1])
_=ax[2].set_xlim([0,7])
_=ax[2].set_xticks(np.arange(0,8,1))
#
_=ax[1].plot(dur_inverse,tmp_LILMI,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax[1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[1].set_ylabel('LI/LMI',fontsize=fontsize)
_=ax[1].set_xlabel('$T$ (hr)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(tmp_LILMI,dur_inverse)
p_str = str(np.round(p,2))
if p<0.05:
p_str = '<0.05'
_=ax[1].text(400*.99,1*.99,'$r$='+str('%.2f' %np.round(r,2))+'\n$p$'+p_str,fontsize=fontsize,va='top',ha='right')
_=ax[1].text(-113,1,'(B)',fontsize=fontsize+2,fontweight='bold')
_=ax[1].set_ylim([0,1])
_=ax[1].set_xlim([0,400])
_=ax[1].set_xticks(np.arange(0,401,100))
#
Ref_B = 1.0e-7
B_inverse=np.asarray(B_inverse)
_=ax[0].plot(B_inverse/Ref_B,tmp_LILMI,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax[0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[0].set_ylabel('LI/LMI',fontsize=fontsize)
_=ax[0].set_xlabel('$\kappa/\kappa_o$',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(tmp_LILMI[~np.isnan(B_inverse)],B_inverse[~np.isnan(B_inverse)])
p_str = str('%.2f' %np.round(p,2))
if p<0.05:
p_str = '<0.05'
_=ax[0].text(7*.99,1*.99,'$r$='+str('%.2f' %np.round(r,2))+'\n$p$'+p_str,fontsize=fontsize,va='top',ha='right')
_=ax[0].text(-1.98,1,'(A)',fontsize=fontsize+2,fontweight='bold')
_=ax[0].set_ylim([0,1])
_=ax[0].set_xlim([0,7])
_=ax[0].set_xticks(np.arange(0,7.1,1))
#
plt.savefig('/home/sw1013/www/FIGURES/Figure_3.png',dpi=600,bbox_inches='tight')
plt.savefig('/home/sw1013/www/FIGURES/Figure_3.pdf',dpi=600,bbox_inches='tight')
supp. Figure
fig,ax=plt.subplots(1,2); fig.set_size_inches(7,3); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.4,hspace=0.3); fontsize = 8
interp_vmax_in_inverse = np.asarray(interp_vmax_in_inverse )
interp_vmax_pred_inverse = np.asarray(interp_vmax_pred_inverse)
dis_inverse = []
for CCC in range(len(VMAX_PMIN_SERIES)):
dis_inverse.extend([VMAX_PMIN_SERIES[CCC][3]])
dis_inverse=np.asarray(dis_inverse)
# tmp_LMI and tmp_LF of individual cases with B_inverse case sequence
tmp_LILMI = []
for CCC in range(len(B_inverse)):
tmp_LILMI.extend([interp_vmax_in_inverse[CCC][-1]/interp_vmax_in_inverse[CCC][ 0]])
tmp_LILMI=np.asarray(tmp_LILMI)
#
_=ax[0].plot(speed_inverse,tmp_LILMI,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax[0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[0].set_ylabel('LI/LMI',fontsize=fontsize)
_=ax[0].set_xlabel('$c$ (m s$^{-1}$)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(tmp_LILMI[~np.isnan(speed_inverse)],speed_inverse[~np.isnan(speed_inverse)])
p_str = str('%.2f' %(np.round(p,2)))
if p<0.05:
p_str = '<0.05'
_=ax[0].text(16*.99,1*.99,'$r$='+str(np.round(r,2))+'\n$p$='+p_str,fontsize=fontsize,va='top',ha='right')
_=ax[0].text(-3.2,1,'(A)',fontsize=fontsize+2,fontweight='bold')
_=ax[0].set_ylim([0,1])
_=ax[0].set_xlim([0,16])
_=ax[0].set_xticks(np.arange(0,17,2))
#
_=ax[1].plot(dis_inverse/1e3,dur_inverse,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax[1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[1].set_ylabel('$T$ (hr)',fontsize=fontsize)
_=ax[1].set_xlabel('$d$ (10$^3$ km)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(dur_inverse,dis_inverse)
p_str = str(np.round(p,2))
if p<0.05:
p_str = '<0.05'
_=ax[1].text(0.45*.99,400*.99,'$r$='+str(np.round(r,2))+'\n$p$'+p_str,fontsize=fontsize,va='top',ha='right')
_=ax[1].text(-.5,400,'(B)',fontsize=fontsize+2,fontweight='bold')
_=ax[1].set_ylim([0,400])
_=ax[1].set_xlim([0,2.5])
plt.savefig('/home/sw1013/www/FIGURES/Figure_supp5.png',dpi=600,bbox_inches='tight')
plt.savefig('/home/sw1013/www/FIGURES/Figure_supp5.pdf',dpi=600,bbox_inches='tight')
Basin breakdown - std
def basin_mean_std (AREA):
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]*.514444])
output1 = str(round(np.nanmean(tmp)).astype(int))+'±'+str(round(np.nanstd(tmp)).astype(int))+'('+str(round(np.nanstd(tmp)/np.nanmean(tmp)*100).astype(int))+'%)'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
output2 = str(round(np.nanmean(tmp)).astype(int))+'±'+str(round(np.nanstd(tmp)).astype(int))+'('+str(round(np.nanstd(tmp)/np.nanmean(tmp)*100).astype(int))+'%)'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([dur_inverse[CCC]])
output3 = str(round(np.nanmean(tmp)).astype(int))+'±'+str(round(np.nanstd(tmp)).astype(int))+'('+str(round(np.nanstd(tmp)/np.nanmean(tmp)*100).astype(int))+'%)'
Ref_B = 1.0e-7
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([B_inverse_dis[CCC]/Ref_B])
output4 = str(round(np.nanmean(tmp),1))+'±'+str(round(np.nanstd(tmp),1))+'('+str(round(np.nanstd(tmp)/np.nanmean(tmp)*100).astype(int))+'%)'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([B_inverse[CCC]*dur_inverse[CCC]*3600*1000])
output5 = str(round(np.nanmean(tmp),1))+'±'+str(round(np.nanstd(tmp),1))+'('+str(round(np.nanstd(tmp)/np.nanmean(tmp)*100).astype(int))+'%)'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([1/(VMAX_PMIN_SERIES[CCC][1][0]*.514444)*1000])
output6 = str(round(np.nanmean(tmp),1))+'±'+str(round(np.nanstd(tmp),1))+'('+str(round(np.nanstd(tmp)/np.nanmean(tmp)*100).astype(int))+'%)'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([trajectory_inverse[CCC]])
output7 = str(int(round(np.nanmean(tmp))))+'±'+str(int(round(np.nanstd(tmp))))+'('+str(round(np.nanstd(tmp)/np.nanmean(tmp)*100).astype(int))+'%)'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([speed_inverse[CCC]])
output8 = str(round(np.nanmean(tmp),1))+'±'+str(round(np.nanstd(tmp),1))+'('+str(round(np.nanstd(tmp)/np.nanmean(tmp)*100).astype(int))+'%)'
return output1, output2,output3,output4,output5,output6,output7,output8
TABLE = pd.DataFrame(index=['LMI','LI','$\Delta$t','$\kappa$','$\Delta$t${\times}\kappa$','1/LMI','$\Delta$d','c'],columns=['Global','NH','SH','WP','EP','NA','NI','SI','SP'])
for BBB,AREA in enumerate( [
['WP','EP','NA','NI','SI','SP'],
['WP','EP','NA','NI'],
['SI','SP'],
['WP'],
['EP'],
['NA'],
['NI'],
['SI'],
['SP'],
]):
output1,output2,output3,output4,output5,output6,output7,output8 = basin_mean_std(AREA)
TABLE.iloc[0,BBB] = output1
TABLE.iloc[1,BBB] = output2
TABLE.iloc[2,BBB] = output3
TABLE.iloc[3,BBB] = output4
TABLE.iloc[4,BBB] = output5
TABLE.iloc[5,BBB] = output6
TABLE.iloc[6,BBB] = output7
TABLE.iloc[7,BBB] = output8
TABLE
#TABLE.to_clipboard()
| Global | NH | SH | WP | EP | NA | NI | SI | SP | |
|---|---|---|---|---|---|---|---|---|---|
| LMI | 53±14(26%) | 53±14(27%) | 53±13(25%) | 54±14(26%) | 52±13(24%) | 52±15(29%) | 50±14(27%) | 53±13(25%) | 54±13(24%) |
| LI | 38±13(36%) | 37±13(36%) | 40±14(35%) | 37±13(34%) | 32±12(38%) | 40±14(36%) | 38±14(38%) | 41±14(35%) | 39±14(35%) |
| $\Delta$t | 35±46(132%) | 36±45(124%) | 30±51(170%) | 37±43(115%) | 44±48(111%) | 34±52(154%) | 20±28(139%) | 30±54(183%) | 31±43(138%) |
| $\kappa$ | 1.4±1.3(94%) | 1.3±1.3(97%) | 1.7±1.4(82%) | 1.1±1.1(99%) | 1.6±1.5(93%) | 1.5±1.4(93%) | 1.9±1.4(75%) | 1.8±1.4(79%) | 1.4±1.2(85%) |
| $\Delta$t${\times}\kappa$ | 9.2±10.8(118%) | 9.3±10.1(109%) | 8.7±13.6(157%) | 8.5±8.3(98%) | 13.4±13.6(101%) | 9.0±11.0(122%) | 10.1±13.4(133%) | 8.7±15.2(174%) | 8.5±8.1(96%) |
| 1/LMI | 20.1±5.5(27%) | 20.2±5.5(27%) | 20.1±5.4(27%) | 19.7±5.4(27%) | 20.2±4.8(24%) | 21.0±5.8(28%) | 21.5±5.8(27%) | 20.2±5.6(28%) | 19.8±4.9(25%) |
| $\Delta$d | 642±826(129%) | 690±855(124%) | 414±622(150%) | 732±769(105%) | 729±873(120%) | 738±1204(163%) | 287±355(124%) | 387±621(160%) | 479±620(129%) |
| c | 5.7±3.2(55%) | 5.9±3.3(55%) | 4.6±2.0(44%) | 6.0±2.1(36%) | 5.2±2.1(40%) | 6.6±6.4(98%) | 5.0±2.4(47%) | 4.4±1.7(40%) | 5.2±2.5(49%) |
Basin breakdown - Q3-Q1 / Q3+Q1
def basin_mean_std (AREA):
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]*.514444])
output1 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((np.nanquantile(tmp,.75)-np.nanquantile(tmp,.25)) / (np.nanquantile(tmp,.75)+np.nanquantile(tmp,.25)) * 100).astype(int))+')'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
output2 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((np.nanquantile(tmp,.75)-np.nanquantile(tmp,.25)) / (np.nanquantile(tmp,.75)+np.nanquantile(tmp,.25)) * 100).astype(int))+')'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([dur_inverse[CCC]])
output3 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((np.nanquantile(tmp,.75)-np.nanquantile(tmp,.25)) / (np.nanquantile(tmp,.75)+np.nanquantile(tmp,.25)) * 100).astype(int))+')'
Ref_B = 1.0e-7
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([B_inverse_dis[CCC]/Ref_B*10])
output4 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((np.nanquantile(tmp,.75)-np.nanquantile(tmp,.25)) / (np.nanquantile(tmp,.75)+np.nanquantile(tmp,.25)) * 100).astype(int))+')'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([B_inverse[CCC]*dur_inverse[CCC]*3600*1000])
output5 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((np.nanquantile(tmp,.75)-np.nanquantile(tmp,.25)) / (np.nanquantile(tmp,.75)+np.nanquantile(tmp,.25)) * 100).astype(int))+')'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([1/(VMAX_PMIN_SERIES[CCC][1][0]*.514444)*1000])
output6 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((np.nanquantile(tmp,.75)-np.nanquantile(tmp,.25)) / (np.nanquantile(tmp,.75)+np.nanquantile(tmp,.25)) * 100).astype(int))+')'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([trajectory_inverse[CCC]])
output7 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((np.nanquantile(tmp,.75)-np.nanquantile(tmp,.25)) / (np.nanquantile(tmp,.75)+np.nanquantile(tmp,.25)) * 100).astype(int))+')'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([speed_inverse[CCC]])
output8 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((np.nanquantile(tmp,.75)-np.nanquantile(tmp,.25)) / (np.nanquantile(tmp,.75)+np.nanquantile(tmp,.25)) * 100).astype(int))+')'
return output1, output2,output3,output4,output5,output6,output7,output8
TABLE = pd.DataFrame(index=['LMI','LI','$\Delta$t','$\kappa$','$\Delta$t${\times}\kappa$','1/LMI','$\Delta$d','c'],columns=['Global','NH','SH','WP','EP','NA','NI','SI','SP'])
for BBB,AREA in enumerate( [
['WP','EP','NA','NI','SI','SP'],
['WP','EP','NA','NI'],
['SI','SP'],
['WP'],
['EP'],
['NA'],
['NI'],
['SI'],
['SP'],
]):
output1,output2,output3,output4,output5,output6,output7,output8 = basin_mean_std(AREA)
TABLE.iloc[0,BBB] = output1
TABLE.iloc[1,BBB] = output2
TABLE.iloc[2,BBB] = output3
TABLE.iloc[3,BBB] = output4
TABLE.iloc[4,BBB] = output5
TABLE.iloc[5,BBB] = output6
TABLE.iloc[6,BBB] = output7
TABLE.iloc[7,BBB] = output8
TABLE[['Global','WP','EP','NA','NI','SI','SP']].reindex(['LI','LMI','1/LMI','$\Delta$t${\times}\kappa$','$\Delta$d','$\Delta$t','$\kappa$','c'])
#TABLE.to_clipboard()
| Global | WP | EP | NA | NI | SI | SP | |
|---|---|---|---|---|---|---|---|
| LI | 36(24) | 36(23) | 33(28) | 39(19) | 34(23) | 41(25) | 37(24) |
| LMI | 51(22) | 54(24) | 51(17) | 49(25) | 45(24) | 57(24) | 51(16) |
| 1/LMI | 19(22) | 19(24) | 19(18) | 21(25) | 22(24) | 18(24) | 19(16) |
| $\Delta$t${\times}\kappa$ | 5(62) | 6(60) | 8(69) | 5(61) | 4(59) | 4(45) | 6(79) |
| $\Delta$d | 282(82) | 455(80) | 383(75) | 168(87) | 164(69) | 185(75) | 213(81) |
| $\Delta$t | 15(78) | 21(80) | 24(85) | 9(89) | 8(78) | 9(70) | 12(86) |
| $\kappa$ | 10(53) | 8(50) | 10(48) | 10(61) | 13(42) | 13(53) | 10(40) |
| c | 5(27) | 6(22) | 5(31) | 6(32) | 5(28) | 4(28) | 5(22) |
Basin breakdown - median absolute deviation / median
def basin_mean_std (AREA):
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]*.514444])
output1 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((scipy.stats.median_absolute_deviation(tmp)) / (np.nanmean(tmp)) * 100).astype(int))+')'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
output2 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((scipy.stats.median_absolute_deviation(tmp)) / (np.nanmean(tmp)) * 100).astype(int))+')'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([dur_inverse[CCC]])
output3 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((scipy.stats.median_absolute_deviation(tmp)) / (np.nanmean(tmp)) * 100).astype(int))+')'
Ref_B = 1.0e-7
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([B_inverse_dis[CCC]/Ref_B*10])
output4 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((scipy.stats.median_absolute_deviation(tmp)) / (np.nanmean(tmp)) * 100).astype(int))+')'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([B_inverse[CCC]*dur_inverse[CCC]*3600*1000])
output5 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((scipy.stats.median_absolute_deviation(tmp)) / (np.nanmean(tmp)) * 100).astype(int))+')'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([1/(VMAX_PMIN_SERIES[CCC][1][0]*.514444)*1000])
output6 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((scipy.stats.median_absolute_deviation(tmp)) / (np.nanmean(tmp)) * 100).astype(int))+')'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([trajectory_inverse[CCC]])
output7 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((scipy.stats.median_absolute_deviation(tmp)) / (np.nanmean(tmp)) * 100).astype(int))+')'
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([speed_inverse[CCC]])
output8 = str(round(np.nanmedian(tmp)).astype(int))+'('+str(round((scipy.stats.median_absolute_deviation(tmp)) / (np.nanmean(tmp)) * 100).astype(int))+')'
return output1, output2,output3,output4,output5,output6,output7,output8
TABLE = pd.DataFrame(index=['LMI','LI','$\Delta$t','$\kappa$','$\Delta$t${\times}\kappa$','1/LMI','$\Delta$d','c'],columns=['Global','NH','SH','WP','EP','NA','NI','SI','SP'])
for BBB,AREA in enumerate( [
['WP','EP','NA','NI','SI','SP'],
['WP','EP','NA','NI'],
['SI','SP'],
['WP'],
['EP'],
['NA'],
['NI'],
['SI'],
['SP'],
]):
output1,output2,output3,output4,output5,output6,output7,output8 = basin_mean_std(AREA)
TABLE.iloc[0,BBB] = output1
TABLE.iloc[1,BBB] = output2
TABLE.iloc[2,BBB] = output3
TABLE.iloc[3,BBB] = output4
TABLE.iloc[4,BBB] = output5
TABLE.iloc[5,BBB] = output6
TABLE.iloc[6,BBB] = output7
TABLE.iloc[7,BBB] = output8
TABLE[['Global','WP','EP','NA','NI','SI','SP']].reindex(['LI','LMI','1/LMI','$\Delta$t${\times}\kappa$','$\Delta$d','$\Delta$t','$\kappa$','c'])
#TABLE.to_clipboard()
| Global | WP | EP | NA | NI | SI | SP | |
|---|---|---|---|---|---|---|---|
| LI | 36(34) | 36(31) | 33(48) | 39(29) | 34(48) | 41(38) | 37(35) |
| LMI | 51(36) | 54(35) | 51(29) | 49(37) | 45(34) | 57(29) | 51(28) |
| 1/LMI | 19(33) | 19(31) | 19(25) | 21(38) | 22(38) | 18(20) | 19(29) |
| $\Delta$t${\times}\kappa$ | 5(-9223372036854775808) | 6(-9223372036854775808) | 8(-9223372036854775808) | 5(-9223372036854775808) | 4(-9223372036854775808) | 4(-9223372036854775808) | 6(-9223372036854775808) |
| $\Delta$d | 282(54) | 455(74) | 383(58) | 168(34) | 164(61) | 185(52) | 213(51) |
| $\Delta$t | 15(51) | 21(71) | 24(71) | 9(33) | 8(45) | 9(30) | 12(43) |
| $\kappa$ | 10(54) | 8(47) | 10(39) | 10(61) | 13(48) | 13(57) | 10(45) |
| c | 5(-9223372036854775808) | 6(-9223372036854775808) | 5(-9223372036854775808) | 6(-9223372036854775808) | 5(-9223372036854775808) | 4(-9223372036854775808) | 5(-9223372036854775808) |
Major TC percentile
Ref_B = 1e-7
LI_inverse = []
for CCC in range(len(VMAX_PMIN_SERIES)):
LI_inverse.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
LI_inverse = np.asarray(LI_inverse)
A_inverse = np.asarray(A_inverse)
def find_var_percentile (x,AREA):
x = np.asarray(x)
tmp_AREA = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp_AREA.extend([True])
else:
tmp_AREA.extend([False])
tmp_TOP_LI = LI_inverse>=96*.514444 # np.percentile(LI_inverse[tmp_AREA],90)
return str(round(np.nanmedian(x[tmp_TOP_LI & tmp_AREA])).astype(int)) +'('+str(round(scipy.stats.percentileofscore(x[tmp_AREA],np.nanmedian(x[tmp_TOP_LI & tmp_AREA]))))+')'
TABLE = pd.DataFrame(index=['LI','LMI','1/LMI','$\Delta$t${\times}\kappa$','$\Delta$d','$\Delta$t','$\kappa$','c'],columns=['Global','NH','SH','WP','EP','NA','NI','SI','SP'])
for BBB,AREA in enumerate( [
['WP','EP','NA','NI','SI','SP'],
['WP','EP','NA','NI'],
['SI','SP'],
['WP'],
['EP'],
['NA'],
['NI'],
['SI'],
['SP'],
]):
dur_inverse = np.asarray(dur_inverse)
TABLE.iloc[0,BBB] = find_var_percentile(LI_inverse ,AREA)
TABLE.iloc[1,BBB] = find_var_percentile(A_inverse ,AREA)
TABLE.iloc[2,BBB] = find_var_percentile(1/A_inverse *1000,AREA)
TABLE.iloc[3,BBB] = find_var_percentile(dur_inverse*3600*B_inverse *1000,AREA)
TABLE.iloc[4,BBB] = find_var_percentile(trajectory_inverse ,AREA)
TABLE.iloc[5,BBB] = find_var_percentile(dur_inverse ,AREA)
TABLE.iloc[6,BBB] = find_var_percentile(B_inverse /Ref_B*10,AREA)
TABLE.iloc[7,BBB] = find_var_percentile(speed_inverse ,AREA)
TABLE[['Global','WP','EP','NA','NI','SI','SP']]
| Global | WP | EP | NA | NI | SI | SP | |
|---|---|---|---|---|---|---|---|
| LI | 57(91) | 57(93) | 53(97) | 59(91) | 57(89) | 57(86) | 57(89) |
| LMI | 67(80) | 69(81) | 68(93) | 67(80) | 67(84) | 64(77) | 64(77) |
| 1/LMI | 15(21) | 14(19) | 15(7) | 15(20) | 15(16) | 16(24) | 16(26) |
| $\Delta$t${\times}\kappa$ | 2(17) | 2(14) | 3(18) | 2(22) | 2(23) | 3(24) | 1(20) |
| $\Delta$d | 122(32) | 183(33) | 332(45) | 116(45) | 65(32) | 81(32) | 91(35) |
| $\Delta$t | 9(39) | 9(34) | 12(38) | 4(39) | 4(38) | 9(47) | 4(32) |
| $\kappa$ | 6(31) | 5(29) | 7(37) | 6(27) | 6(18) | 7(33) | 6(38) |
| c | 6(54) | 6(56) | 7(72) | 7(65) | 4(39) | 4(48) | 7(73) |
Total landfall TCs, LMI, LI, t (>0 ie LMI not LI time), κ distribution
fig,ax=plt.subplots(2,2); fig.set_size_inches(7,7); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.4,hspace=0.3); fontsize = 8
A_inverse = np.asarray(A_inverse)
X= A_inverse[dur_inverse>0]
_=ax[0][0].hist(X,density=True,bins=10)
_=ax[0][0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[0][0].set_xticks(np.arange(0,101,10))
_=ax[0][0].set_xlabel('LMI (m s$^{-1}$)',fontsize=fontsize)
_=ax[0][0].set_ylabel('Probability density function',fontsize=fontsize)
_=ax[0][0].set_ylim(0,0.04)
_=ax[0][0].set_xlim(0,100)
_=ax[0][0].text(-28,0.04,'(A)',fontsize=fontsize+2,fontweight='bold')
#_=ax[0][0].plot([np.nanpercentile(X,50),np.nanpercentile(X,50)],[0,10],'-k')
#_=ax[0][0].plot([np.nanpercentile(X,25),np.nanpercentile(X,25)],[0,10],'--k')
#_=ax[0][0].plot([np.nanpercentile(X,75),np.nanpercentile(X,75)],[0,10],'--k')
X=LI_inverse[dur_inverse>-1]
_=ax[0][1].hist(X,density=True,bins=10)
_=ax[0][1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[0][1].set_xticks(np.arange(0,101,10))
_=ax[0][1].set_xlabel('LI (m s$^{-1}$)',fontsize=fontsize)
_=ax[0][1].set_ylabel('Probability density function',fontsize=fontsize)
_=ax[0][1].set_ylim(0,0.035)
_=ax[0][1].set_xlim(0,100)
_=ax[0][1].text(-28,0.035,'(B)',fontsize=fontsize+2,fontweight='bold')
#_=ax[0][1].plot([np.nanpercentile(X,50),np.nanpercentile(X,50)],[0,10],'-k')
#_=ax[0][1].plot([np.nanpercentile(X,25),np.nanpercentile(X,25)],[0,10],'--k')
#_=ax[0][1].plot([np.nanpercentile(X,75),np.nanpercentile(X,75)],[0,10],'--k')
X=dur_inverse[dur_inverse>-1]
_=ax[1][0].hist(X,density=True,bins=10)
_=ax[1][0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[1][0].set_xticks(np.arange(0,401,50))
_=ax[1][0].set_xlabel('$T$ (hr)',fontsize=fontsize)
_=ax[1][0].set_ylabel('Probability density function',fontsize=fontsize)
_=ax[1][0].set_ylim(0,0.02)
_=ax[1][0].set_xlim(0,400)
_=ax[1][0].text(-112,0.02,'(C)',fontsize=fontsize+2,fontweight='bold')
#_=ax[1][0].plot([np.nanpercentile(X,50),np.nanpercentile(X,50)],[0,10],'-k')
#_=ax[1][0].plot([np.nanpercentile(X,25),np.nanpercentile(X,25)],[0,10],'--k')
#_=ax[1][0].plot([np.nanpercentile(X,75),np.nanpercentile(X,75)],[0,10],'--k')
X=B_inverse[dur_inverse>-1]/Ref_B
_=ax[1][1].hist(X,density=True,bins=10)
_=ax[1][1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[1][1].set_xticks(np.arange(0,6.1,1))
_=ax[1][1].set_xlabel('$\kappa/\kappa_o$',fontsize=fontsize)
_=ax[1][1].set_ylabel('Probability density function',fontsize=fontsize)
_=ax[1][1].set_ylim(0,.9)
_=ax[1][1].set_xlim(0,7)
_=ax[1][1].text(-1.96,.9,'(D)',fontsize=fontsize+2,fontweight='bold')
#_=ax[1][1].plot([np.nanpercentile(X,50),np.nanpercentile(X,50)],[0,10],'-k')
#_=ax[1][1].plot([np.nanpercentile(X,25),np.nanpercentile(X,25)],[0,10],'--k')
#_=ax[1][1].plot([np.nanpercentile(X,75),np.nanpercentile(X,75)],[0,10],'--k')
plt.savefig('/home/sw1013/www/FIGURES/Figure_supp7.png',dpi=600,bbox_inches='tight')
plt.savefig('/home/sw1013/www/FIGURES/Figure_supp7.pdf',dpi=600,bbox_inches='tight')
Top 10 percentile
LI_inverse = []
for CCC in range(len(VMAX_PMIN_SERIES)):
LI_inverse.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
LI_inverse = np.asarray(LI_inverse)
A_inverse = np.asarray(A_inverse)
def find_var_percentile (x,AREA):
x = np.asarray(x)
tmp_AREA = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp_AREA.extend([True])
else:
tmp_AREA.extend([False])
tmp_TOP_LI = LI_inverse>=np.percentile(LI_inverse[tmp_AREA],90)
return str(round(np.nanmedian(x[tmp_TOP_LI & tmp_AREA])).astype(int)) +'('+str(round(scipy.stats.percentileofscore(x[tmp_AREA],np.nanmedian(x[tmp_TOP_LI & tmp_AREA]))))+')'
TABLE = pd.DataFrame(index=['LI','LMI','1/LMI','$\Delta$t${\times}\kappa$','$\Delta$d','$\Delta$t','$\kappa$','c'],columns=['Global','NH','SH','WP','EP','NA','NI','SI','SP'])
for BBB,AREA in enumerate( [
['WP','EP','NA','NI','SI','SP'],
['WP','EP','NA','NI'],
['SI','SP'],
['WP'],
['EP'],
['NA'],
['NI'],
['SI'],
['SP'],
]):
dur_inverse = np.asarray(dur_inverse)
TABLE.iloc[0,BBB] = find_var_percentile(LI_inverse ,AREA)
TABLE.iloc[1,BBB] = find_var_percentile(A_inverse ,AREA)
TABLE.iloc[2,BBB] = find_var_percentile(1/A_inverse *1000,AREA)
TABLE.iloc[3,BBB] = find_var_percentile(dur_inverse*3600*B_inverse *1000,AREA)
TABLE.iloc[4,BBB] = find_var_percentile(trajectory_inverse ,AREA)
TABLE.iloc[5,BBB] = find_var_percentile(dur_inverse ,AREA)
TABLE.iloc[6,BBB] = find_var_percentile(B_inverse /Ref_B*10,AREA)
TABLE.iloc[7,BBB] = find_var_percentile(speed_inverse ,AREA)
TABLE[['Global','WP','EP','NA','NI','SI','SP']]
| Global | WP | EP | NA | NI | SI | SP | |
|---|---|---|---|---|---|---|---|
| LI | 62(95) | 59(95) | 51(96) | 64(95) | 59(95) | 64(96) | 61(95) |
| LMI | 71(86) | 69(81) | 59(69) | 77(93) | 64(77) | 67(84) | 67(82) |
| 1/LMI | 14(14) | 14(19) | 17(32) | 13(8) | 16(23) | 15(17) | 15(22) |
| $\Delta$t${\times}\kappa$ | 2(12) | 2(11) | 3(21) | 2(19) | 2(14) | 2(12) | 1(20) |
| $\Delta$d | 105(29) | 159(30) | 266(42) | 188(53) | 47(23) | 32(11) | 91(35) |
| $\Delta$t | 6(30) | 9(34) | 12(38) | 9(50) | 3(27) | 3(16) | 4(32) |
| $\kappa$ | 6(32) | 6(37) | 9(49) | 4(22) | 5(14) | 6(24) | 6(35) |
| c | 6(55) | 6(59) | 6(67) | 7(67) | 5(62) | 3(30) | 7(73) |
PLOT: full track and filtered track check
plt.close(); plt.figure(figsize=(7,2),dpi=200)
ax=[]
gs0 = gridspec.GridSpec(1, 1)
gs0.update(left=0.05, right=0.98, bottom=0.1, top=0.9, hspace=0.06, wspace=0.1)
ax.append(plt.subplot(gs0[0, 0]))
fontsize = 7
#### density map plot
# draw base maps
m = Basemap(projection='cyl', llcrnrlat=-40, urcrnrlat=40,llcrnrlon=0, urcrnrlon=361,resolution='i',ax=ax[0])
_ = m.drawcoastlines(linewidth=.5,color='k',zorder=10)
_ = m.drawmapboundary(fill_color='w')
_ = m.fillcontinents(color='none',lake_color='none')
_ = m.drawmeridians(np.arange(0,361,45),labels=[0,0,0,1],linewidth=0.,fontsize=fontsize)
_ = m.drawparallels(np.arange(-40,41,20),labels=[1,0,0,0],linewidth=0.,fontsize=fontsize)
#
def plot_track(x):
tmp_lon = x.USA_LON.values
tmp_lat = x.USA_LAT.values
tmp_lon [tmp_lon<0] = tmp_lon [tmp_lon<0] + 360
_=ax[0].plot(x.USA_LON,x.USA_LAT,lw=.3,color='b',zorder=1)
#
RRR_LMI= x.iloc[::-1].USA_WIND.idxmax()
tmp_x=x[x.LF_MARKER==1]
RRR_LF = tmp_x.USA_WIND.idxmax()
pick = x[(x.index>=RRR_LMI)&(x.index<=RRR_LF)]
tmp_lat = pick.USA_LAT.values[:]
tmp_lon = pick.USA_LON.values[:]
_=ax[0].plot(tmp_lon,tmp_lat,lw=.3,color='red',zorder=2)
#
#if pick.USA_WIND.values[-1]*0.5144444>=np.nanpercentile(LI_inverse,90):
if pick.USA_WIND.values[-1]*0.5144444>=50:
_=ax[0].plot(tmp_lon[-1],tmp_lat[-1],'oy',lw=.3,ms=3,zorder=3,alpha=1)
_=newbt_lf.groupby('SID').apply(lambda x: plot_track(x))
plt.savefig('/home/sw1013/www/FIGURES/Figure_supp.png',bbox_inches='tight', format='pdf',dpi=600)
plt.savefig('/home/sw1013/www/FIGURES/Figure_supp.pdf',bbox_inches='tight', format='pdf',dpi=600)
<Figure size 1400x400 with 0 Axes>
Figure 4
fig,ax=plt.subplots(1,1); fig.set_size_inches(3,3); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.4,hspace=0.3); fontsize = 8
#
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (year_inverse[CCC] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]>=CAT_KT.CAT3.LOWER):
tmp.extend([dur_inverse[CCC]])
Y.extend([np.nanmedian(tmp)])
sample_weight.extend([len(tmp)])
_=ax.plot(X,Y,'-C0',lw=1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
lns1=ax.plot(x_trend,y_trend,'-',lw=3,color='C0',label='Duration ('+str(int(round(slope*10)))+'±'+str(int(round(ci*10)))+' hr decade$^{-1}$)')
_=ax.tick_params(axis='both', which='major', labelsize=fontsize)
#_=ax.legend(fontsize=fontsize,loc=2,handlelength=1.6)
_=ax.set_xticks(range(1980,2021,5))
_=ax.set_ylim([0,100])
_=ax.set_yticks(np.arange(0,70,10))
_=ax.set_yticklabels(np.arange(0,70,10),fontsize=fontsize,color='C0')
_=ax.tick_params(axis='y', colors='C0')
_=ax.set_xlabel('Year',fontsize=fontsize)
_=ax.set_ylabel('Duration of decay (hr)',fontsize=fontsize,color='C0')
#_=ax.text(1975,110,'a',fontsize=fontsize,fontweight='bold')
bx=ax.twinx()
_=bx.plot([-100000,-200000],[-100000,-200000],'-',lw=3,color='k',label='Duration ('+str(int(round(slope*10)))+'±'+str(int(round(ci*10)))+' hr decade$^{-1}$)')
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]>=CAT_KT.CAT3.LOWER):
tmp.extend([trajectory_inverse[CCC]])
Y.extend([np.nanmedian(tmp)])
sample_weight.extend([len(tmp)])
_=bx.plot(X,Y,'-C1',lw=1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
lns2=bx.plot(x_trend,y_trend,'-',lw=3,color='C1',label='Distance ('+str(int(round(slope*10)))+'±'+str(int(round(ci*10)))+' km decade$^{-1}$)')
_=bx.tick_params(axis='both', which='major', labelsize=fontsize)
#_=bx.legend(fontsize=fontsize,loc=2,handlelength=1.6)
_=bx.set_xticks(range(1980,2021,5))
_=bx.set_ylim([-500,2200])
_=bx.set_xlim([1980,2020])
_=bx.set_yticks(np.arange(0,2001,400))
_=bx.set_yticklabels(np.arange(0,2001,400),fontsize=fontsize,color='C1')
_=bx.tick_params(axis='y', colors='C1')
_=bx.set_xlabel('Year',fontsize=fontsize)
_=bx.set_ylabel('LMI location to landfall (km)',fontsize=fontsize,color='C1')
_=bx.yaxis.set_label_coords(1.15,0.62)
_=ax.yaxis.set_label_coords(-0.1,0.31)
lns = lns1+lns2
labs = [l.get_label() for l in lns]
_=ax.legend(lns, labs, fontsize=fontsize,loc=2,bbox_to_anchor=[-.01,1.01])
plt.savefig('/home/sw1013/www/FIGURES/Figure_supp.png',dpi=600,bbox_inches='tight')
plt.savefig('/home/sw1013/www/FIGURES/Figure_supp.pdf',dpi=600,bbox_inches='tight')
fig,ax=plt.subplots(1,1); fig.set_size_inches(3,3); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.4,hspace=0.3); fontsize = 8
#
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]>=CAT_KT.CAT3.LOWER):
tmp.extend([trajectory_inverse[CCC]])
Y.extend([np.nanmedian(tmp)])
sample_weight.extend([len(tmp)])
_=ax.plot(X,Y/np.max(Y),'-C1',lw=1,zorder=4)
print(np.max(Y))
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax.plot(x_trend,y_trend/np.max(Y),'-',lw=3,color='C1',label='$d$ ('+str(int(round(slope*10)))+' km decade$^{-1}$, $p$='+str(round(p,2))+')',zorder=5)
#
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (year_inverse[CCC] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]>=CAT_KT.CAT3.LOWER):
tmp.extend([dur_inverse[CCC]])
Y.extend([np.nanmedian(tmp)])
sample_weight.extend([len(tmp)])
_=ax.plot(X,Y/np.max(Y)/1.1,'-C0',lw=1,zorder=4)
print(np.max(Y)/1.1)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax.plot(x_trend,y_trend/np.max(Y)/1.1,'-',lw=3,color='C0',label='$T$ ('+str(int(round(slope*10)))+' hr decade$^{-1}$, $p$='+str(round(p,2))+')',zorder=5)
#
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]>=CAT_KT.CAT3.LOWER):
tmp.extend([B_inverse[CCC]/Ref_B])
Y.extend([np.nanmedian(tmp)])
sample_weight.extend([len(tmp)])
_=ax.plot(X,Y/np.max(Y)/1.2,'-C2',lw=1,zorder=4)
print(np.max(Y)/1.2)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax.plot(x_trend,y_trend/np.max(Y)/1.2,'-',lw=3,color='C2',label='$\kappa$ ('+str(round(slope*10*1e2).astype(int))+'×10$^{-2}$ $\kappa_o$ decade$^{-1}$, $p$='+str(round(p,2))+')',zorder=5)
#
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR):# & (VMAX_PMIN_SERIES[CCC][0]>=CAT_KT.CAT3.LOWER):
tmp.extend([B_inverse[CCC]*dur_inverse[CCC]*3600])
Y.extend([np.nanmedian(tmp)])
sample_weight.extend([len(tmp)])
_=ax.plot(X,Y/np.max(Y)/1.3,'-C3',lw=1,zorder=4)
print(np.max(Y)/1.3)
x_trend, y_trend,slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax.plot(x_trend,y_trend/np.max(Y)/1.3,'-',lw=3,color='C3',label='$\kappa{d/c}$ ('+str(round(slope*10*1e4).astype(int))+'×10$^{-4}$ s m$^{-1}$ decade$^{-1}$, $p$='+str(round(p,2))+')',zorder=5)
#
_=ax.tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.legend(fontsize=fontsize,loc=2,bbox_to_anchor=(0.0,1.3))
_=ax.set_xticks(range(1980,2021,5))
#_=ax.set_ylim([0,100])
#_=ax.set_yticks(np.arange(0,70,10))
#_=ax.set_yticklabels(np.arange(0,70,10),fontsize=fontsize,color='C0')
_=ax.set_xlabel('Year',fontsize=fontsize)
_=ax.set_ylabel('',fontsize=fontsize)
#_=ax.text(1975,110,'a',fontsize=fontsize,fontweight='bold')
plt.savefig('/home/sw1013/www/FIGURES/Figure_supp3.png',dpi=600,bbox_inches='tight')
plt.savefig('/home/sw1013/www/FIGURES/Figure_supp3.pdf',dpi=600,bbox_inches='tight')
1160.8390621546816 49.090909090909086 1.3752445850759576 0.009233803314944776
tmptmp_LMI = []
tmptmp_LI = []
for CCC in range(len(B_inverse)):
tmptmp_LMI.extend([interp_vmax_in_inverse[CCC][ 0]])
tmptmp_LI .extend([interp_vmax_in_inverse[CCC][-1]])
tmptmp_LMI=np.asarray(tmptmp_LMI)
tmptmp_LI =np.asarray(tmptmp_LI )
np.nanmedian(tmptmp_LMI)
np.nanmedian(tmptmp_LI )
np.nanmedian(dur_inverse)
51.444
36.0108
15.0
I/O: ERA5 read in
ERA5_U_00_fh = Dataset('/net/wrfstore7-10/disk1/sw1013/ERA5/u_00061218.nc' )
ERA5_U_03_fh = Dataset('/net/wrfstore7-10/disk1/sw1013/ERA5/u_03091521.nc' )
ERA5_V_00_fh = Dataset('/net/wrfstore7-10/disk1/sw1013/ERA5/v_00061218.nc' )
ERA5_V_03_fh = Dataset('/net/wrfstore7-10/disk1/sw1013/ERA5/v_03091521.nc' )
#ERA5_R_00_fh = Dataset('/net/wrfstore7-10/disk1/sw1013/ERA5/r_00061218.nc' )
#ERA5_R_03_fh = Dataset('/net/wrfstore7-10/disk1/sw1013/ERA5/r_03091521.nc' )
ERA5_SST_00_fh = Dataset('/net/wrfstore7-10/disk1/sw1013/ERA5/sst_00061218.nc')
ERA5_SST_03_fh = Dataset('/net/wrfstore7-10/disk1/sw1013/ERA5/sst_03091521.nc')
ERA5_TD2M_00_fh= Dataset('/net/wrfstore7-10/disk1/sw1013/ERA5/td2m_00061218.nc' )
ERA5_TD2M_03_fh= Dataset('/net/wrfstore7-10/disk1/sw1013/ERA5/td2m_03091521.nc' )
ERA5_T2M_00_fh = Dataset('/net/wrfstore7-10/disk1/sw1013/ERA5/t2m_00061218.nc' )
ERA5_T2M_03_fh = Dataset('/net/wrfstore7-10/disk1/sw1013/ERA5/t2m_03091521.nc' )
ERA5_SP_00_fh = Dataset('/net/wrfstore7-10/disk1/sw1013/ERA5/sp_00061218.nc' )
ERA5_SP_03_fh = Dataset('/net/wrfstore7-10/disk1/sw1013/ERA5/sp_03091521.nc' )
TIME_00_SINCE_1900 = ERA5_U_00_fh.variables['time'][:]
TIME_03_SINCE_1900 = ERA5_U_03_fh.variables['time'][:]
LAT=ERA5_U_00_fh.variables['latitude']
LON=ERA5_U_00_fh.variables['longitude']
LON,LAT = np.meshgrid(LON,LAT)
DEF: find_shear_one_record(x)
def find_shear_one_record(x):
C_LAT = x.USA_LAT
C_LON = x.USA_LON
TIME = x.ISO_TIME
#print(x.SEASON.values[0])
tmp_time = datetime.strptime(TIME, "%Y-%m-%d %H:%M:%S") - datetime.strptime("1900-01-01 00:00:00", "%Y-%m-%d %H:%M:%S")
TIME_SPOT = int(tmp_time.days*24+tmp_time.seconds/3600)
TIME_READ_00 = np.nanargmin(abs(TIME_SPOT-TIME_00_SINCE_1900))
TIME_READ_03 = np.nanargmin(abs(TIME_SPOT-TIME_03_SINCE_1900))
if np.min(abs(TIME_SPOT-TIME_00_SINCE_1900))<=np.min(abs(TIME_SPOT-TIME_03_SINCE_1900)):
TIME_READ = TIME_READ_00
U200=ERA5_U_00_fh .variables['u' ][TIME_READ,0].data
U850=ERA5_U_00_fh .variables['u' ][TIME_READ,1].data
V200=ERA5_V_00_fh .variables['v' ][TIME_READ,0].data
V850=ERA5_V_00_fh .variables['v' ][TIME_READ,1].data
#R700=ERA5_R_00_fh .variables['r' ][TIME_READ,0].data
#R850=ERA5_R_00_fh .variables['r' ][TIME_READ,1].data
SST =ERA5_SST_00_fh.variables['sst'][TIME_READ ].data
else:
TIME_READ = TIME_READ_03
U200=ERA5_U_03_fh .variables['u' ][TIME_READ,0].data
U850=ERA5_U_03_fh .variables['u' ][TIME_READ,1].data
V200=ERA5_V_03_fh .variables['v' ][TIME_READ,0].data
V850=ERA5_V_03_fh .variables['v' ][TIME_READ,1].data
#R700=ERA5_R_03_fh .variables['r' ][TIME_READ,0].data
#R850=ERA5_R_03_fh .variables['r' ][TIME_READ,1].data
SST =ERA5_SST_03_fh.variables['sst'][TIME_READ ].data
DIST = np.sqrt((C_LAT-LAT)**2+(C_LON-LON)**2)
DIST[(DIST<2) | (DIST>8)]=np.nan
U200[np.isnan(DIST)]=np.nan
U850[np.isnan(DIST)]=np.nan
V200[np.isnan(DIST)]=np.nan
V850[np.isnan(DIST)]=np.nan
#R700[np.isnan(DIST)]=np.nan
#R850[np.isnan(DIST)]=np.nan
tmp_u200 = np.nanmean(U200)
tmp_u850 = np.nanmean(U850)
tmp_v200 = np.nanmean(V200)
tmp_v850 = np.nanmean(V850)
#tmp_r700 = np.nanmean(R700)
#tmp_r850 = np.nanmean(R850)
SHEAR=np.sqrt((tmp_u200-tmp_u850)**2+(tmp_v200-tmp_v850)**2)
UPPERWIND = np.sqrt((tmp_u200)**2+(tmp_v200)**2)
LOWERWIND = np.sqrt((tmp_u850)**2+(tmp_v850)**2)
#LOWERHUMID= (tmp_r700+tmp_r850)/2
DIST = np.sqrt((C_LAT-LAT)**2+(C_LON-LON)**2)
DIST[DIST>8]=np.nan
SST[np.isnan(DIST)]=np.nan
SST[SST==-32767.0]=np.nan
tmp_sst = np.nanmean(SST)
SSTUNDER= tmp_sst
return [SHEAR, UPPERWIND, LOWERWIND, np.nan,SSTUNDER]
DEF: download_ERA5_calc_MPI(x) Only run this stript if you want to download the ERA5 data
def download_ERA5_calc_MPI(x):
# YEAR,MONTH,DAY,HR are strings. e.g. YEAR:'2008'; MONTH:'06'; DAY:'09'; HR:'03'
# LAT, LON are floating. e.g. LAT:21.2; LON:120.3
OUTPUT_TAG = x['SID']+'_'+x['ISO_TIME'][0:4]+x['ISO_TIME'][5:7]+x['ISO_TIME'][8:10]+x['ISO_TIME'][11:13]+x['ISO_TIME'][14:16]+x['ISO_TIME'][17:19]
utc = x['ISO_TIME']
time0 = datetime.strptime(utc, "%Y-%m-%d %H:%M:%S")
delta_sec = -3600*24*3
lst = datetime.strftime(time0+timedelta(0,delta_sec),"%Y-%m-%d %H:%M:%S")
utc = lst
YEAR = utc[ 0: 4]
MONTH = utc[ 5: 7]
DAY = utc[ 8:10]
HR = utc[11:13]
LAT = x['USA_LAT']
LON = x['USA_LON']
if np.isnan(LAT) or np.isnan(LON):
MPI = np.nan
else:
AREA_RADIUS = 0
c = cdsapi.Client()
c.retrieve(
'reanalysis-era5-pressure-levels',
{
'product_type': 'reanalysis',
'format': 'netcdf',
'variable': ['specific_humidity', 'temperature'],
'pressure_level': [
'1', '2', '3',
'5', '7', '10',
'20', '30', '50',
'70', '100', '125',
'150', '175', '200',
'225', '250', '300',
'350', '400', '450',
'500', '550', '600',
'650', '700', '750',
'775', '800', '825',
'850', '875', '900',
'925', '950', '975',
'1000',
],
'year': YEAR,
'month': MONTH,
'day': DAY,
'time': HR+':00',
'area': [
LAT+AREA_RADIUS, LON-AREA_RADIUS, LAT-AREA_RADIUS,
LON+AREA_RADIUS,
],
},
'/net/wrfstore7-10/disk1/sw1013/MPI_ERA5_BYCASE/'+OUTPUT_TAG+'_AIR.nc')
c.retrieve(
'reanalysis-era5-single-levels',
{
'product_type': 'reanalysis',
'format': 'netcdf',
'variable': [
'mean_sea_level_pressure', 'sea_surface_temperature',
],
'year': YEAR,
'month': MONTH,
'day': DAY,
'time': HR+':00',
'area': [
LAT+AREA_RADIUS, LON-AREA_RADIUS, LAT-AREA_RADIUS,
LON+AREA_RADIUS,
],
},
'/net/wrfstore7-10/disk1/sw1013/MPI_ERA5_BYCASE/'+OUTPUT_TAG+'_SURF.nc')
fh = Dataset('/net/wrfstore7-10/disk1/sw1013/MPI_ERA5_BYCASE/'+OUTPUT_TAG+'_AIR.nc')
Q =np.flip ( fh.variables['q' ][:].data.squeeze() * 1.e3 ) # unit g/kg
T =np.flip ( fh.variables['t' ][:].data.squeeze() - 273.15 ) # unit C
P =np.flip ( fh.variables['level' ][:].data ) # unit hPa
fh = Dataset('/net/wrfstore7-10/disk1/sw1013/MPI_ERA5_BYCASE/'+OUTPUT_TAG+'_SURF.nc')
MSL =np.flip ( fh.variables['msl' ][:].data.squeeze() / 1.e2 ) # unit hPa
SST =np.flip ( fh.variables['sst' ][:].data.squeeze() - 273.15 ) # unit C
#tmp = PMIN,VMAX,TO,IFL,RAT,CAPEMS,CAPEM,FAC
tmp = pcmin(SST,MSL, P, T, Q)
#x['MPI'] = MPI
if ~np.isnan(tmp[1]):
return tmp
else:
return np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan
DEF: use_ERA5_calc_MPI(x) this stript only uses downloaded ERA5 data
def use_ERA5_calc_MPI(x):
# YEAR,MONTH,DAY,HR are strings. e.g. YEAR:'2008'; MONTH:'06'; DAY:'09'; HR:'03'
# LAT, LON are floating. e.g. LAT:21.2; LON:120.3
OUTPUT_TAG = x['SID']+'_'+x['ISO_TIME'][0:4]+x['ISO_TIME'][5:7]+x['ISO_TIME'][8:10]+x['ISO_TIME'][11:13]+x['ISO_TIME'][14:16]+x['ISO_TIME'][17:19]
utc = x['ISO_TIME']
time0 = datetime.strptime(utc, "%Y-%m-%d %H:%M:%S")
delta_sec = -3600*24*3
lst = datetime.strftime(time0+timedelta(0,delta_sec),"%Y-%m-%d %H:%M:%S")
utc = lst
YEAR = utc[ 0: 4]
MONTH = utc[ 5: 7]
DAY = utc[ 8:10]
HR = utc[11:13]
LAT = x['USA_LAT']
LON = x['USA_LON']
if np.isnan(LAT) or np.isnan(LON):
return np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan
else:
if []==glob.glob('/net/wrfstore7-10/disk1/sw1013/MPI_ERA5_BYCASE/'+OUTPUT_TAG+'_AIR.nc'):
AREA_RADIUS = 0
c = cdsapi.Client()
c.retrieve(
'reanalysis-era5-pressure-levels',
{
'product_type': 'reanalysis',
'format': 'netcdf',
'variable': ['specific_humidity', 'temperature'],
'pressure_level': [
'1', '2', '3',
'5', '7', '10',
'20', '30', '50',
'70', '100', '125',
'150', '175', '200',
'225', '250', '300',
'350', '400', '450',
'500', '550', '600',
'650', '700', '750',
'775', '800', '825',
'850', '875', '900',
'925', '950', '975',
'1000',
],
'year': YEAR,
'month': MONTH,
'day': DAY,
'time': HR+':00',
'area': [
LAT+AREA_RADIUS, LON-AREA_RADIUS, LAT-AREA_RADIUS,
LON+AREA_RADIUS,
],
},
'/net/wrfstore7-10/disk1/sw1013/MPI_ERA5_BYCASE/'+OUTPUT_TAG+'_AIR.nc')
c.retrieve(
'reanalysis-era5-single-levels',
{
'product_type': 'reanalysis',
'format': 'netcdf',
'variable': [
'mean_sea_level_pressure', 'sea_surface_temperature',
],
'year': YEAR,
'month': MONTH,
'day': DAY,
'time': HR+':00',
'area': [
LAT+AREA_RADIUS, LON-AREA_RADIUS, LAT-AREA_RADIUS,
LON+AREA_RADIUS,
],
},
'/net/wrfstore7-10/disk1/sw1013/MPI_ERA5_BYCASE/'+OUTPUT_TAG+'_SURF.nc')
fh = Dataset('/net/wrfstore7-10/disk1/sw1013/MPI_ERA5_BYCASE/'+OUTPUT_TAG+'_AIR.nc')
Q =np.flip ( fh.variables['q' ][:].data.squeeze() * 1.e3 ) # unit g/kg
T =np.flip ( fh.variables['t' ][:].data.squeeze() - 273.15 ) # unit C
P =np.flip ( fh.variables['level' ][:].data ) # unit hPa
fh = Dataset('/net/wrfstore7-10/disk1/sw1013/MPI_ERA5_BYCASE/'+OUTPUT_TAG+'_SURF.nc')
MSL =np.flip ( fh.variables['msl' ][:].data.squeeze() / 1.e2 ) # unit hPa
SST =np.flip ( fh.variables['sst' ][:].data.squeeze() - 273.15 ) # unit C
#tmp = PMIN,VMAX,TO,IFL,RAT,CAPEMS,CAPEM,FAC
tmp = pcmin(SST,MSL, P, T, Q)
#x['MPI'] = MPI
if ~np.isnan(tmp[1]):
return tmp
else:
return np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan,np.nan
DEF: CALC_MOVING_SPEED(tmp_lat,tmp_lon)
def CALC_MOVING_SPEED(tmp_lat,tmp_lon):
tmp_uv = np.nan * np.zeros(shape=tmp_lat.shape)
for RRR in range(len(tmp_lat)-1):
coords_1 = (tmp_lat[RRR ], tmp_lon[RRR ])
coords_2 = (tmp_lat[RRR+1], tmp_lon[RRR+1])
tmp_uv[RRR] = geopy.distance.vincenty(coords_1, coords_2).m/6./3600.
return tmp_uv
DEF: keep_one_from_lmi_to_lf_fraction(x,FRAC)
def keep_one_from_lmi_to_lf_fraction(x,FRAC):
#print(x.SID.values[0])
RRR_LMI= len(x)-np.nanargmax(x.iloc[::-1].USA_WIND.values)-1
RRR_LF = np.nanargmax(x.LF_MARKER.values)
if RRR_LMI + FRAC <= RRR_LF :
RRR = RRR_LMI + FRAC
output = x.iloc[int(RRR)]
tmp = find_shear_one_record(output)
output['HOUR_TO_LF'] = 3*(RRR_LF-RRR)
output['SHEAR' ] = tmp[0]
output['UPPERWIND' ] = tmp[1]
output['LOWERWIND' ] = tmp[2]
output['LOWERHUMID'] = tmp[3]
output['SST' ] = tmp[4]
tmp = CALC_MOVING_SPEED(x.iloc[int(RRR-1):int(RRR+1)].USA_LAT.values,x.iloc[int(RRR-1):int(RRR+1)].USA_LON.values)
output['TRANSLATION' ] = tmp[0]
# PMIN,VMAX,TO,IFL,RAT,CAPEMS,CAPEM,FAC
tmp = use_ERA5_calc_MPI(output)
#tmp = download_ERA5_calc_MPI(output)
output['MPI3DAY' ] = tmp[1]/0.514444
output['TOUT3DAY' ] = tmp[2]
output['SST3DAY' ] = tmp[2] * tmp[4]
output['CAPEMS' ] = tmp[5]
output['CAPEM' ] = tmp[6]
return output
SPLIT_PERIOD = np.arange(0,131,1)
for tmp,FRAC in enumerate(SPLIT_PERIOD):
print(FRAC)
if tmp == 0:
VAR = newbt_lf.groupby('SID').apply(lambda x: keep_one_from_lmi_to_lf_fraction(x,FRAC))
else:
VAR = VAR.append(newbt_lf.groupby('SID').apply(lambda x: keep_one_from_lmi_to_lf_fraction(x,FRAC)))
VARbackup = copy.copy(VAR)
VAR = copy.copy(VARbackup)
VAR=VAR.reset_index(level=0, drop=True)
SHEAR = VAR.groupby('SID').apply(lambda x:np.nanmean(x.SHEAR))
LOWERHUMID = VAR.groupby('SID').apply(lambda x:np.nanmean(x.LOWERHUMID))
SST = VAR.groupby('SID').apply(lambda x:np.nanmean(x.SST3DAY))
SEASON = VAR.groupby('SID').apply(lambda x:np.nanmean(x.SEASON))
MPI = VAR.groupby('SID').apply(lambda x:np.nanmean(x.MPI3DAY))
CLAT = VAR.groupby('SID').apply(lambda x:np.nanmean(np.abs(x.LAT)))
TRANSLATION= VAR.groupby('SID').apply(lambda x:np.nanmean(x.TRANSLATION))
Sterm = VAR.groupby('SID').apply(lambda x:np.nanmean( np.sqrt(abs(x.CAPEMS-x.CAPEM)) / np.sqrt(abs(x.SST3DAY-x.TOUT3DAY)) ))
Tterm = VAR.groupby('SID').apply(lambda x:np.nanmean( np.sqrt(abs(x.SST3DAY/x.TOUT3DAY*(x.SST3DAY-x.TOUT3DAY))) ))
TOUTFLOW = VAR.groupby('SID').apply(lambda x:np.nanmean( x.TOUT3DAY))
LMI = VAR.groupby('SID').apply(lambda x:x.USA_WIND.values[0])
LI = VAR.groupby('SID').apply(lambda x:x.USA_WIND.values[-1])
MPILMI = VAR.groupby('SID').apply(lambda x:x.MPI3DAY.values[0])
SHEARLMI = VAR.groupby('SID').apply(lambda x:x.SHEAR.values[0])
TtermLMI = VAR.groupby('SID').apply(lambda x:np.sqrt(abs(x.SST3DAY.values[0]/x.TOUT3DAY.values[0]*(x.SST3DAY.values[0]-x.TOUT3DAY.values[0]))) )
StermLMI = VAR.groupby('SID').apply(lambda x:np.sqrt(abs(x.CAPEMS.values[0]-x.CAPEM.values[0])) / np.sqrt(abs(x.SST3DAY.values[0]-x.TOUT3DAY.values[0])) )
SSTLMI = VAR.groupby('SID').apply(lambda x:x.SST3DAY.values[0])
TOUTFLOWLMI= VAR.groupby('SID').apply(lambda x:x.TOUT3DAY.values[0])
fig,ax=plt.subplots(3,3); fig.set_size_inches(10,10); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.4,hspace=0.3); fontsize = 8
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(SEASON)):
if SEASON[CCC]==YEAR:
tmp.extend([SHEAR[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
_=ax[0][0].plot(X,Y,'-k',lw=.5)
x_trend, y_trend,slope,ci,_ = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[0][0].plot(x_trend,y_trend,'-',color='C1',label='p='+str(np.round(p,2))+'\nslope='+str(np.round((y_trend[-1]-y_trend[0])/(x_trend[-1]-x_trend[0])*10,1))+' m s$^{-1}$/decade')
_=ax[0][0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[0][0].legend(fontsize=fontsize)
_=ax[0][0].set_xticks(range(1980,2021,5))
#_=ax[0][0].set_ylim([50,90])
_=ax[0][0].set_xlabel('Year')
_=ax[0][0].set_ylabel('Shear m s$^{-1}$')
Y_SHEAR = Y
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(SEASON)):
if SEASON[CCC]==YEAR:
tmp.extend([LOWERHUMID[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
_=ax[0][1].plot(X,Y,'-k',lw=.5)
x_trend, y_trend,slope,ci,_ = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[0][1].plot(x_trend,y_trend,'-',color='C1',label='p='+str(np.round(p,2))+'\nslope='+str(np.round((y_trend[-1]-y_trend[0])/(x_trend[-1]-x_trend[0])*10,1))+' %/decade')
_=ax[0][1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[0][1].legend(fontsize=fontsize)
_=ax[0][1].set_xticks(range(1980,2021,5))
#_=ax[0][1].set_ylim([50,90])
_=ax[0][1].set_xlabel('Year')
_=ax[0][1].set_ylabel('Low-level RH %')
Y_RH = Y
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(SEASON)):
if SEASON[CCC]==YEAR:
tmp.extend([CLAT[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
_=ax[0][2].plot(X,Y,'-k',lw=.5)
x_trend, y_trend,slope,ci,_ = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[0][2].plot(x_trend,y_trend,'-',color='C1',label='p='+str(np.round(p,2))+'\nslope='+str(np.round((y_trend[-1]-y_trend[0])/(x_trend[-1]-x_trend[0])*10,1))+' %/decade')
_=ax[0][2].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[0][2].legend(fontsize=fontsize)
_=ax[0][2].set_xticks(range(1980,2021,5))
#_=ax[0][2].set_ylim([50,90])
_=ax[0][2].set_xlabel('Year')
_=ax[0][2].set_ylabel('Latitude (deg)')
Y_RH = Y
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(SEASON)):
if SEASON[CCC]==YEAR:
tmp.extend([TRANSLATION[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
_=ax[1][0].plot(X,Y,'-k',lw=.5)
x_trend, y_trend,slope,ci,_ = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[1][0].plot(x_trend,y_trend,'-',color='C1',label='p='+str(np.round(p,2))+'\nslope='+str(np.round((y_trend[-1]-y_trend[0])/(x_trend[-1]-x_trend[0])*10,1))+' m s$^{-1}$/decade')
_=ax[1][0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[1][0].legend(fontsize=fontsize)
_=ax[1][0].set_xticks(range(1980,2021,5))
#_=ax[1][0].set_ylim([50,90])
_=ax[1][0].set_xlabel('Year')
_=ax[1][0].set_ylabel('Translation m s$^{-1}$')
Y_MPI = Y
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(SEASON)):
if SEASON[CCC]==YEAR:
tmp.extend([MPI[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
_=ax[1][1].plot(X,Y,'-k',lw=.5)
x_trend, y_trend,slope,ci,_ = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[1][1].plot(x_trend,y_trend,'-',color='C1',label='p='+str(np.round(p,2))+'\nslope='+str(np.round((y_trend[-1]-y_trend[0])/(x_trend[-1]-x_trend[0])*10,1))+' kt/decade')
_=ax[1][1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[1][1].legend(fontsize=fontsize)
_=ax[1][1].set_xticks(range(1980,2021,5))
#_=ax[1][1].set_ylim([50,90])
_=ax[1][1].set_xlabel('Year')
_=ax[1][1].set_ylabel('MPI (3 days before) kt')
Y_MPI = Y
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(SEASON)):
if SEASON[CCC]==YEAR:
tmp.extend([SST[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
_=ax[1][2].plot(X,Y,'-k',lw=.5)
x_trend, y_trend,slope,ci,_ = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[1][2].plot(x_trend,y_trend,'-',color='C1',label='p='+str(np.round(p,2))+'\nslope='+str(np.round((y_trend[-1]-y_trend[0])/(x_trend[-1]-x_trend[0])*10,1))+' K/decade')
_=ax[1][2].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[1][2].legend(fontsize=fontsize)
_=ax[1][2].set_xticks(range(1980,2021,5))
#_=ax[1][2].set_ylim([50,90])
_=ax[1][2].set_xlabel('Year')
_=ax[1][2].set_ylabel('MPI: $T_s$ K')
Y_SST = Y
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(SEASON)):
if SEASON[CCC]==YEAR:
tmp.extend([Tterm[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
_=ax[2][0].plot(X,Y,'-k',lw=.5)
x_trend, y_trend,slope,ci,_ = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[2][0].plot(x_trend,y_trend,'-',color='C1',label='p='+str(np.round(p,2))+'\nslope='+str(np.round((y_trend[-1]-y_trend[0])/(x_trend[-1]-x_trend[0])*10,1))+' /decade')
_=ax[2][0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[2][0].legend(fontsize=fontsize)
_=ax[2][0].set_xticks(range(1980,2021,5))
#_=ax[2][0].set_ylim([50,90])
_=ax[2][0].set_xlabel('Year')
_=ax[2][0].set_ylabel(r'MPI: $\sqrt{(T_s-T_o)\frac{T_s}{T_o}}$')
Y_MPI = Y
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(SEASON)):
if SEASON[CCC]==YEAR:
tmp.extend([Sterm[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
_=ax[2][1].plot(X,Y,'-k',lw=.5)
x_trend, y_trend,slope,ci,_ = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[2][1].plot(x_trend,y_trend,'-',color='C1',label='p='+str(np.round(p,2))+'\nslope='+str(np.round((y_trend[-1]-y_trend[0])/(x_trend[-1]-x_trend[0])*10,1))+' /decade')
_=ax[2][1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[2][1].legend(fontsize=fontsize)
_=ax[2][1].set_xticks(range(1980,2021,5))
#_=ax[2][1].set_ylim([50,90])
_=ax[2][1].set_xlabel('Year')
_=ax[2][1].set_ylabel('MPI: $\sqrt{s^*-s}$')
Y_MPI = Y
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(SEASON)):
if SEASON[CCC]==YEAR:
tmp.extend([TOUTFLOW[CCC]])
Y.extend([np.nanmean(tmp)])
sample_weight.extend([len(tmp)])
_=ax[2][2].plot(X,Y,'-k',lw=.5)
x_trend, y_trend,slope,ci,_ = get_trend_and_ci_weight(X,Y,sample_weight)
_=ax[2][2].plot(x_trend,y_trend,'-',color='C1',label='p='+str(np.round(p,2))+'\nslope='+str(np.round((y_trend[-1]-y_trend[0])/(x_trend[-1]-x_trend[0])*10,1))+' K/decade')
_=ax[2][2].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[2][2].legend(fontsize=fontsize)
_=ax[2][2].set_xticks(range(1980,2021,5))
#_=ax[2][2].set_ylim([50,90])
_=ax[2][2].set_xlabel('Year')
_=ax[2][2].set_ylabel('MPI: $T_o$ K')
Y_MPI = Y
_=ax[2][2].text(1900,190,r'$MPI=0.8\sqrt{\frac{C_k}{C_d}}\sqrt{(T_s-T_o)\frac{T_s}{T_o}}\sqrt{s^*-s}$',fontsize=20)
Correlation bewteen decay factors and environment
Individual case correlation
tmp_B = np.asarray(B_inverse ) [(~np.isnan(SST))&(~np.isnan(B_inverse))]
tmp_DIS = np.asarray(trajectory_inverse) [(~np.isnan(SST))&(~np.isnan(B_inverse))]
tmp_DUR = np.asarray(dur_inverse ) [(~np.isnan(SST))&(~np.isnan(B_inverse))]
tmp_LMI = np.asarray(A_inverse ) [(~np.isnan(SST))&(~np.isnan(B_inverse))]
tmp_LI = np.asarray(LI ) [(~np.isnan(SST))&(~np.isnan(B_inverse))]
tmp_SHEAR = np.asarray(SHEAR ) [(~np.isnan(SST))&(~np.isnan(B_inverse))]
tmp_LAT = np.asarray(CLAT ) [(~np.isnan(SST))&(~np.isnan(B_inverse))]
tmp_V = np.asarray(speed_inverse ) [(~np.isnan(SST))&(~np.isnan(B_inverse))]
tmp_BDUR = np.asarray(B_inverse*dur_inverse*3600)[(~np.isnan(SST))&(~np.isnan(B_inverse))]
tmp_MPI = np.asarray(MPI ) [(~np.isnan(SST))&(~np.isnan(B_inverse))]
tmp_SST = np.asarray(SST ) [(~np.isnan(SST))&(~np.isnan(B_inverse))]
TABLE = pd.DataFrame(index=['k','D','T','kT'],columns=['LMI','Lat','Shear','SST','MPI'])
def r_and_p(X,Y):
_,_,r,p,_ = scipy.stats.linregress(scipy.signal.detrend(X),scipy.signal.detrend(Y))
return str(round(r,2))+'('+str(round(p,2))+')'
TABLE.Lat.D = r_and_p(tmp_LAT,tmp_DIS)
TABLE.Lat.T = r_and_p(tmp_LAT,tmp_DUR)
TABLE.Lat.k = r_and_p(tmp_LAT,tmp_B )
TABLE.Lat.kT = r_and_p(tmp_LAT,tmp_BDUR )
TABLE.Shear.D = r_and_p(tmp_SHEAR,tmp_DIS)
TABLE.Shear.T = r_and_p(tmp_SHEAR,tmp_DUR)
TABLE.Shear.k = r_and_p(tmp_SHEAR,tmp_B )
TABLE.Shear.kT = r_and_p(tmp_SHEAR,tmp_BDUR )
TABLE.SST.D = r_and_p(tmp_SST,tmp_DIS)
TABLE.SST.T = r_and_p(tmp_SST,tmp_DUR)
TABLE.SST.k = r_and_p(tmp_SST,tmp_B )
TABLE.SST.kT = r_and_p(tmp_SST,tmp_BDUR )
TABLE.LMI.D = r_and_p(tmp_LMI,tmp_DIS)
TABLE.LMI.T = r_and_p(tmp_LMI,tmp_DUR)
TABLE.LMI.k = r_and_p(tmp_LMI,tmp_B )
TABLE.LMI.kT = r_and_p(tmp_LMI,tmp_BDUR )
TABLE.MPI.D = r_and_p(tmp_MPI,tmp_DIS)
TABLE.MPI.T = r_and_p(tmp_MPI,tmp_DUR)
TABLE.MPI.k = r_and_p(tmp_MPI,tmp_B )
TABLE.MPI.kT = r_and_p(tmp_MPI,tmp_BDUR )
TABLE
| LMI | Lat | Shear | SST | MPI | |
|---|---|---|---|---|---|
| k | -0.47(0.0) | 0.01(0.79) | 0.09(0.02) | -0.01(0.8) | -0.01(0.7) |
| D | 0.3(0.0) | 0.23(0.0) | 0.17(0.0) | -0.35(0.0) | -0.3(0.0) |
| T | 0.29(0.0) | 0.1(0.01) | 0.08(0.04) | -0.22(0.0) | -0.2(0.0) |
| kT | -0.08(0.05) | 0.08(0.05) | 0.25(0.0) | -0.38(0.0) | -0.3(0.0) |
fig,ax=plt.subplots(1,2); fig.set_size_inches(7,3); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.4,hspace=0.3); fontsize = 8
#
_=ax[0].plot(tmp_MPI*0.514444,tmp_B/Ref_B,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax[0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[0].set_ylabel('$\kappa/\kappa_o$',fontsize=fontsize)
_=ax[0].set_xlabel('Potential intensity (m s$^{-1}$)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(tmp_MPI,tmp_B)
p_str = str(np.round(p,2))
r_str = str('='+'%.2f' %np.round(r,2))
if p<0.05:
p_str = '<0.05'
else:
p_str = '='+str(round(p,2))
if r<0.01:
r_str = '<0.01'
_=ax[0].text(100*.99,7*.99,'$r$'+r_str+'\n$p$'+p_str,fontsize=fontsize,va='top',ha='right')
_=ax[0].text(-20,7,'(A)',fontsize=fontsize+2,fontweight='bold')
_=ax[0].set_ylim([0,7])
_=ax[0].set_xlim([0,100])
#_=ax[0].set_xticks(np.arange(0,17,2))
#
_=ax[1].plot(tmp_SHEAR,tmp_B/Ref_B,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax[1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax[1].set_ylabel('$\kappa/\kappa_o$',fontsize=fontsize)
_=ax[1].set_xlabel('Vertical wind shear (m s$^{-1}$)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(tmp_SHEAR,tmp_B)
p_str = '='+str(np.round(p,2))
if p<0.05:
p_str = '<0.05'
_=ax[1].text(30*.99,7*.99,'$r$='+str(np.round(r,2))+'\n$p$'+p_str,fontsize=fontsize,va='top',ha='right')
_=ax[1].text(-6,7,'(B)',fontsize=fontsize+2,fontweight='bold')
_=ax[1].set_ylim([0,7])
_=ax[1].set_xlim([0,30])
plt.savefig('/home/sw1013/www/FIGURES/Figure_supp4.png',dpi=600,bbox_inches='tight')
plt.savefig('/home/sw1013/www/FIGURES/Figure_supp4.pdf',dpi=600,bbox_inches='tight')
fig,ax=plt.subplots(2,2); fig.set_size_inches(7,7); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.3,hspace=0.3); fontsize = 8
interp_vmax_in_inverse = np.asarray(interp_vmax_in_inverse )
interp_vmax_pred_inverse = np.asarray(interp_vmax_pred_inverse)
dis_inverse = []
for CCC in range(len(VMAX_PMIN_SERIES)):
dis_inverse.extend([VMAX_PMIN_SERIES[CCC][3]])
dis_inverse=np.asarray(dis_inverse)
# tmp_LMI and tmp_LF of individual cases with B_inverse case sequence
tmp_LILMI,tmp_LI,tmp_LMI = [],[],[]
for CCC in range(len(B_inverse)):
tmp_LILMI.extend([interp_vmax_in_inverse[CCC][-1]/interp_vmax_in_inverse[CCC][ 0]])
tmp_LI .extend([interp_vmax_in_inverse[CCC][-1] * 0.51444444 ])
tmp_LMI .extend([interp_vmax_in_inverse[CCC][ 0] * 0.51444444 ])
tmp_LILMI,tmp_LI,tmp_LMI=np.asarray(tmp_LILMI),np.asarray(tmp_LI),np.asarray(tmp_LMI)
tmp_DIS = np.asarray(trajectory_inverse) [(~np.isnan(SST))]
tmp_DUR = np.asarray(dur_inverse ) [(~np.isnan(SST))]
tmp_LILMI = np.asarray(tmp_LILMI ) [(~np.isnan(SST))]
tmp_LI = np.asarray(tmp_LI ) [(~np.isnan(SST))]
tmp_LMI = np.asarray(tmp_LMI ) [(~np.isnan(SST))]
tmp_SHEAR = np.asarray(SHEAR ) [(~np.isnan(SST))]
tmp_MPI = np.asarray(MPI ) [(~np.isnan(SST))]
tmp_C = np.asarray(speed_inverse ) [(~np.isnan(SST))]
#---------------------------------------------------------------------------------------------
_=ax.flatten()[0].plot(tmp_DIS/1e3,tmp_LILMI,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax.flatten()[0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[0].set_ylabel('LI/LMI',fontsize=fontsize)
_=ax.flatten()[0].set_xlabel('$d$ (10$^3$ km)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(tmp_LILMI,tmp_DIS)
p_str = '='+str('%.2f' %np.round(p,2))
if p<0.05:
p_str = '<0.05'
_=ax.flatten()[0].text(7*.99,1*.99,'$r$='+str('%.2f' %np.round(r,2))+'\n$p$'+p_str,fontsize=fontsize,va='top',ha='right')
_=ax.flatten()[0].text(-1.5,1,'(A)',fontsize=fontsize+2,fontweight='bold')
_=ax.flatten()[0].set_ylim([0,1])
_=ax.flatten()[0].set_xlim([0,7])
_=ax.flatten()[0].set_xticks(np.arange(0,8,1))
#-------------------------------------------------------------------------------------------------
_=ax.flatten()[1].plot(tmp_DUR,tmp_LILMI,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax.flatten()[1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[1].set_ylabel('LI/LMI',fontsize=fontsize)
_=ax.flatten()[1].set_xlabel('$T$ (hr)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(tmp_LILMI,tmp_DUR)
p_str = str(np.round(p,2))
if p<0.05:
p_str = '<0.05'
_=ax.flatten()[1].text(400*.99,1*.99,'$r$='+str('%.2f' %np.round(r,2))+'\n$p$'+p_str,fontsize=fontsize,va='top',ha='right')
_=ax.flatten()[1].text(-85.7,1,'(B)',fontsize=fontsize+2,fontweight='bold')
_=ax.flatten()[1].set_ylim([0,1])
_=ax.flatten()[1].set_xlim([0,400])
_=ax.flatten()[1].set_xticks(np.arange(0,401,100))
# -------------------------------------------------------------------------------------------------
_=ax.flatten()[2].plot(tmp_C,tmp_LILMI,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax.flatten()[2].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[2].set_ylabel('LI/LMI',fontsize=fontsize)
_=ax.flatten()[2].set_xlabel('$c$ (m s$^{-1}$)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(tmp_LILMI[~np.isnan(tmp_C)],tmp_C[~np.isnan(tmp_C)])
p_str = '='+str('%.2f' %np.round(p,2))
if p<0.05:
p_str = '<0.05'
_=ax.flatten()[2].text(16*.99,0*.99,'$r$='+str('%.2f' %np.round(r,2))+'\n$p$'+p_str,fontsize=fontsize,va='bottom',ha='right')
_=ax.flatten()[2].text(-3.43,1,'(C)',fontsize=fontsize+2,fontweight='bold')
_=ax.flatten()[2].set_ylim([0,1])
_=ax.flatten()[2].set_xlim([0,16])
_=ax.flatten()[2].set_xticks(np.arange(0,17,2))
_=ax.flatten()[3].plot(tmp_DIS/1e3,tmp_DUR,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax.flatten()[3].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[3].set_ylabel('$T$ (hr)',fontsize=fontsize)
_=ax.flatten()[3].set_xlabel('$d$ (10$^3$ km)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(dur_inverse,dis_inverse)
p_str = str(np.round(p,2))
if p<0.05:
p_str = '<0.05'
_=ax.flatten()[3].text(7*.99,400*.99,'$r$='+str(np.round(r,2))+'\n$p$'+p_str,fontsize=fontsize,va='top',ha='right')
_=ax.flatten()[3].text(-1.5,400,'(D)',fontsize=fontsize+2,fontweight='bold')
_=ax.flatten()[3].set_ylim([0,400])
_=ax.flatten()[3].set_xlim([0,7])
plt.savefig('/home/sw1013/www/FIGURES/Figure_3.png',dpi=600,bbox_inches='tight')
fig,ax=plt.subplots(3,2); fig.set_size_inches(7,10); fig.set_facecolor('w'); fig.set_edgecolor('k');fig.set_dpi(100);
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05, wspace=0.3,hspace=0.3); fontsize = 8
interp_vmax_in_inverse = np.asarray(interp_vmax_in_inverse )
interp_vmax_pred_inverse = np.asarray(interp_vmax_pred_inverse)
dis_inverse = []
for CCC in range(len(VMAX_PMIN_SERIES)):
dis_inverse.extend([VMAX_PMIN_SERIES[CCC][3]])
dis_inverse=np.asarray(dis_inverse)
# tmp_LMI and tmp_LF of individual cases with B_inverse case sequence
tmp_LILMI,tmp_LI,tmp_LMI = [],[],[]
for CCC in range(len(B_inverse)):
tmp_LILMI.extend([interp_vmax_in_inverse[CCC][-1]/interp_vmax_in_inverse[CCC][ 0]])
tmp_LI .extend([interp_vmax_in_inverse[CCC][-1] * 0.51444444 ])
tmp_LMI .extend([interp_vmax_in_inverse[CCC][ 0] * 0.51444444 ])
tmp_LILMI,tmp_LI,tmp_LMI=np.asarray(tmp_LILMI),np.asarray(tmp_LI),np.asarray(tmp_LMI)
tmp_DIS = np.asarray(trajectory_inverse) [(~np.isnan(SST))]
tmp_DUR = np.asarray(dur_inverse ) [(~np.isnan(SST))]
tmp_LILMI = np.asarray(tmp_LILMI ) [(~np.isnan(SST))]
tmp_LI = np.asarray(tmp_LI ) [(~np.isnan(SST))]
tmp_LMI = np.asarray(tmp_LMI ) [(~np.isnan(SST))]
tmp_SHEAR = np.asarray(SHEAR ) [(~np.isnan(SST))]
tmp_MPI = np.asarray(MPI ) [(~np.isnan(SST))]
tmp_C = np.asarray(speed_inverse ) [(~np.isnan(SST))]
#---------------------------------------------------------------------------------------------
_=ax.flatten()[0].plot(tmp_DIS/1e3,tmp_LILMI,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax.flatten()[0].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[0].set_ylabel('LI/LMI',fontsize=fontsize)
_=ax.flatten()[0].set_xlabel('$d$ (10$^3$ km)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(tmp_LILMI,tmp_DIS)
p_str = '='+str('%.2f' %np.round(p,2))
if p<0.05:
p_str = '<0.05'
_=ax.flatten()[0].set_title('$r^2$='+str('%.0f' %np.round(r**2*100,0))+'%, $p$'+p_str,fontsize=fontsize)
_=ax.flatten()[0].text(-1.5,1,'(A)',fontsize=fontsize+2,fontweight='bold')
_=ax.flatten()[0].set_ylim([0,1])
_=ax.flatten()[0].set_xlim([0,7])
_=ax.flatten()[0].set_xticks(np.arange(0,8,1))
#-------------------------------------------------------------------------------------------------
_=ax.flatten()[1].plot(tmp_DUR,tmp_LILMI,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax.flatten()[1].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[1].set_ylabel('LI/LMI',fontsize=fontsize)
_=ax.flatten()[1].set_xlabel('$T$ (hr)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(tmp_LILMI,tmp_DUR)
p_str = str(np.round(p,2))
if p<0.05:
p_str = '<0.05'
_=ax.flatten()[1].set_title('$r^2$='+str('%.0f' %np.round(r**2*100,0))+'%, $p$'+p_str,fontsize=fontsize)
_=ax.flatten()[1].text(-85.7,1,'(B)',fontsize=fontsize+2,fontweight='bold')
_=ax.flatten()[1].set_ylim([0,1])
_=ax.flatten()[1].set_xlim([0,400])
_=ax.flatten()[1].set_xticks(np.arange(0,401,100))
# -------------------------------------------------------------------------------------------------
_=ax.flatten()[2].plot(tmp_C,tmp_LILMI,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax.flatten()[2].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[2].set_ylabel('LI/LMI',fontsize=fontsize)
_=ax.flatten()[2].set_xlabel('$c$ (m s$^{-1}$)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(tmp_LILMI[~np.isnan(tmp_C)],tmp_C[~np.isnan(tmp_C)])
p_str = '='+str('%.2f' %np.round(p,2))
if p<0.05:
p_str = '<0.05'
_=ax.flatten()[2].set_title('$r^2$='+str('%.0f' %np.round(r**2*100,0))+'%, $p$'+p_str,fontsize=fontsize)
_=ax.flatten()[2].text(-3.43,1,'(C)',fontsize=fontsize+2,fontweight='bold')
_=ax.flatten()[2].set_ylim([0,1])
_=ax.flatten()[2].set_xlim([0,16])
_=ax.flatten()[2].set_xticks(np.arange(0,17,2))
#-----------------------------------------------------------------------------------------------------
_=ax.flatten()[3].plot(tmp_DIS/1e3,tmp_DUR,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax.flatten()[3].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[3].set_ylabel('$T$ (hr)',fontsize=fontsize)
_=ax.flatten()[3].set_xlabel('$d$ (10$^3$ km)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(dur_inverse,dis_inverse)
p_str = str(np.round(p,2))
if p<0.05:
p_str = '<0.05'
_=ax.flatten()[3].set_title('$r^2$='+str('%.0f' %np.round(r**2*100,0))+'%, $p$'+p_str,fontsize=fontsize)
_=ax.flatten()[3].text(-1.5,400,'(D)',fontsize=fontsize+2,fontweight='bold')
_=ax.flatten()[3].set_ylim([0,400])
_=ax.flatten()[3].set_xlim([0,7])
#---------------------------------------------------------------------------------------------
_=ax.flatten()[4].plot(tmp_MPI*.51444444,tmp_LILMI,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax.flatten()[4].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[4].set_ylabel('LI/LMI',fontsize=fontsize)
_=ax.flatten()[4].set_xlabel('MPI (m s$^{-1}$)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(tmp_LILMI,tmp_MPI)
p_str = '='+str('%.2f' %np.round(p,2))
if p<0.05:
p_str = '<0.05'
_=ax.flatten()[4].set_title('$r^2$='+str('%.0f' %np.round(r**2*100,0))+'%, $p$'+p_str,fontsize=fontsize)
_=ax.flatten()[4].text(-21.4,1,'(E)',fontsize=fontsize+2,fontweight='bold')
_=ax.flatten()[4].set_ylim([0,1])
_=ax.flatten()[4].set_xlim([0,100])
#_=ax.flatten()[4].set_xticks(np.arange(0,8,1))
#-------------------------------------------------------------------------------------------------
_=ax.flatten()[5].plot(tmp_SHEAR,tmp_LILMI,'o',color='k',ms=6,alpha=.5,mec='none')
_=ax.flatten()[5].tick_params(axis='both', which='major', labelsize=fontsize)
_=ax.flatten()[5].set_ylabel('LI/LMI',fontsize=fontsize)
_=ax.flatten()[5].set_xlabel('Shear (m s$^{-1}$)',fontsize=fontsize)
_,_,r,p,_ = scipy.stats.linregress(tmp_LILMI,tmp_SHEAR)
p_str = str(np.round(p,2))
if p<0.05:
p_str = '<0.05'
_=ax.flatten()[5].set_title('$r^2$='+str('%.0f' %np.round(r**2*100,0))+'%, $p$'+p_str,fontsize=fontsize)
_=ax.flatten()[5].text(-5.36,1,'(F)',fontsize=fontsize+2,fontweight='bold')
_=ax.flatten()[5].set_ylim([0,1])
_=ax.flatten()[5].set_xlim([0,25])
#_=ax.flatten()[5].set_xticks(np.arange(0,401,100))
plt.savefig('/home/sw1013/www/FIGURES/Figure_3.png',dpi=600,bbox_inches='tight')
Annual trend coreraltion
X = INDEX_year
tmp_B = []
for YEAR in X:
tmp = []
for CCC in range(len(B_inverse)):
if (year_inverse[CCC] == YEAR):# & (A_inverse[CCC] >= CAT_KT.CAT3.LOWER) :
tmp.extend([B_inverse[CCC]])
tmp=np.asarray(tmp)
tmp_B.extend([np.nanmean(tmp)])
tmp_B = np.asarray(tmp_B)
tmp_DUR = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (year_inverse[CCC] == YEAR):
tmp.extend([3*len(vmax_in_inverse[CCC])])
tmp_DUR.extend([np.nanmean(tmp)])
tmp_DUR = np.asarray(tmp_DUR)
tmp_LMI = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (year_inverse[CCC] == YEAR):
tmp.extend([A_inverse[CCC]])
tmp_LMI.extend([np.nanmean(tmp)])
tmp_LMI = np.asarray(tmp_LMI)
tmp_SHEAR = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(SEASON)):
if SEASON[CCC]==YEAR:
tmp.extend([SHEAR[CCC]])
tmp_SHEAR.extend([np.nanmean(tmp)])
tmp_SHEAR=np.asarray(tmp_SHEAR)
tmp_LAT = []
for YEAR in X:
tmp = []
for CCC in range(len(SEASON)):
if SEASON[CCC]==YEAR:
tmp.extend([CLAT[CCC]])
tmp_LAT.extend([np.nanmean(tmp)])
tmp_LAT=np.asarray(tmp_LAT)
tmp_SST = []
for YEAR in X:
tmp = []
for CCC in range(len(SEASON)):
if SEASON[CCC]==YEAR:
tmp.extend([SST[CCC]])
tmp_SST.extend([np.nanmean(tmp)])
tmp_SST=np.asarray(tmp_SST)
TABLE = pd.DataFrame(index=['LMI','Duration','k'],columns=['Lat','Shear','SST'])
def r_and_p(X,Y):
_,_,r,p,_ = scipy.stats.linregress(scipy.signal.detrend(X),scipy.signal.detrend(Y))
return str(round(r,2))+'('+str(round(p,2))+')'
TABLE.Lat.LMI = r_and_p(tmp_LAT,tmp_LMI)
TABLE.Lat.Duration = r_and_p(tmp_LAT,tmp_DUR)
TABLE.Lat.k = r_and_p(tmp_LAT,tmp_B )
TABLE.Shear.LMI = r_and_p(tmp_SHEAR,tmp_LMI)
TABLE.Shear.Duration = r_and_p(tmp_SHEAR,tmp_DUR)
TABLE.Shear.k = r_and_p(tmp_SHEAR,tmp_B )
TABLE.SST.LMI = r_and_p(tmp_SST,tmp_LMI)
TABLE.SST.Duration = r_and_p(tmp_SST,tmp_DUR)
TABLE.SST.k = r_and_p(tmp_SST,tmp_B )
TABLE
Major TC decay epcohal change and major percentiles
LI_inverse = []
for CCC in range(len(VMAX_PMIN_SERIES)):
LI_inverse.extend([VMAX_PMIN_SERIES[CCC][1][-1]*.514444])
LI_inverse = np.asarray(LI_inverse)
A_inverse = np.asarray(A_inverse)
B_inverse = np.asarray(B_inverse)
year_inverse = np.asarray(year_inverse)
tmp_TOP_LI = LI_inverse>=50.
tmp_before = year_inverse<=2000
tmp_after = year_inverse>=2001
def find_var_percentile (x,AREA):
x = np.asarray(x)
tmp_AREA = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp_AREA.extend([True])
else:
tmp_AREA.extend([False])
output_first_row = str(round(np.nanmedian(x[tmp_TOP_LI & tmp_AREA])).astype(int)) +'('+str(round(scipy.stats.percentileofscore(x[tmp_AREA],np.nanmedian(x[tmp_TOP_LI & tmp_AREA]))))+')'
mean = np.nanmean(x[tmp_TOP_LI & tmp_AREA & tmp_after]) - np.nanmean(x[tmp_TOP_LI & tmp_AREA & tmp_before])
ci1,ci2,mean_check = bootstrapping_compare_mean_CI_star(x[tmp_TOP_LI & tmp_AREA & tmp_after],x[tmp_TOP_LI & tmp_AREA & tmp_before],95)
output_second_row = str(round(mean,1))+'±'+str(round((ci1+ci2)/2,1))
return output_first_row,output_second_row
TABLE = pd.DataFrame(index=['LI','LMI','1/LMI','$\Delta$t${\times}\kappa$','$\Delta$d','$\Delta$t','$\kappa$','c','MPI'],columns=['%tiles','epoch diff'])#,'NH','SH','WP','EP','NA','NI','SI','SP'])
for BBB,AREA in enumerate( [
['WP','EP','NA','NI','SI','SP'],
#['WP','EP','NA','NI'],
#['SI','SP'],
#['WP'],
#['EP'],
#['NA'],
#['NI'],
#['SI'],
#['SP'],
]):
dur_inverse = np.asarray(dur_inverse)
TABLE.iloc[0,0],TABLE.iloc[0,1] = find_var_percentile(LI_inverse ,AREA)
TABLE.iloc[1,0],TABLE.iloc[1,1] = find_var_percentile(A_inverse ,AREA)
TABLE.iloc[2,0],TABLE.iloc[2,1] = find_var_percentile(1/A_inverse *1000,AREA)
TABLE.iloc[3,0],TABLE.iloc[3,1] = find_var_percentile(dur_inverse*3600*B_inverse *1000,AREA)
TABLE.iloc[4,0],TABLE.iloc[4,1] = find_var_percentile(trajectory_inverse ,AREA)
TABLE.iloc[5,0],TABLE.iloc[5,1] = find_var_percentile(dur_inverse ,AREA)
TABLE.iloc[6,0],TABLE.iloc[6,1] = find_var_percentile(B_inverse /Ref_B*10,AREA)
TABLE.iloc[7,0],TABLE.iloc[7,1] = find_var_percentile(speed_inverse ,AREA)
TABLE.iloc[8,0],TABLE.iloc[8,1] = find_var_percentile(MPI ,AREA)
TABLE
Basin breakdown - Trend
def basin_LI_trend (AREA):
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]])
Y.extend([sum(np.asarray(tmp)>=96)]) #96
sample_weight.extend([1])
pred, mean, ci, p = poisson_reg(X,Y)
STR =''# ' ($p$='+str(round(p,2))+')'
if abs(ci)<=abs(mean):
STR = ' ($p$<0.05)'
output1 = str(round(np.log(2)/mean).astype(int))+STR
count = np.nansum(sample_weight)
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][7] in AREA):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]])
Y.extend([sum(np.asarray(tmp)>=96)]) #96
sample_weight.extend([1])
pred, mean, ci, p = poisson_reg(X,Y)
STR =''# ' ($p$='+str(round(p,2))+')'
if abs(ci)<=abs(mean):
STR = ' ($p$<0.05)'
output2 = str(round(np.log(2)/mean).astype(int))+STR
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][7] in AREA) & (VMAX_PMIN_SERIES[CCC][1][0]>=96):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][0]])
Y.extend([np.nanmean(tmp)*.5144444])
sample_weight.extend([len(tmp)])
x_trend, y_trend, slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
p_str =''# '$p$='+str('%.2f' %np.round(p,2))+')'
if p<0.05:
p_str = '($p$<0.05)'
output3 = str(round(slope*10,1))+p_str
X = INDEX_year[:]
Y = []
sample_weight = []
for YEAR in X:
tmp = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][2] == YEAR) & (VMAX_PMIN_SERIES[CCC][7] in AREA) & (VMAX_PMIN_SERIES[CCC][1][0]>=96):
tmp.extend([VMAX_PMIN_SERIES[CCC][1][-1]])
Y.extend([np.nanmean(tmp)*.51444444])
sample_weight.extend([len(tmp)])
x_trend, y_trend, slope,ci,p = get_trend_and_ci_weight(X,Y,sample_weight)
p_str =''# '($p$='+str('%.2f' %np.round(p,2))+')'
if p<0.05:
p_str = '($p$<0.05)'
output4 = str(round(slope*10,1))+p_str
Y = []
sample_weight = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA) & (VMAX_PMIN_SERIES[CCC][1][0]>=96):
Y.extend([VMAX_PMIN_SERIES[CCC][1][0]])
output5 = str(round(np.nanstd(Y)).astype(int))
Y = []
sample_weight = []
for CCC in range(len(VMAX_PMIN_SERIES)):
if (VMAX_PMIN_SERIES[CCC][7] in AREA) & (VMAX_PMIN_SERIES[CCC][1][0]>=96):
Y.extend([VMAX_PMIN_SERIES[CCC][1][-1]])
output6 = str(round(np.nanstd(Y)).astype(int))
return output1, output2,output3,output4,output5, output6
TABLE = pd.DataFrame(index=['Major landfall doubling time (year)','Major LMI doubling time (year)',
'LMI (m s $^{-1}$ per decade)','LI (m s $^{-1}$ per decade)',
'LMI σ (m s$^{-1}$)','LI σ (m s$^{-1}$)',],
columns=['Global','NH','SH','WP','EP','NA','NI','SI','SP'])
for BBB,AREA in enumerate( [
['WP','EP','NA','NI','SI','SP'],
['WP','EP','NA','NI'],
['SI','SP'],
['WP'],
['EP'],
['NA'],
['NI'],
['SI'],
['SP'],
]):
output1,output2,output3,output4,output5,output6 = basin_LI_trend(AREA)
TABLE.iloc[0,BBB] = output1
TABLE.iloc[1,BBB] = output2
TABLE.iloc[2,BBB] = output3
TABLE.iloc[3,BBB] = output4
TABLE.iloc[4,BBB] = output5
TABLE.iloc[5,BBB] = output6
TABLE
#TABLE.to_clipboard()
| Global | NH | SH | WP | EP | NA | NI | SI | SP | |
|---|---|---|---|---|---|---|---|---|---|
| Major landfall doubling time (year) | 34 ($p$<0.05) | 31 ($p$<0.05) | 42 | 44 | 18 | 19 | 33 | 68 | 18 |
| Major LMI doubling time (year) | 50 ($p$<0.05) | 50 ($p$<0.05) | 47 | 53 ($p$<0.05) | 67 | 42 | 37 | 45 | 54 |
| LMI (m s $^{-1}$ per decade) | 1.0($p$<0.05) | 1.2($p$<0.05) | -0.4 | 1.0 | 2.5 | 1.8 | -0.3 | -0.9 | 0.1 |
| LI (m s $^{-1}$ per decade) | 0.5 | 0.3 | 1.3 | 0.3 | 1.0 | 0.8 | -2.8 | -1.0 | 3.6 |
| LMI σ (m s$^{-1}$) | 16 | 17 | 14 | 16 | 17 | 19 | 13 | 13 | 16 |
| LI σ (m s$^{-1}$) | 28 | 28 | 26 | 27 | 28 | 22 | 27 | 25 | 26 |