MATLAB计算有效干旱指数(Effective drought index, EDI)
1.有效干旱指数(Effective drought index, EDI)
令 DS 为考虑的日数长度(原文用 365 天)。定义“有效降水” EP:
2.MATLAB程序
主程序main.m
clc;close all;clear all;warning off;%清除变量
rand('seed', 100);
randn('seed', 100);
format long g;N = 2000; % 序列长度(示例)
P = max(0, 5+2*randn(N,1));% 合成“日降水”(mm),允许 0% 按 Byun & Wilhite (1999):EP_i = sum_{n=1..DS} [ (sum_{m=1..n} P(i-m+1))/n ]
% DEP_i = EP_i - mean(EP); EDI_i = DEP_i / std(DEP)
% DWAAI 参数(通用实现):
% - dry_win/wet_win:分别表示“急转点”前/后的统计窗口长度(天)
% - std_method:'z' 表示用标准分数,'swap' 表示用 SWAP 值来度量旱/涝强度
% - minJump:判定“显著变化”的阈值(单位同所选强度指标)
% EDI 参数:DS(计算有效降水的最大叠加天数,常用 365 或 30/90)
DS = 365;EDI = calc_EDI(P, DS);t = (1:numel(P))';figure;
plot(t, EDI, 'LineWidth',1.1);
grid on;
yline([ -2 -1 0 1 2],'--');
xlabel('t');
ylabel('EDI');
title(sprintf('EDI(日尺度,DS=%d)',DS));
3.程序结果