inversion.py 1.46 KB
Newer Older
1
2
3
4
5
6
7
import pytest


@pytest.fixture(
    params=
    [
        {"resol": "full"},
Antoine Berchet's avatar
Antoine Berchet committed
8
9
10
11
        pytest.param({"resol": "full", "correlations": 2e5},
                     marks=pytest.mark.article),
        {"resol": "bands"},
        {"resol": "global"},
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    ])
def dummy_config_inversion(dummy_config_fwd, request):
    """
    Fixture that returns a temporary folder and a configuration file for the
    dummy_forward model.
    """

    tmpdir_str, config, tag = dummy_config_fwd

    # Change the horizontal resolution of the control vector
    resolution = request.param.get("resol", "full")
    spec = "CH4_ref" if "families" in tag else "CH4"
    if resolution == "bands":
        config["datavect"]["components"]["fluxes"]["parameters"][spec].update(
            {
                "period": "5D",
                "hresol": "ibands",
Antoine Berchet's avatar
Antoine Berchet committed
29
30
                "bands_i": [0, 3, 6, 9, 12],
                "bands_j": [0, 3, 6, 9, 12, 15, 18]
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
            }
        )
    
    elif resolution == "global":
        config["datavect"]["components"]["fluxes"]["parameters"][spec].update(
            {
                "period": "5D",
                "hresol": "global"
            }
        )
    
    elif resolution == "full":
        config["datavect"]["components"]\
                ["fluxes"]["parameters"][spec]["hcorrelations"]["sigma"] = \
            request.param.get("correlations", 500)
    
    # Tag for config file to dump in examples
    tag += "_" + resolution

    yield tmpdir_str, config, tag
Antoine Berchet's avatar
Antoine Berchet committed
51