diff --git a/pysteps/blending/steps.py b/pysteps/blending/steps.py index e41db6a5b..21a0ffc05 100644 --- a/pysteps/blending/steps.py +++ b/pysteps/blending/steps.py @@ -1098,7 +1098,7 @@ def worker(j): neginf=zerovalue, ) # Put back the mask - R_f_ip_recomp[domain_mask] = np.NaN + R_f_ip_recomp[domain_mask] = np.nan extrap_kwargs["displacement_prev"] = D[j] R_f_ep_recomp_, D[j] = extrapolator( R_f_ip_recomp, @@ -1131,7 +1131,7 @@ def worker(j): neginf=np.nanmin(R_f_ip), ) for i in range(n_cascade_levels): - R_f_ep[i][temp_mask] = np.NaN + R_f_ep[i][temp_mask] = np.nan # B. Noise Yn_ip_recomp = blending.utils.recompose_cascade( combined_cascade=Yn_ip, @@ -1182,7 +1182,7 @@ def worker(j): extrap_kwargs_pb["displacement_prev"] = D_pb[j] # Apply the domain mask to the extrapolation component R_ = precip.copy() - R_[domain_mask] = np.NaN + R_[domain_mask] = np.nan R_pm_ep_, D_pb[j] = extrapolator( R_, velocity_blended, diff --git a/pysteps/feature/shitomasi.py b/pysteps/feature/shitomasi.py index 7de1199f0..b4fc68d96 100644 --- a/pysteps/feature/shitomasi.py +++ b/pysteps/feature/shitomasi.py @@ -149,7 +149,7 @@ def detection( # convert to 8-bit input_image = np.ndarray.astype(input_image, "uint8") - mask = (-1 * mask + 1).astype("uint8") + mask = ~mask & 1 params = dict( maxCorners=max_num_features if max_num_features is not None else max_corners, diff --git a/pysteps/io/importers.py b/pysteps/io/importers.py index 8709e68a8..d59637aa8 100644 --- a/pysteps/io/importers.py +++ b/pysteps/io/importers.py @@ -810,7 +810,7 @@ def import_knmi_hdf5(filename, qty="ACRR", accutime=5.0, pixelsize=1000.0, **kwa # the no data value. The precision of the data is two decimals (0.01 mm). if qty == "ACRR": precip = np.where( - precip_intermediate == 65535, np.NaN, precip_intermediate / 100.0 + precip_intermediate == 65535, np.nan, precip_intermediate / 100.0 ) # In case reflectivities are imported, the no data value is 255. Values are @@ -818,7 +818,7 @@ def import_knmi_hdf5(filename, qty="ACRR", accutime=5.0, pixelsize=1000.0, **kwa # as: dBZ = 0.5 * pixel_value - 32.0 (this used to be 31.5). if qty == "DBZH": precip = np.where( - precip_intermediate == 255, np.NaN, precip_intermediate * 0.5 - 32.0 + precip_intermediate == 255, np.nan, precip_intermediate * 0.5 - 32.0 ) if precip is None: @@ -1366,9 +1366,9 @@ def import_odim_hdf5(filename, qty="RATE", **kwargs): mask = np.logical_and(~mask_u, ~mask_n) quality = np.empty(arr.shape) # , dtype=float) quality[mask] = arr[mask] * gain + offset - quality[~mask] = ( - np.nan - ) # a qui ----------------------------- + quality[ + ~mask + ] = np.nan # a qui ----------------------------- if precip is None: raise IOError("requested quantity %s not found" % qty) diff --git a/pysteps/tests/test_io_nowcast_importers.py b/pysteps/tests/test_io_nowcast_importers.py index eafe972ef..d99414f14 100644 --- a/pysteps/tests/test_io_nowcast_importers.py +++ b/pysteps/tests/test_io_nowcast_importers.py @@ -18,6 +18,9 @@ [(precip, metadata), (np.zeros_like(precip), metadata)], ) def test_import_netcdf(precip, metadata, tmp_path): + + pytest.importorskip("pyproj") + field_shape = (precip.shape[1], precip.shape[2]) startdate = metadata["timestamps"][-1] timestep = metadata["accutime"] diff --git a/pysteps/tests/test_nowcasts_linda.py b/pysteps/tests/test_nowcasts_linda.py index d631bac87..2d5f03b71 100644 --- a/pysteps/tests/test_nowcasts_linda.py +++ b/pysteps/tests/test_nowcasts_linda.py @@ -144,6 +144,9 @@ def test_linda_wrong_inputs(): def test_linda_callback(tmp_path): """Test LINDA callback functionality to export the output as a netcdf.""" + + pytest.importorskip("skimage") + n_ens_members = 2 n_timesteps = 3