Esempio n. 1
0
def test_animate_save(tmp_path):
    animate(
        PRECIP,
        np.stack((PRECIP, PRECIP)),
        display_animation=False,
        savefig=True,
        path_outputs=tmp_path,
        fig_dpi=10,
    )
    assert len(os.listdir(tmp_path)) == 9
Esempio n. 2
0
# Nicely print the metadata
pprint(metadata)

# Estimate the motion field with Lucas-Kanade
oflow_method = motion.get_method("LK")
V = oflow_method(R[-3:, :, :])

# Extrapolate the last radar observation
extrapolate = nowcasts.get_method("extrapolation")
R[~np.isfinite(R)] = metadata["zerovalue"]
R_f = extrapolate(R[-1, :, :], V, n_leadtimes)

# Back-transform to rain rate
R_f = transformation.dB_transform(R_f, threshold=0.1, inverse=True)[0]

# Plot the motion field
animations.animate(R,
                   nloops=1,
                   R_fct=R_f,
                   timestep_min=5,
                   motion_plot='quiver',
                   geodata=None,
                   UV=V,
                   colorscale='IRIS',
                   units='mm/h',
                   colorbar=True,
                   plotanimation=False,
                   savefig=True,
                   fig_format='png',
                   path_outputs='/usr/iris_data/from_PYSTEPS/')
Esempio n. 3
0
def test_animate_valueerrors(anim_args, anim_kwargs):
    with pytest.raises(ValueError):
        animate(*anim_args, **anim_kwargs)
Esempio n. 4
0
def test_animate(anim_args, anim_kwargs):
    with patch("matplotlib.pyplot.show"):
        animate(*anim_args, **anim_kwargs)
Esempio n. 5
0
def test_animate_typeerrors(anim_args, anim_kwargs):
    with pytest.raises(TypeError):
        animate(*anim_args, **anim_kwargs)