示例#1
0
def test_extra_obs_file(drogondata):
    """Test that we will not bail on a stray file"""
    # pylint: disable=redefined-outer-name
    # pylint: disable=unused-argument
    Path("rft/FOO.obs").write_text("FOBOBAR")
    dframe = merge_rft_ertobs("gendata_rft.csv", "rft")
    assert len(dframe) == 9
示例#2
0
def test_merge_drogon(drogondata):
    """Test main merge functionality"""
    dframe = merge_rft_ertobs("gendata_rft.csv", "rft")
    assert not dframe.empty
    assert {"pressure", "observed", "error", "well",
            "time"}.issubset(dframe.columns)
    assert np.isclose((dframe["observed"] - dframe["pressure"]).abs().mean(),
                      6.2141156)
    assert set(dframe["error"].values) == {3.0}
示例#3
0
def test_merge_drogon_inactive(drogondata):
    """Check that inactive cells are taken care of as such"""
    # Modify simulated data:
    gdata = pd.read_csv("gendata_rft.csv")
    # pylint: disable=no-member  # false positive on Pandas objects
    gdata.loc[0, "pressure"] = -1.0
    gdata.to_csv("gendata_rft.csv")

    dframe = merge_rft_ertobs("gendata_rft.csv", "rft")
    assert not dframe.empty
    assert {"pressure", "observed", "error", "well",
            "time"}.issubset(dframe.columns)
    assert sum(dframe["pressure"].isnull()) == 1
    assert not np.isclose(
        (dframe["observed"] - dframe["pressure"]).abs().mean(), 6.2141156)
示例#4
0
def test_extra_obs_file(drogondata):
    """Test that we will not bail on a stray file"""
    Path("rft/FOO.obs").write_text("FOBOBAR", encoding="utf8")
    dframe = merge_rft_ertobs("gendata_rft.csv", "rft")
    assert len(dframe) == 9