我有30年的年温度数据,我想用GEV分布来计算这个数据的值,用于50和100年返回周期。
我30年的数据:
data=[28.01,29.07,28.67,21.57,21.66,24.62,21.45,28.51,22.65,21.57,20.89,20.96,21.05,22.29,20.81,21.08,20.77,23.18,22.98,21.88,21.07,20.74,22.69,22.42,31.81,25.78,29.09,28.11,22.18,21.6]
如何使用GEV找到返回值?
发布于 2022-02-21 15:45:55
为了估计给定返回周期T的返回水平,首先估计广义极值分布的参数,然后在拟合分布的1/T处计算生存函数的逆。(生存函数SF(x)仅为1-cf(X).如果您阅读了有关计算返回级别的内容,您通常会看到这样的问题:求解CDF(x) =1-1/T,这与求解SF(x) = 1/T相同。
下面是一个脚本,它使用scipy.stats.genextreme
在几个返回周期估计数据的返回级别。方法genextreme.isf()
是生存函数的逆函数。
import numpy as np
from scipy.stats import genextreme
data = np.array([28.01, 29.07, 28.67, 21.57, 21.66, 24.62, 21.45, 28.51,
22.65, 21.57, 20.89, 20.96, 21.05, 22.29, 20.81, 21.08,
20.77, 23.18, 22.98, 21.88, 21.07, 20.74, 22.69, 22.42,
31.81, 25.78, 29.09, 28.11, 22.18, 21.6])
# Fit the generalized extreme value distribution to the data.
shape, loc, scale = genextreme.fit(data)
print("Fit parameters:")
print(f" shape: {shape:.4f}")
print(f" loc: {loc:.4f}")
print(f" scale: {scale:.4f}")
print()
# Compute the return levels for several return periods.
return_periods = np.array([5, 10, 20, 50, 100])
return_levels = genextreme.isf(1/return_periods, shape, loc, scale)
print("Return levels:")
print()
print("Period Level")
print("(years) (temp)")
for period, level in zip(return_periods, return_levels):
print(f'{period:4.0f} {level:9.2f}')
输出:
Fit parameters:
shape: -0.9609
loc: 21.5205
scale: 1.0533
Return levels:
Period Level
(years) (temp)
5 25.06
10 29.95
20 39.45
50 67.00
100 111.53
https://stackoverflow.com/questions/71202562
复制相似问题