示例#1
0
def test_cl_fix_metadata(mock_base_fix_metadata, cl_cubes):
    """Test ``fix_metadata`` for ``cl``."""
    mock_base_fix_metadata.return_value = cl_cubes
    fix = Cl(get_var_info('CMIP5', 'Amon', 'cl'))
    fixed_cubes = fix.fix_metadata(cl_cubes)
    mock_base_fix_metadata.assert_called_once_with(fix, cl_cubes)
    assert len(fixed_cubes) == 2
    cl_cube = fixed_cubes.extract_cube(
        'cloud_area_fraction_in_atmosphere_layer')
    b_coord_cl = cl_cube.coord('vertical coordinate formula term: b(k)')
    assert not b_coord_cl.attributes
    x_cube = fixed_cubes.extract_cube('x')
    b_coord_x = x_cube.coord('vertical coordinate formula term: b(k)')
    assert b_coord_x.attributes == {'a': 1, 'b': '2'}
示例#2
0
def test_get_cl_fix():
    """Test getting of fix."""
    fix = Fix.get_fixes('CMIP5', 'ACCESS1-0', 'Amon', 'cl')
    assert fix == [Cl(None), AllVars(None)]