コード例 #1
0
def test_parameter_get_unit_works(name, product, unit, expect):
    assert datamodel.Parameter(
        description=name,
        unit=unit,
        dtype="f4",
        dimension=["time"],
    ).get_unit(datamodel.is_temperature(product)) == expect
コード例 #2
0
def test_parameter_l2type_works(para, expect):
    assert datamodel.Parameter(
        description=para,
        unit=datamodel.Unit.product,
        dtype=datamodel.DType.f4,
        dimension=datamodel.Dimension.d2,
    ).l2type == expect
コード例 #3
0
def test_parameter_get_description_works(para, product, expect):
    assert datamodel.Parameter(
        description=para,
        unit="mm",
        dtype="f4",
        dimension=["time"],
    ).get_description(datamodel.is_temperature(product)) == expect
コード例 #4
0
    (1, 1.5, np.inf),
    (1, 1.5, np.NINF),
    (1, 1.5, np.NAN),
))
def test_l2i_is_not_valid_works(freqmode, residual, lmfactor):
    assert not datamodel.L2i(GenerationTime=dt.datetime(2000, 1, 2, 3, 4, 5),
                             Residual=residual,
                             MinLmFactor=lmfactor,
                             FreqMode=freqmode).isvalid()


@pytest.mark.parametrize("para,expect", (
    (
        datamodel.Parameter(
            datamodel.L2ancDesc.LST,
            "-",
            "-",
            "-",
        ),
        0.,
    ),
    (
        datamodel.Parameter(
            datamodel.L2iDesc.Residual,
            "-",
            "-",
            "-",
        ),
        7.,
    ),
    (
        datamodel.Parameter(