Ejemplo n.º 1
0
def test_PredictionEnsemble_plot(
    hind_ds_initialized_1d,
    hist_ds_uninitialized_1d,
    reconstruction_ds_1d,
    observations_ds_1d,
    variable,
    show_members,
    x,
):
    """Test PredictionEnsemble.plot()."""
    he = HindcastEnsemble(hind_ds_initialized_1d)
    kws = {"show_members": show_members, "variable": variable, "x": x}
    he.plot(**kws)
    he = he.add_uninitialized(hist_ds_uninitialized_1d)
    he.plot(**kws)
    he = he.add_observations(reconstruction_ds_1d)
    he.plot(**kws)
    he = he.add_observations(observations_ds_1d)
    he.plot(**kws)

    if x == "time":
        pm = PerfectModelEnsemble(hind_ds_initialized_1d)
        pm.plot(**kws)
        pm = pm.add_control(hist_ds_uninitialized_1d.isel(member=0, drop=True))
        pm.plot(**kws)
Ejemplo n.º 2
0
def test_PerfectModelEnsemble_plot(PM_ds_initialized_1d, PM_ds_control_1d,
                                   variable, show_members, cmap):
    """Test PredictionEnsemble.plot()."""
    pm = PerfectModelEnsemble(PM_ds_initialized_1d)
    kws = {"cmap": cmap, "show_members": show_members, "variable": variable}
    pm.plot(**kws)
    pm = pm.add_control(PM_ds_control_1d)
    pm.plot(**kws)
    pm = pm.generate_uninitialized()
    pm.plot(**kws)
Ejemplo n.º 3
0
def test_PerfectModelEnsemble_plot_fails_3d(PM_ds_initialized_3d):
    """Test PredictionEnsemble.plot()."""
    pm = PerfectModelEnsemble(PM_ds_initialized_3d)
    with pytest.raises(DimensionError) as excinfo:
        pm.plot()
    assert "does not allow dimensions other" in str(excinfo.value)