Base Functions¶
Calculation Methods¶
Functions to analyse the precipitations series based on the core method.
- class idf_analysis.idf_backend.IdfParameters(series_kind: str = 'partial', worksheet: str = 'KOSTRA', extended_durations=False)[source]¶
- get_array_param(p, duration)[source]¶
- Parameters:
p (str) – name of the parameter ‘u’ or ‘w’
duration (numpy.ndarray) – in minutes
- Returns:
u, w
- Return type:
- measured_points(return_periods, max_duration=None)[source]¶
Get the calculation results of the rainfall with u and w without the estimation of the formula.
Input and Output¶
Function for reading and writing files.
SWW Utils¶
Functions to help analyse data in a general way. Most of this function have been developed on the institute of urban water management at the university of technology Graz.
- idf_analysis.sww_utils.agg_events(events, series, agg='sum')[source]¶
- Parameters:
events (pandas.DataFrame) – table of events
series (pandas.Series) – time-series data
agg (str | function) – aggregation of time-series
- Returns:
result of function of every event
- Return type:
- idf_analysis.sww_utils.event_duration(events)[source]¶
calculate the event duration
- Parameters:
events (pandas.DataFrame) – table of events with COL.START and COL.END times
- Returns:
duration of each event
- Return type:
- idf_analysis.sww_utils.event_number_to_series(events, index)[source]¶
make a time-series where the value of the event number is paste to the <index>
- Parameters:
events (pandas.DataFrame)
index (pandas.DatetimeIndex)
- Return type:
- idf_analysis.sww_utils.guess_freq(date_time_index, default=Timedelta('0 days 00:01:00'))[source]¶
guess the frequency by evaluating the most often frequency
- Parameters:
date_time_index (pandas.DatetimeIndex) – index of a time-series
default (pandas.Timedelta)
- Returns:
frequency of the date-time-index
- Return type:
pandas.DateOffset
- idf_analysis.sww_utils.rain_bar_plot(rain, ax=None, color='#1E88E5', reverse=False, step='post', joinstyle='miter', capstyle='butt')[source]¶
Make a standard precipitation/rain plot.
- Parameters:
rain (pandas.Series)
ax (matplotlib.axes.Axes)
color (str)
reverse (bool)
step (str) – ‘mid’ ‘post’ pre’
- Returns:
rain plot
- Return type:
- idf_analysis.sww_utils.rain_events(series, ignore_rain_below=0.01, min_gap=Timedelta('0 days 04:00:00'))[source]¶
get rain events as a table with start and end times
- Parameters:
series (pandas.Series) – rain series
ignore_rain_below (float) – where it is considered as rain
min_gap (pandas.Timedelta) – 4 hours of no rain between events
- Returns:
table of the rain events
- Return type:
- idf_analysis.sww_utils.resample_rain_series(series)[source]¶
- Parameters:
series (pandas.Series)
- Returns:
the resampled series AND the final frequency in minutes
- Return type:
Converter helper functions¶
Functions to help convert things and units.
- idf_analysis.little_helpers.delta2min(time_delta)[source]¶
convert timedelta to float in minutes
- Parameters:
time_delta (pandas.Timedelta, pandas.DateOffset)
- Returns:
the timedelta in minutes
- Return type:
- idf_analysis.little_helpers.duration_steps_readable(durations)[source]¶
convert the durations to a more readable form
- idf_analysis.little_helpers.height2rate(height_of_rainfall, duration)[source]¶
calculate the specific rain flow rate in [l/(s*ha)] if 2 array-like parameters are give, a element-wise calculation will be made. So the length of the array must be the same.
- idf_analysis.little_helpers.minutes_readable(minutes)[source]¶
convert the duration in minutes to a more readable form
- idf_analysis.little_helpers.rate2height(rain_flow_rate, duration)[source]¶
convert the rain flow rate to the height of rainfall in [mm] if 2 array-like parameters are give, a element-wise calculation will be made. So the length of the array must be the same.
Plotting helper functions¶
Functions to add or manipulate plotting figures.
- idf_analysis.plot_helpers.idf_bar_axes(ax, idf_table, return_period_colors={1: '#00ffff', 2: '#add8e6', 5: '#0000ff', 10: '#ffff00', 20: '#ffa500', 50: '#ff0000', 100: '#ff00ff'})[source]¶
create
- Parameters:
ax (matplotlib.pyplot.Axes)
idf_table (pandas.DataFrame)
return_period_colors (dict) – color of each return period {return period: color}
- Return type:
matplotlib.pyplot.Axes