disdrodb.viz package#
Submodules#
disdrodb.viz.plots module#
DISDRODB Plotting Tools.
- disdrodb.viz.plots.compute_dense_lines(da: DataArray, coord: str, x_bins: list, y_bins: list, normalization='max')[source][source]#
Compute a 2D density-of-lines histogram from an xarray.DataArray.
- Parameters:
da (xarray.DataArray) – Input data array. One of its dimensions (named by
coord) is taken as the horizontal coordinate. All other dimensions are collapsed into “series,” so that each combination of the remaining dimension values produces one 1D line alongcoord.coord (str) – The name of the coordinate/dimension of the DataArray to bin over.
da.coords[coord]must be a 1D numeric array (monotonic is recommended).x_bins (array_like of shape (nx+1,)) – Bin edges to bin the coordinate/dimension. Must be monotonically increasing. The number of x-bins will be
nx = len(x_bins) - 1.y_bins (array_like of shape (ny+1,)) – Bin edges for the DataArray values. Must be monotonically increasing. The number of y-bins will be
ny = len(y_bins) - 1.normalization (bool, optional) – If ‘none’, returns the raw histogram. By default, the function normalize the histogram by its global maximum (‘max’). Log-normalization (‘log’) is also available.
- Returns:
2D histogram of shape
(ny, nx). Dimensions are('y', 'x'), where:x: the bin-center coordinate ofx_bins(lengthnx)y: the bin-center coordinate ofy_bins(lengthny)
Each element
out.values[y_i, x_j]is the count (or normalized count) of how many “series-values” fromdafell into the rectangular binx_bins[j] ≤ x_value < x_bins[j+1]andy_bins[i] ≤ data_value < y_bins[i+1].- Return type:
xr.DataArray
References
Moritz, D., Fisher, D. (2018). Visualizing a Million Time Series with the Density Line Chart https://doi.org/10.48550/arXiv.1808.06019
- disdrodb.viz.plots.max_blend_images(ds_rgb, dim)[source][source]#
Max blend a RGBA DataArray across a samples dimensions.
- disdrodb.viz.plots.normalize_array(arr, method='max')[source][source]#
Normalize a NumPy array according to the chosen method.
- Parameters:
arr (np.ndarray) – Input array.
method (str) – Normalization method. Options: - ‘max’ : Divide by the maximum value. - ‘minmax’: Scale to [0, 1] range. - ‘zscore’: Standardize to mean 0, std 1. - ‘log’ : Apply log10 transform (shifted if min <= 0). - ‘none’ : No normalization (return original array).
- Returns:
Normalized array.
- Return type:
np.ndarray
Module contents#
DISDRODB Visualization Module.
- disdrodb.viz.compute_dense_lines(da: DataArray, coord: str, x_bins: list, y_bins: list, normalization='max')[source][source]#
Compute a 2D density-of-lines histogram from an xarray.DataArray.
- Parameters:
da (xarray.DataArray) – Input data array. One of its dimensions (named by
coord) is taken as the horizontal coordinate. All other dimensions are collapsed into “series,” so that each combination of the remaining dimension values produces one 1D line alongcoord.coord (str) – The name of the coordinate/dimension of the DataArray to bin over.
da.coords[coord]must be a 1D numeric array (monotonic is recommended).x_bins (array_like of shape (nx+1,)) – Bin edges to bin the coordinate/dimension. Must be monotonically increasing. The number of x-bins will be
nx = len(x_bins) - 1.y_bins (array_like of shape (ny+1,)) – Bin edges for the DataArray values. Must be monotonically increasing. The number of y-bins will be
ny = len(y_bins) - 1.normalization (bool, optional) – If ‘none’, returns the raw histogram. By default, the function normalize the histogram by its global maximum (‘max’). Log-normalization (‘log’) is also available.
- Returns:
2D histogram of shape
(ny, nx). Dimensions are('y', 'x'), where:x: the bin-center coordinate ofx_bins(lengthnx)y: the bin-center coordinate ofy_bins(lengthny)
Each element
out.values[y_i, x_j]is the count (or normalized count) of how many “series-values” fromdafell into the rectangular binx_bins[j] ≤ x_value < x_bins[j+1]andy_bins[i] ≤ data_value < y_bins[i+1].- Return type:
xr.DataArray
References
Moritz, D., Fisher, D. (2018). Visualizing a Million Time Series with the Density Line Chart https://doi.org/10.48550/arXiv.1808.06019
- disdrodb.viz.max_blend_images(ds_rgb, dim)[source][source]#
Max blend a RGBA DataArray across a samples dimensions.