Example #1
0
def spec_check_grid(request, gl, vi, ei, cat):
    expected_failures = (not_supported_failures + intake_concat_failures + [
        ("CMCC-ESM2", "*", "*", "gn"),
        ("CMCC-CM2-SR5", "*", "*", "gn"),
        ("CMCC-CM2-HR4", "*", "*", "gn"),
        ("FGOALS-f3-L", "*", "*", "gn"),
        ("FGOALS-g3", "*", "*", "gn"),
        ("E3SM-1-0", ["so", "thetao", "o2"], "*", "gn"),
        (
            "E3SM-1-0",
            ["zos"],
            ["historical", "ssp585", "ssp245", "ssp370", "esm-hist"],
            "gr",
        ),
        (
            "EC-Earth3-AerChem",
            ["so", "thetao", "zos"],
            ["historical", "piControl", "ssp370"],
            "gn",
        ),
        ("EC-Earth3-Veg", "*", "historical", "gr"),
        ("EC-Earth3-CC", "*", "*", "gn"),
        ("MPI-ESM-1-2-HAM", "*", "*", "gn"),
        ("NorESM2-MM", "*", "historical", "gn"),
        ("NorESM2-MM", ["thetao", "so", "uo"], "historical", "gr"),
        ("IITM-ESM", "*", "*", "gn"),
        ("GFDL-CM4", ["uo"], "*", "gn"),
        ("IPSL-CM5A2-INCA", "*", "*", "gn"),
        ("IPSL-CM6A-LR-INCA", "*", "*", "gn"),
    ])
    spec = (request.param, vi, ei, gl, cat)
    request.param = spec
    if model_id_match(expected_failures, request.param[0:-1]):
        request.node.add_marker(pytest.mark.xfail(strict=True, reason=""))
    return request
Example #2
0
def spec_check_dim_coord_values(request, gl, vi, ei, cat):
    expected_failures = (not_supported_failures + intake_concat_failures + [
        ("NorESM2-MM", ["uo", "zos"], "historical", "gn"),
        ("NorESM2-MM", "thetao", "historical", "gn"),
        ("NorESM2-MM", "thetao", "historical", "gr"),
        ("FGOALS-f3-L", ["thetao"], "piControl", "gn"),
    ])
    spec = (request.param, vi, ei, gl, cat)
    request.param = spec
    if model_id_match(expected_failures, request.param[0:-1]):
        request.node.add_marker(pytest.mark.xfail(strict=True))
    return request
Example #3
0
def spec_check_bounds_verticies(request, gl, vi, ei, cat):
    expected_failures = (not_supported_failures + intake_concat_failures + [
        ("FGOALS-f3-L", ["thetao", "so", "uo", "zos"], "*", "gn"),
        ("FGOALS-g3", ["thetao", "so", "uo", "zos"], "*", "gn"),
        ("NorESM2-MM", ["thetao", "uo", "zos"], "historical", "gn"),
        ("NorESM2-MM", ["thetao", "so"], "historical", "gr"),
        ("IPSL-CM6A-LR", ["thetao", "o2"], "historical", "gn"),
        ("IITM-ESM", ["so", "uo", "thetao"], "piControl", "gn"),
        ("GFDL-CM4", "uo", "*", "gn"),
    ])
    spec = (request.param, vi, ei, gl, cat)
    request.param = spec
    if model_id_match(expected_failures, request.param[0:-1]):
        request.node.add_marker(pytest.mark.xfail(strict=True))
    return request
Example #4
0
def spec_check_dim_coord_values_wo_intake(request, gl, vi, ei, cat):
    expected_failures = not_supported_failures + [
        ("FGOALS-f3-L", ["thetao"], "piControl", "gn"),
        # (
        #     "GFDL-CM4",
        #     "thetao",
        #     "historical",
        #     "gn",
        # ),  # this should not fail and should trigger an xpass (I just use this for dev purposes to check
        #     # the strict option)
    ]
    spec = (request.param, vi, ei, gl, cat)
    request.param = spec
    if model_id_match(expected_failures, request.param[0:-1]):
        request.node.add_marker(pytest.mark.xfail(strict=True))
    return request
Example #5
0
def test_model_id_match():

    # wrong amount of elements
    with pytest.raises(ValueError):

        model_id_match([("A", "a", "aa"), ("A", "a", "aa", "aaa")], ("A", "a", "aa"))

    with pytest.raises(ValueError):
        model_id_match([("A", "a", "aa"), ("B", "a", "aa")], ("A", "a", "aa", "aaa"))

    assert model_id_match([("A", "a", "aa"), ("B", "a", "aa")], ("A", "a", "aa"))
    assert ~model_id_match([("A", ["b", "c"], "aa")], ("A", "a", "aa"))
    assert ~model_id_match([("A", ["b", "c"], "aa")], ("A", "a", "aa"))
    assert ~model_id_match(
        [("EC-Earth3-AerChem", ["so"], "historical", "gn")],
        ("EC-Earth3", ["so"], "historical", "gn"),
    )
    assert ~model_id_match([("A", "a", "aa"), ("B", "a", "aa")], ("AA", "a", "aa"))
    assert ~model_id_match([("AA", "a", "aa"), ("B", "a", "aa")], ("A", "a", "aa"))
    assert ~model_id_match([(["AA"], "a", "aa"), ("B", "a", "aa")], ("A", "a", "aa"))
    assert ~model_id_match([(["AA"], ["a"], "aa"), ("B", "a", "aa")], ("A", "a", "aa"))
    assert model_id_match([("*", "a", "aa")], ("whatever", "a", "aa"))
    assert model_id_match([(["bb", "b"], "a", "aa")], ("b", "a", "aa"))
    assert model_id_match(
        [(["bb", "b"], "a", "aa"), (["bb", "b"], "c", "cc")], ("bb", "a", "aa")
    )