Ejemplo n.º 1
0
def test_no_precisions_species_raises():
    cgo_path = get_datapath(filename="capegrim-medusa.18.C", data_type="GC")
    missing_species_prec = get_datapath(filename="capegrim-medusa.18.precisions.broke.C", data_type="GC")

    with pytest.raises(ValueError):
        parse_gcwerks(
            data_filepath=cgo_path, precision_filepath=missing_species_prec, site="cgo", network="agage"
        )
Ejemplo n.º 2
0
def test_read_invalid_instrument_raises():
    thd_path = get_datapath(filename="trinidadhead.01.C", data_type="GC")
    thd_prec_path = get_datapath(filename="trinidadhead.01.precisions.C", data_type="GC")

    with pytest.raises(ValueError):
        parse_gcwerks(
            data_filepath=thd_path,
            precision_filepath=thd_prec_path,
            site="CGO",
            instrument="fish",
            network="agage",
        )
Ejemplo n.º 3
0
def test_read_file_thd():
    thd_path = get_datapath(filename="trinidadhead.01.C", data_type="GC")
    thd_prec_path = get_datapath(filename="trinidadhead.01.precisions.C", data_type="GC")

    gas_data = parse_gcwerks(
        data_filepath=thd_path,
        precision_filepath=thd_prec_path,
        site="thd",
        network="agage",
        instrument="gcmd",
    )

    parsed_surface_metachecker(data=gas_data)

    expected_keys = [
        "ccl4_10m",
        "cfc113_10m",
        "cfc11_10m",
        "cfc12_10m",
        "ch3ccl3_10m",
        "ch4_10m",
        "chcl3_10m",
        "n2o_10m",
    ]

    assert sorted(list(gas_data.keys())) == expected_keys

    meas_data = gas_data["ch3ccl3_10m"]["data"]

    assert meas_data.time[0] == pd.Timestamp("2001-01-01T01:05:22.5")
    assert meas_data.time[-1] == pd.Timestamp("2001-12-31T23:18:22.5")

    assert meas_data["ch3ccl3"][0] == 41.537
    assert meas_data["ch3ccl3"][-1] == 34.649
Ejemplo n.º 4
0
def test_read_ridgehill_window_inlet_all_NaNs():
    data_path = get_datapath(filename="ridgehill-md.11.C", data_type="GC")
    prec_path = get_datapath(filename="ridgehill-md.11.precisions.C", data_type="GC")

    res = parse_gcwerks(
        data_filepath=data_path, precision_filepath=prec_path, site="RGL", instrument="gcmd", network="agage"
    )

    assert not res
Ejemplo n.º 5
0
def cgo_data():
    cgo_data = get_datapath(filename="capegrim-medusa.18.C", data_type="GC")
    cgo_prec = get_datapath(filename="capegrim-medusa.18.precisions.C", data_type="GC")

    gas_data = parse_gcwerks(
        data_filepath=cgo_data,
        precision_filepath=cgo_prec,
        site="cgo",
        instrument="medusa",
        network="agage",
    )

    return gas_data
Ejemplo n.º 6
0
def thd_data():
    thd_path = get_datapath(filename="trinidadhead.01.C", data_type="GC")
    thd_prec_path = get_datapath(filename="trinidadhead.01.precisions.C", data_type="GC")

    gas_data = parse_gcwerks(
        data_filepath=thd_path,
        precision_filepath=thd_prec_path,
        site="THD",
        instrument="medusa",
        network="agage",
    )

    return gas_data
Ejemplo n.º 7
0
def test_read_thd_window_inlet():
    data_path = get_datapath(filename="trinidadhead.01.window-inlet.C", data_type="GC")
    prec_path = get_datapath(filename="trinidadhead.01.precisions.C", data_type="GC")

    res = parse_gcwerks(
        data_filepath=data_path, precision_filepath=prec_path, site="thd", instrument="gcmd", network="agage"
    )

    parsed_surface_metachecker(data=res)

    data = res["ch4_10m"]["data"]

    assert data.time[0] == pd.Timestamp("2001-01-01T01:05:22.5")
    assert data.time[-1] == pd.Timestamp("2001-01-01T10:25:22.5")
    assert data["ch4"][0] == pytest.approx(1818.62)
    assert data["ch4"][-1] == pytest.approx(1840.432)
Ejemplo n.º 8
0
def test_read_shangdianzi_ASM_inlet():
    data_path = get_datapath(filename="shangdianzi-medusa.18.C", data_type="GC")
    prec_path = get_datapath(filename="shangdianzi-medusa.18.precisions.C", data_type="GC")

    res = parse_gcwerks(
        data_filepath=data_path,
        precision_filepath=prec_path,
        site="sdz",
        instrument="medusa",
        network="agage",
    )

    parsed_surface_metachecker(data=res)

    data = res["nf3_80m"]["data"]

    data.time[0] == pd.Timestamp("2018-01-16T09:10:00")
    data.time[-1] == pd.Timestamp("2018-01-16T20:00:00")
    data["nf3"][0] == pytest.approx(2.172)
    data["nf3"][-1] == pytest.approx(2.061)
Ejemplo n.º 9
0
def test_recombination_GC():
    get_local_bucket(empty=True)

    data = get_datapath(filename="capegrim-medusa.18.C", data_type="GC")
    precision = get_datapath(filename="capegrim-medusa.18.precisions.C",
                             data_type="GC")

    ObsSurface.read_file((data, precision),
                         data_type="GCWERKS",
                         site="cgo",
                         network="agage")

    data = parse_gcwerks(data_filepath=data,
                         precision_filepath=precision,
                         site="CGO",
                         instrument="medusa",
                         network="AGAGE")

    toluene_data = data["c6h5ch3_70m"]["data"]

    species = "c6h5ch3"
    site = "CGO"
    inlet = "70m"

    result = search(species=species, site=site, inlet=inlet)
    keys = result.keys(site=site, species=species, inlet=inlet)

    toluene_data_recombined = recombine_datasets(keys=keys)

    toluene_data.attrs = {}
    toluene_data_recombined.attrs = {}

    assert toluene_data.time.equals(toluene_data_recombined.time)
    assert toluene_data["c6h5ch3"].equals(toluene_data_recombined["c6h5ch3"])
    assert toluene_data["c6h5ch3_repeatability"].equals(
        toluene_data_recombined["c6h5ch3_repeatability"])
    assert toluene_data["c6h5ch3_status_flag"].equals(
        toluene_data_recombined["c6h5ch3_status_flag"])
    assert toluene_data["c6h5ch3_integration_flag"].equals(
        toluene_data_recombined["c6h5ch3_integration_flag"])