Skip to content

Initializing noise field with default arguments returns array of zeros. Is this expected behavior? #451

Closed
@bwalraven

Description

@bwalraven

I am running a probabilistic nowcast for a rectangular precipitation field (199x113) using the steps function with the following settings:

domain = 'spatial'
extrap_method = 'semilagrangian'
decomp_method = 'fft'
fft_method = 'numpy'
noise_method = 'nonparametric'
noise_stddev_adj = 'auto'

and run into the following error before the noise adjustment coefficients are computed:
ValueError: field contains non-finite values.

This points me to the following statement in the cascade decomposition:

if np.any(~np.isfinite(field)):
    raise ValueError("field contains non-finite values") 

which in turn points me to decomp_N = decomp_method(N, F, mask=MASK_) in the following function:

def compute_noise_stddev_adjs(

This stems from the fact that the noise field F returned in the function:

def initialize_nonparam_2d_fft_filter(field, **kwargs):

is an array of zeroes, and thus N in the following lines in noise generation returns a nan.

It appears the issue lies in the following lines in the function

def initialize_nonparam_2d_fft_filter(field, **kwargs):

F = np.zeros(fft_shape, dtype=complex)
 for i in range(nr_fields):
     if use_full_fft:
         F += fft.fft2(field[i, :, :] * tapering)
     else:
         F += fft.rfft2(field[i, :, :] * tapering)
 F /= nr_fields

Using the default arguments, with window_function="tukey" and a field size of 199x113, the tapering returns an oval shape (black for values >0):
download

This essentially means that if we have a precipitation field, with precipitation only at the edges, and use the default steps settings, this would return a noise field of zeros and eventually lead to an error in the cascade decomposition.

Though the function appears to numerically behave as expected, is this an error or is this desired behavior? Does this mean it's not possible to compute a nowcast if we have precipitation only around the edges of our domain?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions