Esempio n. 1
0
    def test_orography(self):
        # Mock an orography field we've seen.
        field = mock_nimrod_field()
        cube = iris.cube.Cube(np.arange(100).reshape(10, 10))

        field.dt_year = field.dt_month = field.dt_day = field.int_mdi
        field.dt_hour = field.dt_minute = field.int_mdi
        field.proj_biaxial_ellipsoid = 0
        field.tm_meridian_scaling = 0.999601
        field.field_code = 73
        field.reference_vertical_coord_type = field.int_mdi  # Not bounded
        field.reference_vertical_coord = field.int_mdi
        field.vertical_coord_type = 1
        field.vertical_coord = 8888
        field.ensemble_member = field.int_mdi
        field.threshold_value = field.int_mdi
        field.title = "(MOCK) 2km mean orography"
        field.units = "metres"
        field.source = "GLOBE DTM"

        nimrod_load_rules.name(cube, field, handle_metadata_errors=True)
        nimrod_load_rules.units(cube, field)
        nimrod_load_rules.reference_time(cube, field)
        nimrod_load_rules.vertical_coord(cube, field)
        nimrod_load_rules.attributes(cube, field)

        self.assertCML(cube, ("nimrod", "mockography.cml"))
Esempio n. 2
0
    def test_levels_below_ground(self):
        # Mock a soil temperature field we've seen.
        field = mock_nimrod_field()
        cube = iris.cube.Cube(np.arange(100).reshape(10, 10))

        field.field_code = -1  # Not orography
        field.reference_vertical_coord_type = field.int_mdi  # Not bounded
        field.vertical_coord_type = 12
        field.vertical_coord = 42
        nimrod_load_rules.vertical_coord(cube, field)

        self.assertCML(cube, ("nimrod", "levels_below_ground.cml"))
Esempio n. 3
0
    def test_levels_below_ground(self):
        # Mock a soil temperature field we've seen.
        field = mock_nimrod_field()
        cube = iris.cube.Cube(np.arange(100).reshape(10, 10))

        field.field_code = -1  # Not orography
        field.reference_vertical_coord_type = field.int_mdi  # Not bounded
        field.vertical_coord_type = 12
        field.vertical_coord = 42
        nimrod_load_rules.vertical_coord(cube, field)

        self.assertCML(cube, ("nimrod", "levels_below_ground.cml"))
Esempio n. 4
0
 def _call_vertical_coord(
     self,
     vertical_coord_val=None,
     vertical_coord_type=None,
     reference_vertical_coord=None,
     reference_vertical_coord_type=None,
 ):
     if vertical_coord_val:
         self.field.vertical_coord = vertical_coord_val
     if vertical_coord_type:
         self.field.vertical_coord_type = vertical_coord_type
     if reference_vertical_coord:
         self.field.reference_vertical_coord = reference_vertical_coord
     if reference_vertical_coord_type:
         self.field.reference_vertical_coord_type = (
             reference_vertical_coord_type)
     vertical_coord(self.cube, self.field)
Esempio n. 5
0
    def test_orography(self):
        # Mock an orography field we've seen.
        field = mock_nimrod_field()
        cube = iris.cube.Cube(np.arange(100).reshape(10, 10))

        field.dt_year = field.dt_month = field.dt_day = field.int_mdi
        field.dt_hour = field.dt_minute = field.int_mdi
        field.proj_biaxial_ellipsoid = 0
        field.tm_meridian_scaling = 0.999601
        field.field_code = 73
        field.vertical_coord_type = 1
        field.title = "(MOCK) 2km mean orography"
        field.units = "metres"
        field.source = "GLOBE DTM"

        nimrod_load_rules.name(cube, field)
        nimrod_load_rules.units(cube, field)
        nimrod_load_rules.reference_time(cube, field)
        nimrod_load_rules.proj_biaxial_ellipsoid(cube, field)
        nimrod_load_rules.tm_meridian_scaling(cube, field)
        nimrod_load_rules.vertical_coord(cube, field)
        nimrod_load_rules.attributes(cube, field)

        self.assertCML(cube, ("nimrod", "mockography.cml"))
Esempio n. 6
0
 def _call_vertical_coord(self, vertical_coord_type):
     self.field.vertical_coord_type = vertical_coord_type
     vertical_coord(self.cube, self.field)
Esempio n. 7
0
 def _call_vertical_coord(self, vertical_coord_type):
     self.field.vertical_coord_type = vertical_coord_type
     vertical_coord(self.cube, self.field)