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

Solve 2 small issues #5

Closed Riezebos closed 2 years ago

Riezebos commented 2 years ago

Hi,

Thanks for the great library! I used it to do IDF analysis and I ran into 2 small issues:

Error during parameter calculation When the duration is large, partially_series sometimes has less values than the threshold_sample_size. This raises an error because log_return_periods will then have more values than partially_series in this line:

_lin_regress(log_return_periods, partially_series)

The change I made reduce the size of log_return_periods to the same size as partially_series.

No results for duration 60 When the rainfall data is available per 60 minutes, the parameters_final for 0 will be nan. For 60 there will be parameters, but they are not used to calculate rainfall because the 0 <= 60.0 <= 60 is already true.

The change I made reverses the order in which the lower and upper bounds are checked, so that for values that exactly match a bound it the upper parameter set will be used.

Do you think these changes are ok and can be included in the next release?

MarkusPic commented 2 years ago

HI, thanks for your help.

(1) I resolved the issues you mentioned and added a warning for the small partial series.

(2) I solved the issue by removing regression formulations with only one duration step.