pysteps.blending.utils.decompose_NWP

Contents

pysteps.blending.utils.decompose_NWP#

pysteps.blending.utils.decompose_NWP(R_NWP, NWP_model, analysis_time, timestep, valid_times, output_path, num_cascade_levels=8, num_workers=1, decomp_method='fft', fft_method='numpy', domain='spatial', normalize=True, compute_stats=True, compact_output=True)#

Decomposes the NWP forecast data into cascades and saves it in a netCDF file

Parameters:
  • R_NWP (array-like) – Array of dimension (n_timesteps, x, y) containing the precipitation forecast from some NWP model.

  • NWP_model (str) – The name of the NWP model

  • analysis_time (numpy.datetime64) – The analysis time of the NWP forecast. The analysis time is assumed to be a numpy.datetime64 type as imported by the pysteps importer

  • timestep (int) – Timestep in minutes between subsequent NWP forecast fields

  • valid_times (array_like) – Array containing the valid times of the NWP forecast fields. The times are assumed to be numpy.datetime64 types as imported by the pysteps importer.

  • output_path (str) – The location where to save the file with the NWP cascade. Defaults to the path_workdir specified in the rcparams file.

  • num_cascade_levels (int, optional) – The number of frequency bands to use. Must be greater than 2. Defaults to 8.

  • num_workers (int, optional) – The number of workers to use for parallel computation. Applicable if dask is enabled or pyFFTW is used for computing the FFT. When num_workers>1, it is advisable to disable OpenMP by setting the environment variable OMP_NUM_THREADS to 1. This avoids slowdown caused by too many simultaneous threads.

  • decomp_method (str, optional) – A string defining the decomposition method to use. Defaults to “fft”.

  • fft_method (str or tuple, optional) – A string or a (function,kwargs) tuple defining the FFT method to use (see pysteps.utils.interface.get_method()). Defaults to “numpy”. This option is not used if input_domain and output_domain are both set to “spectral”.

  • domain ({"spatial", "spectral"}, optional) – If “spatial”, the output cascade levels are transformed back to the spatial domain by using the inverse FFT. If “spectral”, the cascade is kept in the spectral domain. Defaults to “spatial”.

  • normalize (bool, optional) – If True, normalize the cascade levels to zero mean and unit variance. Requires that compute_stats is True. Implies that compute_stats is True. Defaults to False.

  • compute_stats (bool, optional) – If True, the output dictionary contains the keys “means” and “stds” for the mean and standard deviation of each output cascade level. Defaults to False.

  • compact_output (bool, optional) – Applicable if output_domain is “spectral”. If set to True, only the parts of the Fourier spectrum with non-negligible filter weights are stored. Defaults to False.

Return type:

None