disdrodb.summary package#

Submodules#

disdrodb.summary.routines module#

Utilities to create summary statistics.

disdrodb.summary.routines.add_legend_powerlaw(ax, legend_str, legend_fontsize)[source][source]#

Add legend fitted powerlaw relationship to plot.

disdrodb.summary.routines.apply_2d_outlier_removal(df_data, xbins, ybins, min_counts)[source][source]#

Remove observations that fall in 2D histogram bins having less than min_counts.

disdrodb.summary.routines.create_dsd_dataframe(ds, variables=None)[source][source]#

Create pandas Dataframe with N(D) data.

disdrodb.summary.routines.create_l2_dataframe(ds)[source][source]#

Create pandas Dataframe for L2 analysis.

disdrodb.summary.routines.create_station_summary(data_source, campaign_name, station_name, parallel=False, data_archive_dir=None, temporal_resolution='1MIN')[source][source]#

Create summary figures and tables for a DISDRODB station.

disdrodb.summary.routines.create_table_dsd_summary(df)[source][source]#

Create table with integral DSD parameters statistics.

disdrodb.summary.routines.create_table_events_summary(df, temporal_resolution)[source][source]#

Create table with events statistics.

disdrodb.summary.routines.create_table_l1_event_summary(ds, variable='n_particles', threshold=4, neighbor_min_size=2, neighbor_time_interval='5MIN', event_max_time_gap='1H', event_min_duration='20MIN', event_min_size=5, sortby='duration', sortby_order='decreasing')[source][source]#

Return a table with the hydrometeor statistics for each event.

disdrodb.summary.routines.create_table_rain_summary(df, temporal_resolution)[source][source]#

Create rainy table summary.

disdrodb.summary.routines.define_filename(prefix, extension, data_source, campaign_name, station_name, temporal_resolution)[source][source]#

Define filename for summary files.

disdrodb.summary.routines.define_lognorm_max_value(value)[source][source]#

Round up to next nice number: 90->100, 400->500, 1200->2000.

disdrodb.summary.routines.define_logquadratic_powerlaw_legend_str(x_symbol, y_symbol, a, b, c)[source][source]#

Build LaTeX legend string for log-quadratic power law.

\[y = a x^b 10^{c (\log_{10} x)^2}\]
Parameters:
  • x_symbol (str) – Symbol of independent variable (e.g. ‘R’)

  • y_symbol (str) – Symbol of dependent variable

  • a (float) – Multiplicative coefficient in original space.

  • b (float) – Linear log10 slope coefficient

  • c (float) – Quadratic log10 curvature coefficient. If c = 0, the model reduces to the classical power law.

Returns:

legend_str – LaTeX formatted legend string

Return type:

str

disdrodb.summary.routines.define_powerlaw_legend_str(x_symbol, y_symbol, a, b)[source][source]#

Build two-line LaTeX legend string for y = a x^b and x = A y^B.

Parameters:
  • x_symbol (str) – Symbol of independent variable (e.g. ‘R’, ‘z’, ‘A_H’, ‘\mathrm{KED}’)

  • y_symbol (str) – Symbol of dependent variable

  • a (float) – Power-law coefficient

  • b (float) – Power-law exponent

Returns:

legend_str – LaTeX formatted legend string (two lines)

Return type:

str

disdrodb.summary.routines.fit_logquadratic_powerlaw_with_ransac(x, y)[source][source]#

Fit a log-quadratic power-law model using RANSAC regression.

This function fits a log-quadratic (log-parabolic) power-law model by performing linear regression in log10-space using the Random Sample Consensus (RANSAC) algorithm, which is robust to outliers.

The fitted model in original space is:

\[y = a x^b 10^{c (\log_{10} x)^2}\]

where the fitting is performed in log10-space:

\[\log_{10}(y) = a_0 + b \log_{10}(x) + c (\log_{10} x)^2\]

with \(a = 10^{a_0}\).

This model (also known as a log-parabolic power law) extends the classical power law by allowing smooth curvature in log-log space. The effective scale-dependent exponent is:

\[\frac{d(\log_{10} y)}{d(\log_{10} x)} = b + 2c \log_{10}(x)\]
Parameters:
  • x (array-like) – Independent variable values. Must be strictly positive.

  • y (array-like) – Dependent variable values. Must be strictly positive.

Returns:

  • params (tuple of float) – Estimated parameters (a, b, c) of the log-quadratic power law.

  • params_std (tuple of None) – Placeholder for standard deviations (None, None, None). Parameter uncertainties are not computed with RANSAC.

Notes

  • Requires scikit-learn to be installed.

  • The fitting is performed in log10-space using RANSAC with a linear regression estimator.

  • Non-positive x or y values are removed prior to fitting.

  • If \(c = 0\), the model reduces to a pure power law \(y = a x^b\).

  • The residual threshold for inlier classification is set to 0.3 in log10-space.

  • Parameter uncertainties are not provided by RANSAC and are returned as None.

See also

fit_powerlaw

Main power-law fitting function with binning and outlier removal.

fit_logquadratic_powerlaw_with_wnls

Fit log-quadratic power law using WNLS.

predict_from_logquadratic_powerlaw

Predict values from the fitted model.

disdrodb.summary.routines.fit_logquadratic_powerlaw_with_wnls(x, y, sigma)[source][source]#

Fit a log-quadratic power-law using Weighted Nonlinear Least Squares (WNLS).

This function fits a log-quadratic (log-parabolic) power-law model by performing weighted regression in log10-space with the Levenberg-Marquardt algorithm.

The fitted model in original space is:

\[y = a x^b 10^{c (\log_{10} x)^2}\]

where the fitting is performed in log10-space:

\[\log_{10}(y) = a_0 + b \log_{10}(x) + c (\log_{10} x)^2\]

with \(a = 10^{a_0}\).

Parameters:
  • x (array-like) – Independent variable values. Must be positive.

  • y (array-like) – Dependent variable values. Must be positive.

  • sigma (array-like) – Standard deviation of y values, used as weights in the fit. Values are transformed to log10-space for fitting.

Returns:

  • params (tuple of float) – Estimated parameters (a, b, c) of the log-quadratic power law.

  • params_std (tuple of float) – One standard deviation uncertainties (a_std, b_std, c_std) estimated from the covariance matrix of the fit.

Notes

  • The function uses scipy.optimize.curve_fit with the Levenberg-Marquardt method for optimization.

  • Uncertainties are propagated from log10-space back to linear space.

  • If \(c = 0\), the model reduces to a classical power law \(y = a x^b\).

  • The transformation \(\sigma_{\log_{10}(y)} = \sigma_y / (y \ln(10))\) is used for the weights.

See also

fit_powerlaw

Main power-law fitting function with binning and outlier removal.

fit_logquadratic_powerlaw_with_ransac

Fit log-quadratic power law using RANSAC.

predict_from_logquadratic_powerlaw

Predict values from the fitted model.

disdrodb.summary.routines.fit_powerlaw(x, y, xbins, ybins, quantile=0.5, min_counts=10, x_in_db=False, robust=True, quadratic=False)[source][source]#

Fit a power-law relationship to binned quantile values.

This function bins x into intervals defined by xbins, computes a specified quantile of y in each bin (median by default, robust to outliers), and fits a power-law model using either the RANSAC algorithm (if robust=True) or weighted nonlinear least squares. Optionally, x can be converted from decibel units to linear scale automatically before fitting.

The fitted model depends on the quadratic parameter:

  • If quadratic=False (default), fit a classical power law:

    \[y = a x^b\]
  • If quadratic=True, fit a log-quadratic power law:

    \[y = a x^b 10^{c (\log_{10} x)^2}\]
Parameters:
  • x (array-like) – Independent variable values. Must be positive and finite after filtering.

  • y (array-like) – Dependent variable values. Must be positive and finite after filtering.

  • xbins (array-like) – Bin edges for grouping x values (passed to pandas.cut).

  • ybins (array-like, optional) – Bin edges for 2D histogram outlier removal. If provided, removes observations in 2D bins with fewer than min_counts samples before fitting.

  • quantile (float, optional) – Quantile of y to compute in each bin (between 0 and 1). For example: 0.5 = median, 0.25 = lower quartile, 0.75 = upper quartile. Default is 0.5 (median).

  • min_counts (int, optional) – Minimum number of observations required in each bin for it to be included in the fit. Default is 10.

  • x_in_db (bool, optional) – If True, converts x values from decibels (dB) to linear scale using disdrodb.idecibel(). Default is False.

  • robust (bool, optional) – Whether to fit the power law using the Random Sample Consensus (RANSAC) algorithm (robust=True) or using weighted nonlinear least squares solved with the Levenberg-Marquardt algorithm (robust=False). Default is True. To fit with RANSAC, scikit-learn must be installed.

  • quadratic (bool, optional) – If False (default), fit a classical power law \(y = a x^b\) in log-log space. If True, fit a log-quadratic power law \(y = a x^b 10^{c (\log_{10} x)^2}\). Default is False.

Returns:

  • params (tuple of float) – Estimated parameters (a, b) of the power-law relationship. If quadratic=True, returns (a, b, c) for the log-quadratic power law.

  • params_std (tuple of float) – One standard deviation uncertainties (a_std, b_std) estimated from the covariance matrix of the fit. If quadratic=True, returns (a_std, b_std, c_std). Parameters standard deviation is currently not available when fitting with the RANSAC algorithm (returns None values).

Notes

  • This implementation uses quantile statistics within bins, which reduces the influence of outliers.

  • Both x and y are filtered to retain only positive, finite values before binning.

  • Fitting is performed on the bin centers (midpoints between bin edges).

  • The median absolute deviation (MAD) is used to estimate uncertainties for weighted nonlinear least squares fitting.

See also

predict_from_powerlaw

Predict values from the fitted power-law parameters.

predict_from_logquadratic_powerlaw

Predict values from the log-quadratic power law.

inverse_powerlaw_parameters

Compute parameters of the inverse power law.

Examples

>>> import numpy as np
>>> x = np.linspace(1, 50, 200)
>>> y = 2 * x**1.5 + np.random.normal(0, 5, size=x.size)
>>> xbins = np.arange(0, 60, 5)
>>> (a, b), (a_std, b_std) = fit_powerlaw(x, y, xbins, ybins=None)
disdrodb.summary.routines.fit_powerlaw_with_ransac(x, y)[source][source]#

Fit a power-law relationship using the RANSAC algorithm.

This function fits a power-law model \(y = a x^b\) by performing linear regression in log10-space using the Random Sample Consensus (RANSAC) algorithm, which is robust to outliers.

\[y = a x^b\]

The fitting is performed in log10-space:

\[\log_{10}(y) = a_0 + b \log_{10}(x)\]

where \(a = 10^{a_0}\).

Parameters:
  • x (array-like) – Independent variable values. Must be positive.

  • y (array-like) – Dependent variable values. Must be positive.

Returns:

  • params (tuple of float) – Estimated parameters (a, b) of the power-law relationship.

  • params_std (tuple of None) – Placeholder for standard deviations (None, None). Parameter uncertainties are not computed with RANSAC.

Notes

  • Requires scikit-learn to be installed.

  • RANSAC is robust to outliers by iteratively fitting random subsets of the data and selecting the model with the most inliers.

  • The residual threshold for inlier classification is set to 0.3 in log10-space.

  • Parameter uncertainties are not provided by RANSAC and are returned as None.

See also

fit_powerlaw

Main power-law fitting function with binning and outlier removal.

fit_powerlaw_with_wnls

Fit power law using weighted nonlinear least squares.

disdrodb.summary.routines.fit_powerlaw_with_wnls(x, y, sigma)[source][source]#

Fit a power-law relationship using Weighted Nonlinear Least Squares (WNLS).

This function fits a power-law model \(y = a x^b\) by transforming to log10-space and performing weighted linear regression with the Levenberg-Marquardt algorithm.

\[y = a x^b\]

The fitting is performed in log10-space:

\[\log_{10}(y) = a_0 + b \log_{10}(x)\]

where \(a = 10^{a_0}\).

Parameters:
  • x (array-like) – Independent variable values. Must be positive.

  • y (array-like) – Dependent variable values. Must be positive.

  • sigma (array-like) – Standard deviation of y values, used as weights in the fit. Values are transformed to log10-space for fitting.

Returns:

  • params (tuple of float) – Estimated parameters (a, b) of the power-law relationship.

  • params_std (tuple of float) – One standard deviation uncertainties (a_std, b_std) estimated from the covariance matrix of the fit.

Notes

  • The function uses scipy.optimize.curve_fit with the Levenberg-Marquardt method for optimization.

  • Uncertainties are propagated from log10-space back to linear space.

  • The transformation \(\sigma_{\log_{10}(y)} = \sigma_y / (y \ln(10))\) is used for the weights.

See also

fit_powerlaw

Main power-law fitting function with binning and outlier removal.

fit_powerlaw_with_ransac

Fit power law using RANSAC algorithm.

disdrodb.summary.routines.generate_station_summary(ds, summary_dir_path, data_source, campaign_name, station_name, temporal_resolution)[source][source]#

Generate station summary using L2E dataset.

disdrodb.summary.routines.get_symbol_str(symbol, pol='')[source][source]#

Generate symbol string with optional polarization subscript.

Parameters:
  • symbol (str) – The base symbol (e.g., ‘A’, ‘Z’, ‘z’)

  • pol (str, optional) – Polarization identifier (e.g., ‘H’, ‘V’)

Returns:

LaTeX formatted symbol string

Return type:

str

disdrodb.summary.routines.inverse_powerlaw_parameters(a, b)[source][source]#

Compute parameters of the inverse power-law relationship.

Given a power-law model:

\[y = a x^b\]

this function returns parameters \((A, B)\) such that the inverse relation holds:

\[x = A y^B\]

where:

\[A = a^{-1/b}, \quad B = 1/b\]
Parameters:
  • a (float) – Power-law coefficient in \(y = a x^b\).

  • b (float) – Power-law exponent in \(y = a x^b\).

Returns:

  • A (float) – Coefficient of the inverse power-law model.

  • B (float) – Exponent of the inverse power-law model.

See also

fit_powerlaw

Fit a power-law relationship to data.

predict_from_inverse_powerlaw

Predict using inverse power-law parameters.

disdrodb.summary.routines.is_latex_engine_available() bool[source][source]#

Determine whether the Tectonic TeX/LaTeX engine is installed and accessible.

Returns:

True if tectonic is found, False otherwise.

Return type:

bool

disdrodb.summary.routines.plot_ADP_KDP_ZDR(df, adp, kdp, zdr, y_lim=(0, 0.015), zdr_lim=(0, 6), cmap=None, norm=None, add_colorbar=True, title=None, ax=None, figsize=(3.4, 3.0), dpi=300, xlabel_pad=None, ylabel_pad=None)[source][source]#

Create a 2D histogram of ADP/KDP vs ZDR.

References

Ryzhkov, A., P. Zhang, and J. Hu, 2025. Suggested Modifications for the S-Band Polarimetric Radar Rainfall Estimation Algorithm. J. Hydrometeor., 26, 1053-1062. https://doi.org/10.1175/JHM-D-25-0014.1.

disdrodb.summary.routines.plot_A_KDP(df, a, kdp, log_a=True, log_kdp=False, a_lim=(0.001, 10), kdp_lim=None, pol='', ax=None, cmap=None, norm=None, add_colorbar=True, add_fit=True, title=None, figsize=(3.4, 3.0), dpi=300, legend_fontsize=None, xlabel_pad=None, ylabel_pad=None, fit_linewidth=1, fit_linestyle='dashed')[source][source]#

Create a 2D histogram of k(H/V) vs KDP.

disdrodb.summary.routines.plot_A_KDP_ZDR(df, a, kdp, zdr, y_lim=(0, 0.05), zdr_lim=(0, 3), cmap=None, norm=None, add_colorbar=True, pol='', title=None, ax=None, figsize=(3.4, 3.0), dpi=300, xlabel_pad=None, ylabel_pad=None)[source][source]#

Create a 2D histogram of k/KDP vs ZDR.

References

Ryzhkov, A., P. Zhang, and J. Hu, 2025. Suggested Modifications for the S-Band Polarimetric Radar Rainfall Estimation Algorithm. J. Hydrometeor., 26, 1053-1062. https://doi.org/10.1175/JHM-D-25-0014.1.

disdrodb.summary.routines.plot_A_R(df, a, r, cmap=None, norm=None, add_colorbar=True, add_fit=True, pol='', title=None, ax=None, figsize=(3.4, 3.0), dpi=300, fit_linewidth=1, fit_linestyle='dashed', legend_fontsize=None, xlabel_pad=None, ylabel_pad=None)[source][source]#

Create a 2D histogram of A vs R.

disdrodb.summary.routines.plot_A_Z(df, a, z, cmap=None, norm=None, add_colorbar=True, add_fit=True, pol='', title=None, ax=None, a_lim=(0.0001, 10), z_lim=(0, 70), figsize=(3.4, 3.0), dpi=300, fit_linewidth=1, fit_linestyle='dashed', legend_fontsize=None, xlabel_pad=None, ylabel_pad=None)[source][source]#

Create a 2D histogram of A vs Z.

disdrodb.summary.routines.plot_KDP_Z(df, kdp, z, z_lim=(0, 70), log_kdp=False, kdp_lim=None, cmap=None, norm=None, add_colorbar=True, add_fit=True, pol='', title=None, ax=None, figsize=(3.4, 3.0), dpi=300, legend_fontsize=None, xlabel_pad=None, ylabel_pad=None, fit_linewidth=1, fit_linestyle='dashed')[source][source]#

Create a 2D histogram of KDP vs Z.

disdrodb.summary.routines.plot_KDP_Z_ZDR(df, kdp, z, zdr, y_lim=None, zdr_lim=(0, 5), z_linear=True, cmap=None, norm=None, add_colorbar=True, title=None, ax=None, figsize=(3.4, 3.0), dpi=300, xlabel_pad=None, ylabel_pad=None)[source][source]#

Create a 2D histogram of (KDP/Z) vs ZDR with log-scale y-axis (no fit).

disdrodb.summary.routines.plot_KED_R(df, log_r=True, log_ked=False, add_fit=True, cmap=None, norm=None, add_colorbar=True, title=None, ax=None, legend_fontsize=None, figsize=(3.4, 3.0), dpi=300, xlabel_pad=None, ylabel_pad=None, fit_linewidth=1, fit_linestyle='dashed')[source][source]#

Create a 2D histogram of KED vs R.

disdrodb.summary.routines.plot_KEF_R(df, log_r=True, log_kef=True, add_fit=True, cmap=None, norm=None, add_colorbar=True, title=None, ax=None, legend_fontsize=None, figsize=(3.4, 3.0), dpi=300, xlabel_pad=None, ylabel_pad=None, fit_linewidth=1, fit_linestyle='dashed')[source][source]#

Create a 2D histogram of KEF vs R.

disdrodb.summary.routines.plot_KEF_Z(df, z='Z', log_kef=True, add_fit=True, pol='', cmap=None, norm=None, add_colorbar=True, title=None, ax=None, legend_fontsize=None, figsize=(3.4, 3.0), dpi=300, xlabel_pad=None, ylabel_pad=None, fit_linewidth=1, fit_linestyle='dashed')[source][source]#

Create a 2D histogram of KEF vs Z.

disdrodb.summary.routines.plot_R_KDP(df, kdp, r, kdp_lim=None, r_lim=None, cmap=None, norm=None, add_colorbar=True, log_scale=False, add_fit=True, title=None, ax=None, figsize=(3.4, 3.0), dpi=300, legend_fontsize=None, xlabel_pad=None, ylabel_pad=None, fit_linewidth=1, fit_linestyle='dashed')[source][source]#

Create a 2D histogram of KDP vs R.

disdrodb.summary.routines.plot_R_Z(df, z, r, cmap=None, norm=None, add_colorbar=True, add_fit=True, pol='', title=None, ax=None, figsize=(3.4, 3.0), dpi=300, fit_linewidth=1, fit_linestyle='dashed', legend_fontsize=None, xlabel_pad=None, ylabel_pad=None)[source][source]#

Create a 2D histogram of Z vs R.

disdrodb.summary.routines.plot_TKE_Z(df, z='Z', log_tke=True, add_fit=True, cmap=None, norm=None, add_colorbar=True, title=None, ax=None, legend_fontsize=None, figsize=(3.4, 3.0), dpi=300, xlabel_pad=None, ylabel_pad=None, fit_linewidth=1, fit_linestyle='dashed')[source][source]#

Create a 2D histogram of TKE vs Z.

disdrodb.summary.routines.plot_ZDR_Z(df, z, zdr, zdr_lim=(0, 2.5), z_lim=(0, 70), cmap=None, norm=None, add_colorbar=True, add_fit=False, pol='', title=None, ax=None, figsize=(3.4, 3.0), dpi=300, legend_fontsize=None, xlabel_pad=None, ylabel_pad=None, fit_linewidth=1, fit_linestyle='dashed')[source][source]#

Create a 2D histogram of Zdr vs Z.

disdrodb.summary.routines.plot_dmax_relationships(df, diameter_bin_edges, dmax='Dmax', diameter_max=10, norm_vmax=None, dpi=300)[source][source]#

Plot 2x2 subplots showing relationships between Dmax and precipitation parameters.

Parameters:
  • df (pandas.DataFrame) – Input dataframe containing the precipitation data

  • dmax (str, optional) – Column name for maximum diameter. Default is ‘Dmax’.

  • vmax (float, optional) – Maximum value for Dmax axis limits. Default is 10 mm.

  • dpi (int, optional) – Resolution for the figure. The default is 300.

disdrodb.summary.routines.plot_dsd_density(df_dsd, diameter_bin_edges, figsize=(3.4, 3.0), dpi=300)[source][source]#

Plot N(D) ~ D density.

disdrodb.summary.routines.plot_dsd_params_density(df, log_dm=False, lwc=True, log_normalize=False, log_step=0.05, linear_step=0.1, figsize=(6.9, 7.2), dpi=300)[source][source]#

Generate a figure with various DSD relationships.

All histograms are computed first, then normalized, and finally plotted together.

Parameters:
  • df (pandas.DataFrame) – DataFrame containing DSD parameters (Dm, Nt, Nw, LWC/W, R, sigma_m, M2, M3, M4, M6)

  • log_dm (bool, optional) – If True, use linear scale for Dm axes. If False, use log scale. Default is True.

  • lwc (bool, optional) – If True, use Liquid Water Content (W). If False, use Rain Rate (R). Default is True.

  • figsize (tuple, optional) – Figure size (width, height) in inches. Default is (18, 18).

Returns:

  • fig (matplotlib.figure.Figure) – The figure object containing all subplots

  • axes (numpy.ndarray) – Array of all subplot axes

disdrodb.summary.routines.plot_dsd_params_relationships(df, add_nt=False, log_step=0.05, dpi=300)[source][source]#

Create a figure illustrating the relationships between DSD parameters.

disdrodb.summary.routines.plot_dsd_with_dense_lines(drop_number_concentration, r, figsize=(3.4, 3.0), dpi=300)[source][source]#

Plot N(D) ~ D using dense lines.

disdrodb.summary.routines.plot_kinetic_energy_relationships(df)[source][source]#

Create a 2x2 multipanel figure showing kinetic energy relationships (AMT format).

disdrodb.summary.routines.plot_normalized_dsd_density(df_dsd, x='D/D50', figsize=(3.4, 3.0), dpi=300)[source][source]#

Plot normalized DSD N(D)/Nw ~ D/D50 (or D/Dm) density.

disdrodb.summary.routines.plot_radar_relationships(df, band)[source][source]#

Create 3x3 radar relationships figure formatted for AMT journal.

disdrodb.summary.routines.predict_from_inverse_powerlaw(x, a, b)[source][source]#

Predict values from the inverse power-law relationship.

Given an inverse power-law model:

\[x = a y^b\]

this function solves for \(y\) given \(x\):

\[y = (x / a)^{1/b} = x^{1/b} \cdot a^{-1/b}\]
Parameters:
  • x (array-like) – Values of x (independent variable in the inverse power law).

  • a (float) – Power-law coefficient of the inverse power-law model.

  • b (float) – Power-law exponent of the inverse power-law model.

Returns:

y – Predicted dependent variable values.

Return type:

numpy.ndarray

See also

inverse_powerlaw_parameters

Compute parameters of the inverse power law.

predict_from_powerlaw

Predict from the original power law.

disdrodb.summary.routines.predict_from_logquadratic_powerlaw(x, a, b, c)[source][source]#

Predict values from a log-quadratic power-law model.

This function computes predictions using the log-quadratic power-law model:

\[y = a x^b 10^{c (\log_{10} x)^2}\]
Parameters:
  • x (array-like) – Independent variable values. Must be positive.

  • a (float) – Multiplicative coefficient in original space.

  • b (float) – Linear log10 slope coefficient.

  • c (float) – Quadratic log10 curvature coefficient.

Returns:

y – Predicted dependent variable values.

Return type:

numpy.ndarray

Notes

If \(c = 0\), the model reduces to the classical power law:

\[y = a x^b\]

See also

fit_powerlaw

Fit a power-law relationship to data.

predict_from_powerlaw

Predict from classical power law.

fit_logquadratic_powerlaw_with_wnls

Fit log-quadratic power law using WNLS.

fit_logquadratic_powerlaw_with_ransac

Fit log-quadratic power law using RANSAC.

disdrodb.summary.routines.predict_from_powerlaw(x, a, b)[source][source]#

Predict values from a power-law relationship.

This function computes predictions using the power-law model:

\[y = a x^b\]
Parameters:
  • x (array-like) – Independent variable values.

  • a (float) – Power-law coefficient.

  • b (float) – Power-law exponent.

Returns:

y – Predicted dependent variable values.

Return type:

numpy.ndarray

Notes

This function does not check for invalid (negative or zero) x values. Ensure that x is compatible with the model before calling.

See also

fit_powerlaw

Fit a power-law relationship to data.

predict_from_logquadratic_powerlaw

Predict from log-quadratic power law.

disdrodb.summary.routines.prepare_latex_table_dsd_summary(df)[source][source]#

Prepare a DataFrame with DSD statistics for LaTeX table output.

disdrodb.summary.routines.prepare_latex_table_events_summary(df)[source][source]#

Prepare a DataFrame with events statistics for LaTeX table output.

disdrodb.summary.routines.prepare_summary_dataset(ds, velocity_method='theoretical_velocity', source='drop_number', minimum_rain_rate=0)[source][source]#

Prepare the L2E or L2M dataset to be converted to a dataframe.

disdrodb.summary.routines.save_table_to_pdf(df: DataFrame, filepath: str, index=True, caption=None, fontsize: str = '\\tiny', orientation: str = 'landscape') None[source][source]#

Render a pandas DataFrame as a well-formatted table in PDF via LaTeX.

Parameters:
  • df (pandas.DataFrame) – The data to render.

  • filepath (str) – File path where write the final PDF (e.g. ‘<…>/table.pdf’).

  • caption (str, optional) – LaTeX caption for the table environment.

  • fontsize (str, optional) – LaTeX font-size command to wrap the table (e.g. ‘\small’). The default is ‘\tiny’.

  • orientation (str) – Page orientation. Allowed values are ‘portrait’ and ‘landscape’. If ‘landscape’, the table will be laid out horizontally. The default is ‘landscape’.

Module contents#

DISDRODB Summary Module.