MATLAB | Calculation Method for Single Point Extreme Precipitation Index

MATLAB | Calculation Method for Single Point Extreme Precipitation Index

Click/Press/Blue/Words Follow/Us

MATLAB | Calculation Method for Single Point Extreme Precipitation Index

{

MATLAB|

Calculation Method for Single Point Extreme Precipitation Index

Author: Li Zhi, Eighth Galaxy

Email: [email protected]

}

MATLAB | Calculation Method for Single Point Extreme Precipitation Index

1

Rx1day

The maximum daily precipitation, which is straightforward and can be solved using the max() function.

MATLAB | Calculation Method for Single Point Extreme Precipitation IndexMATLAB | Calculation Method for Single Point Extreme Precipitation Index

2

Rx5day

The maximum precipitation over 5 consecutive days, which includes several conditions: 1) 5 consecutive days; 2) maximum value. The maximum value does not need explanation. When calculating the 5-day consecutive precipitation, it is important to ensure that the precipitation amount for all 5 days is not zero. Since this 5-day period is a sliding window, care must be taken to break the sliding window at zero values and NaN.

Thus, we introduce the movsum() function for calculation.

MATLAB | Calculation Method for Single Point Extreme Precipitation Index

3

SDII

The daily precipitation intensity on wet days (daily precipitation > 1mm). This index first limits daily precipitation to greater than 1mm, and then calculates the precipitation intensity. Precipitation intensity = cumulative precipitation / cumulative precipitation time.

MATLAB | Calculation Method for Single Point Extreme Precipitation Index

4

R10

The number of days with precipitation ≥ 10mm.

MATLAB | Calculation Method for Single Point Extreme Precipitation Index

5

R20

The number of days with precipitation ≥ 20mm.

MATLAB | Calculation Method for Single Point Extreme Precipitation Index

6

R95p

This is defined as the number of days with precipitation greater than the 95th percentile precipitation. I honestly did not understand this, but the percentile must use the prctile() function. So I checked the literature.

https://www.sciencedirect.com/science/article/pii/S1674927823001533

MATLAB | Calculation Method for Single Point Extreme Precipitation IndexMATLAB | Calculation Method for Single Point Extreme Precipitation IndexMATLAB | Calculation Method for Single Point Extreme Precipitation IndexMATLAB | Calculation Method for Single Point Extreme Precipitation Index

7

R99p

Similarly.

MATLAB | Calculation Method for Single Point Extreme Precipitation IndexMATLAB | Calculation Method for Single Point Extreme Precipitation Index

8

R98pTOT

The percentage of total precipitation on very wet days. After reading, I still did not understand, so I checked again:

MATLAB | Calculation Method for Single Point Extreme Precipitation IndexMATLAB | Calculation Method for Single Point Extreme Precipitation IndexMATLAB | Calculation Method for Single Point Extreme Precipitation Index

9

R99pTOT

Similarly.

MATLAB | Calculation Method for Single Point Extreme Precipitation IndexMATLAB | Calculation Method for Single Point Extreme Precipitation Index

10

CDD and CWD

This is slightly more complex. It requires the use of the find(), diff(), and max() functions in combination.

MATLAB | Calculation Method for Single Point Extreme Precipitation IndexMATLAB | Calculation Method for Single Point Extreme Precipitation IndexMATLAB | Calculation Method for Single Point Extreme Precipitation Index

Complete Code

clear;clc% Assume single point precipitation is pr, data contains missing values. pr = [4 NaN 60001534531401522175846117523591223];Rx1day = max(pr);

clear;clc% Assume single point precipitation is pr, data contains missing values. pr = [4 NaN 60001534531401522175846117523591223];% Here we convert data, changing 0 values to NaN, so that sliding calculations do not recognize non-precipitation days. pr(pr==0) = nan;M = movsum(pr,5,'Endpoints','discard');Rx5day = max(M);

clear;clc% Assume single point precipitation is pr, data contains missing values. pr = [4 NaN 600101534531401522175846117523591223];% Calculate simple daily precipitation intensity indexthresholdP = 1;wetDays = pr(pr > thresholdP);SDII = sum(wetDays) / length(wetDays);

clear;clc% Assume single point precipitation is pr, data contains missing values. pr = [4 NaN 600101534531401522175846117523591223];% Calculate the number of heavy precipitation daysthresholdP = 10;wetDays = pr(pr >= thresholdP);R10 = length(wetDays);

clear;clc% Assume single point precipitation is pr, data contains missing values. pr = [4 NaN 600101534531401522175846117523591223];% Calculate the number of extreme precipitation daysthresholdP = 20;wetDays = pr(pr >= thresholdP);R20 = length(wetDays);

clear;clc% Assume single point precipitation is pr, data contains missing values. pr = [4 NaN 3111111111111401522175461132165526255496223];% First filter daily precipitation greater than 1thresholdP = 1;wetDays = pr(pr > thresholdP);% Calculate 95th percentile precipitationR95pthresholdP = prctile(wetDays, 95);R95p = length(pr(pr >= R95pthresholdP));

clear;clc% Assume single point precipitation is pr, data contains missing values. pr = [4 NaN 3111111111111401522175461132165526255496223];% First filter daily precipitation greater than 1thresholdP = 1;wetDays = pr(pr > thresholdP);% Calculate 99th percentile precipitationR99pthresholdP = prctile(wetDays, 99);R99p = length(pr(pr >= R99pthresholdP));

clear;clc% Assume single point precipitation is pr, data contains missing values. pr = [4 NaN 3111111111111401522175461132165526255496223];% First filter daily precipitation greater than 1thresholdP = 1;wetDays = pr(pr > thresholdP);% Calculate 95th percentile precipitationR95pthresholdP = prctile(wetDays, 95);R95p = length(pr(pr >= R95pthresholdP));% Calculate the proportion of total precipitation for 95th percentileAmount95 = sum(pr(pr >= R95pthresholdP));R95pTOT = Amount95 / sum(pr);

clear;clc% Assume single point precipitation is pr, data contains missing values. pr = [4 NaN 3111111111111401522175461132165526255496223];% First filter daily precipitation greater than 1thresholdP = 1;wetDays = pr(pr > thresholdP);% Calculate 99th percentile precipitationR99pthresholdP = prctile(wetDays, 99);R99p = length(pr(pr >= R99pthresholdP));% Calculate the proportion of total precipitation for 99th percentileAmount99 = sum(pr(pr >= R99pthresholdP));R99pTOT = Amount99 / sum(pr);

clear;clc% Assume single point precipitation is pr, data does not contain missing values. pr = [4500.10.20.30.512345600.10.3 ];% Calculate consecutive dry daysthresholdP = 1;drySpells = diff(find([1, pr<thresholdP, 1]));CDD = max(drySpells) - 1;wetSpells = diff(find([1, pr>=thresholdP, 1]));CWD = max(drySpells) - 1;

END

Private Message:Eighth Galaxy

How to Join the Group

Daily updates and data sharing in the group

Please do not reply with words other thanEighth Galaxyto join the group

Article edited by: Eighth Galaxy – Xinyue

Leave a Comment