Implementation of miscellaneous utility functions.


Interface for the utils module.

get_method(name, **kwargs)

Return a callable function for the utility method corresponding to the given name.


Utility methods for creating and processing arrays.

compute_centred_coord_array(M, N)

Compute a 2D coordinate array, where the origin is at the center.


Data cleansing routines for pysteps.

decluster(coord, input_array, scale[, ...])

Decluster a set of sparse data points by aggregating, that is, taking the median value of all values lying within a certain distance (i.e., a cluster).

detect_outliers(input_array, thr[, coord, ...])

Detect outliers in a (multivariate and georeferenced) dataset.


Methods for converting physical units.

to_rainrate(R, metadata[, zr_a, zr_b])

Convert to rain rate [mm/h].

to_raindepth(R, metadata[, zr_a, zr_b])

Convert to rain depth [mm].

to_reflectivity(R, metadata[, zr_a, zr_b])

Convert to reflectivity [dBZ].


Functions to manipulate array dimensions.

aggregate_fields(data, window_size[, axis, ...])

Aggregate fields along a given direction.

aggregate_fields_time(R, metadata, ...[, ...])

Aggregate fields in time.

aggregate_fields_space(R, metadata, space_window)

Upscale fields in space.

clip_domain(R, metadata[, extent])

Clip the field domain by geographical coordinates.

square_domain(R, metadata[, method, inverse])

Either pad or crop a field to obtain a square domain.


Interface module for different FFT methods.

get_numpy(shape[, fftn_shape])

get_scipy(shape[, fftn_shape])

get_pyfftw(shape[, fftn_shape, n_threads])


Image processing routines for pysteps.

morph_opening(input_image, thr, n)

Filter out small scale noise on the image by applying a binary morphological opening, that is, erosion followed by dilation.


Interpolation routines for pysteps.

idwinterp2d(xy_coord, values, xgrid, ygrid)

Inverse distance weighting interpolation of a sparse (multivariate) array.

rbfinterp2d(xy_coord, values, xgrid, ygrid, ...)

Radial basis function interpolation of a sparse (multivariate) array.


Utility methods for processing and analyzing precipitation fields in the Fourier domain.

corrcoef(X, Y, shape[, use_full_fft])

Compute the correlation coefficient between two-dimensional arrays in the spectral domain.

mean(X, shape)

Compute the mean value of a two-dimensional array in the spectral domain.

rapsd(field[, fft_method, return_freq, d, ...])

Compute radially averaged power spectral density (RAPSD) from the given 2D input field.


Function to remove the rain/no-rain discontinuity.

std(X, shape[, use_full_fft])

Compute the standard deviation of a two-dimensional array in the spectral domain.


Implementations of window functions for computing of the FFT.

compute_mask_window_function(mask, func, ...)

Compute window function for a two-dimensional area defined by a non-rectangular mask.

compute_window_function(m, n, func, **kwargs)

Compute window function for a two-dimensional rectangular region.


Methods for transforming data values.

boxcox_transform(R[, metadata, Lambda, ...])

The one-parameter Box-Cox transformation.

dB_transform(R[, metadata, threshold, ...])

Methods to transform precipitation intensities to/from dB units.

NQ_transform(R[, metadata, inverse])

The normal quantile transformation as in Bogner et al (2012).

sqrt_transform(R[, metadata, inverse])

Square-root transform.


Reprojection tools to reproject grids and adjust the grid cell size of an input field to a destination field.

reproject_grids(src_array, dst_array, ...)

Reproject precipitation fields to the domain of another precipitation field.