コード例 #1
0
ファイル: test_convert.py プロジェクト: ghislainp/iris
    def test_grib1_hybrid_height(self):
        gm = gribapi.grib_new_from_samples('regular_gg_ml_grib1')
        gw = GribWrapper(gm)
        results = convert(gw)

        factory, = results[0]
        self.assertEqual(factory.factory_class,
                         iris.aux_factory.HybridPressureFactory)
        delta, sigma, ref = factory.args
        self.assertEqual(delta, {'long_name': 'level_pressure'})
        self.assertEqual(sigma, {'long_name': 'sigma'})
        self.assertEqual(ref, Reference(name='surface_pressure'))

        ml_ref = iris.coords.CoordDefn('model_level_number', None, None,
                                       iris.unit.Unit('1'),
                                       {'positive': 'up'}, None)
        lp_ref = iris.coords.CoordDefn(None, 'level_pressure', None,
                                       iris.unit.Unit('Pa'),
                                       {}, None)
        s_ref = iris.coords.CoordDefn(None, 'sigma', None,
                                      iris.unit.Unit('1'),
                                      {}, None)

        aux_coord_defns = [coord._as_defn() for coord, dim in results[8]]
        self.assertIn(ml_ref, aux_coord_defns)
        self.assertIn(lp_ref, aux_coord_defns)
        self.assertIn(s_ref, aux_coord_defns)
コード例 #2
0
    def test_grib1_hybrid_height(self):
        gm = gribapi.grib_new_from_samples('regular_gg_ml_grib1')
        gw = GribWrapper(gm)
        results = convert(gw)

        factory, = results[0]
        self.assertEqual(factory.factory_class,
                         iris.aux_factory.HybridPressureFactory)
        delta, sigma, ref = factory.args
        self.assertEqual(delta, {'long_name': 'level_pressure'})
        self.assertEqual(sigma, {'long_name': 'sigma'})
        self.assertEqual(ref, Reference(name='surface_pressure'))

        ml_ref = iris.coords.CoordDefn('model_level_number', None, None,
                                       cf_units.Unit('1'), {'positive': 'up'},
                                       None)
        lp_ref = iris.coords.CoordDefn(None, 'level_pressure', None,
                                       cf_units.Unit('Pa'), {}, None)
        s_ref = iris.coords.CoordDefn(None, 'sigma', None, cf_units.Unit('1'),
                                      {}, None)

        aux_coord_defns = [coord._as_defn() for coord, dim in results[8]]
        self.assertIn(ml_ref, aux_coord_defns)
        self.assertIn(lp_ref, aux_coord_defns)
        self.assertIn(s_ref, aux_coord_defns)
コード例 #3
0
ファイル: test_convert.py プロジェクト: Jozhogg/iris
    def test_grib1_hybrid_height(self):
        gm = gribapi.grib_new_from_samples("regular_gg_ml_grib1")
        gw = GribWrapper(gm)
        results = convert(gw)

        factory, = results[0]
        self.assertEqual(factory.factory_class, iris.aux_factory.HybridPressureFactory)
        delta, sigma, ref = factory.args
        self.assertEqual(delta, {"long_name": "level_pressure"})
        self.assertEqual(sigma, {"long_name": "sigma"})
        self.assertEqual(ref, Reference(name="surface_pressure"))

        ml_ref = iris.coords.CoordDefn("model_level_number", None, None, iris.unit.Unit("1"), {"positive": "up"}, None)
        lp_ref = iris.coords.CoordDefn(None, "level_pressure", None, iris.unit.Unit("Pa"), {}, None)
        s_ref = iris.coords.CoordDefn(None, "sigma", None, iris.unit.Unit("1"), {}, None)

        aux_coord_defns = [coord._as_defn() for coord, dim in results[8]]
        self.assertIn(ml_ref, aux_coord_defns)
        self.assertIn(lp_ref, aux_coord_defns)
        self.assertIn(s_ref, aux_coord_defns)