MarkusPic / intensity_duration_frequency_analysis

heavy rain as a function of the duration and the return period acc. to DWA-A 531 (2012) This program reads the measurement data of the rainfall and calculates the distribution of the rainfall as a function of the return period and the duration for duration steps up to 12 hours (and more) and return period in a range of '0.5a <= T_n <= 100a'
MIT License
39 stars 15 forks source link

Add check for min_gap to be at least 4 hours in rain_events #1

Closed AndreGilerson closed 3 years ago

AndreGilerson commented 3 years ago

According to the DWA A-531 Chapter 4.2, rain events should be at least 4 hours apart to be statistically independent. This period is defined as the default parameter in the rain_events function. However, during function calls in e.g. calculate_u_uw() smaller gap periods are used. Therefore a new check is added, such that even if the method is called with a min_gap < 4 hours, it still will be at least 4 hours.

AndreGilerson commented 3 years ago

Additionally, there is a small error with the annual series, where events[COL.START].year attribute is called. Since events[COL.START] is a Series, it does not have the attribute. This is fixed by iterating over all entries in the Series and calling the year attribute from each entry individually.

MarkusPic commented 3 years ago

Hi! Thanks for the message!

1) you are right. but I rather adapt the function calculate_u_w. In this case the function rain_events runs as expected, even with "not so useful" parameters.

2) it is even easier than that: events[COL.START].dt.year.values dose the trick.