    def __decompose_nwp_if_needed_and_fill_nans_in_nwp(self, t):
        """
        Decompose NWP model precipitation fields if needed, store cascade components,
        and replace any NaN or infinite values with appropriate minimum values.
        """
        if self.__state.precip_models_cascades is not None:
            decomp_precip_models = list(self.__state.precip_models_cascades[:, t])

        else:
            if self.__precip_models.shape[0] == 1:
                decomp_precip_models = [
                    self.__params.decomposition_method(
                        self.__precip_models[0, t, :, :],
                        bp_filter=self.__params.bandpass_filter,
                        fft_method=self.__params.fft,
                        output_domain=self.__config.domain,
                        normalize=True,
                        compute_stats=True,
                        compact_output=True,
                    )
                ]
            else:
                with ThreadPool(self.__config.num_workers) as pool:
                    decomp_precip_models = pool.map(
                        partial(
                            self.__params.decomposition_method,
                            bp_filter=self.__params.bandpass_filter,
                            fft_method=self.__params.fft,
                            output_domain=self.__config.domain,
                            normalize=True,
                            compute_stats=True,
                            compact_output=True,
                        ),
                        list(self.__precip_models[:, t, :, :]),
                    )

        self.__state.precip_models_cascades_timestep = np.array(
            [decomp["cascade_levels"] for decomp in decomp_precip_models]
        )
        self.__state.mean_models_timestep = np.array(
            [decomp["means"] for decomp in decomp_precip_models]
        )
        self.__state.std_models_timestep = np.array(
            [decomp["stds"] for decomp in decomp_precip_models]
        )

        # Check if the NWP fields contain nans or infinite numbers. If so,
        # fill these with the minimum value present in precip (corresponding to
        # zero rainfall in the radar observations)

        # Ensure that the NWP cascade and fields do no contain any nans or infinite number
        # Fill nans and infinite numbers with the minimum value present in precip
        self.__state.precip_models_timestep = self.__precip_models[:, t, :, :].astype(
            np.float64, copy=False
        )  # (corresponding to zero rainfall in the radar observations)
        min_cascade = np.nanmin(self.__state.precip_cascades)
        min_precip = np.nanmin(self.__precip)
        self.__state.precip_models_cascades_timestep[
            ~np.isfinite(self.__state.precip_models_cascades_timestep)
        ] = min_cascade
        self.__state.precip_models_timestep[
            ~np.isfinite(self.__state.precip_models_timestep)
        ] = min_precip
        # Also set any nans or infs in the mean and sigma of the cascade to
        # respectively 0.0 and 1.0
        self.__state.mean_models_timestep[
            ~np.isfinite(self.__state.mean_models_timestep)
        ] = 0.0
        self.__state.std_models_timestep[
            ~np.isfinite(self.__state.std_models_timestep)
        ] = 0.0
Decompose NWP model precipitation fields if needed, store cascade components,
and replace any NaN or infinite values with appropriate minimum values.
pysteps/blending/steps.py