pysteps.cascade#

Methods for constructing bandpass filters and decomposing 2d precipitation fields into different spatial scales.

pysteps.cascade.interface#

Interface for the cascade module.

get_method(name)

Return a callable function for the bandpass filter or cascade decomposition method corresponding to the given name.

pysteps.cascade.bandpass_filters#

Bandpass filters for separating different spatial scales from two-dimensional images in the frequency domain.

The methods in this module implement the following interface:

filter_xxx(shape, n, optional arguments)

where shape is the shape of the input field, respectively, and n is the number of frequency bands to use.

The output of each filter function is a dictionary containing the following key-value pairs:

Key

Value

weights_1d

2d array of shape (n, r) containing 1d filter weights for each frequency band k=1,2,…,n

weights_2d

3d array of shape (n, M, int(N/2)+1) containing the 2d filter weights for each frequency band k=1,2,…,n

central_freqs

1d array of shape n containing the central frequencies of the filters

shape

the shape of the input field in the spatial domain

where r = int(max(N, M)/2)+1

By default, the filter weights are normalized so that for any Fourier wavenumber they sum to one.

Available filters#

filter_uniform(shape, n)

A dummy filter with one frequency band covering the whole domain.

filter_gaussian(shape, n[, gauss_scale, d, ...])

Implements a set of Gaussian bandpass filters in logarithmic frequency scale.

pysteps.cascade.decomposition#

Methods for decomposing two-dimensional fields into multiple spatial scales and recomposing the individual scales to obtain the original field.

The methods in this module implement the following interface:

decomposition_xxx(field, bp_filter, **kwargs)
recompose_xxx(decomp, **kwargs)

where field is the input field and bp_filter is a dictionary returned by a filter method implemented in pysteps.cascade.bandpass_filters. The decomp argument is a decomposition obtained by calling decomposition_xxx. Optional parameters can be passed in the keyword arguments. The output of each method is a dictionary with the following key-value pairs:

Key

Value

cascade_levels

three-dimensional array of shape (k,m,n), where k is the number of cascade levels and the input fields have shape (m,n) if domain is “spectral” and compact output is requested (see the table below), cascade_levels contains a list of one-dimensional arrays

domain

domain of the cascade decomposition: “spatial” or “spectral”

normalized

are the cascade levels normalized: True or False

The following key-value pairs are optional. They are included in the output if kwargs contains the “compute_stats” key with value set to True:

Key

Value

means

list of mean values for each cascade level

stds

list of standard deviations for each cascade level

The following key-value pairs are included in the output if kwargs contains the key “output_domain” with value set to “spectral”:

Key

Value

compact_output

True or False. If set to True, only the parts of the Fourier spectrum with non-negligible filter weights are stored.

weight_masks

Applicable if compact_output is True. Contains a list of masks, where a True value indicates that the corresponding Fourier wavenumber is included in the decomposition

Available methods#

decomposition_fft(field, bp_filter, **kwargs)

Decompose a two-dimensional input field into multiple spatial scales by using the Fast Fourier Transform (FFT) and a set of bandpass filters.

recompose_fft(decomp, **kwargs)

Recompose a cascade obtained with decomposition_fft by inverting the normalization and summing the cascade levels.