Example #1
0
def test_s2s_availability_2(availability_s2s_as_txt):
    av = Availability(
        availability_s2s_as_txt,
        parser=parser_for_availability_s2s,
        intervals="date",
    )
    av.check(number=30, origin="eccc")
    with pytest.raises(ValueError):
        av.check(number=100, fctype="hindcast", origin="ecmwf")
    av.check(number=30, date="2020-01-02", origin="eccc")
    with pytest.raises(ValueError):
        av.check(number=30, date="2111-01-02", origin="eccc")
Example #2
0
    def __init__(self, availability, **kwargs):
        if isinstance(availability, str):
            if not os.path.isabs(availability):
                caller = os.path.dirname(inspect.stack()[1].filename)
                availability = os.path.join(caller, availability)

        self.availability = Availability(availability, **kwargs)
def test_availability_3():
    avail = Availability(C0)
    print(avail)
Example #4
0
def test_s2s_availability_1(availability_s2s_as_list):
    av = Availability(availability_s2s_as_list)

    print(av.tree())

    with pytest.raises(ValueError):
        av.check(number=75)
    av.check(number=7)

    av.check(number=30, origin="ecmwf")
    with pytest.raises(ValueError):
        av.check(number=30, origin="eccc")

    #   av.check(origin='ncep')
    for i in av.flatten():
        print(i)
    # av.check(origin=["unknown"])
    print(av.tree())

    #    av.check(number=1, date=["2010-01-07","2010-01-14"])
    #    av.check(number=1, date=["2010-01-07","2010-01-14"], origin=["unknown"])
    #    av.check(number=1, date=["2010-01-02","2010-01-09"], origin=["ecmwf", "eccc"])

    print("...")
    print(
        av.missing(
            number=1,
            origin=["ecmwf", "ncep"],
            date="2020-01-09",
            # param=['2t', 'ci'],
        ).tree())
    print(av.count(
        number=1,
        origin=["ecmwf", "ncep"],
        date="2020-01-09",
    ))
Example #5
0
def test_availability_constructor_from_json():
    path = os.path.join(os.path.dirname(__file__), "availability.json")
    avail = Availability(path)
    print(avail)
Example #6
0
def test_availability_constructor_from_text():
    avail = Availability(C0)
    print(avail)