当前位置: 首页>>代码示例>>Python>>正文


Python EarthquakeBuildingFunction.metadata方法代码示例

本文整理汇总了Python中safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction.metadata方法的典型用法代码示例。如果您正苦于以下问题:Python EarthquakeBuildingFunction.metadata方法的具体用法?Python EarthquakeBuildingFunction.metadata怎么用?Python EarthquakeBuildingFunction.metadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction的用法示例。


在下文中一共展示了EarthquakeBuildingFunction.metadata方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_allowed_subcategories

# 需要导入模块: from safe.impact_functions.earthquake.earthquake_building.impact_function import EarthquakeBuildingFunction [as 别名]
# 或者: from safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction import metadata [as 别名]
    def test_allowed_subcategories(self):
        """Test for allowed_subcategories API."""
        impact_function = EarthquakeBuildingFunction()
        result = impact_function.metadata().allowed_subcategories(
            category='hazard')
        expected_result = [hazard_earthquake]
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)

        result = impact_function.metadata().allowed_subcategories(
            category='exposure')
        expected_result = [exposure_structure]
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)

        result = impact_function.metadata().allowed_subcategories()
        expected_result = [exposure_structure, hazard_earthquake]
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)

        impact_function = ContinuousHazardPopulationFunction()
        result = impact_function.metadata().allowed_subcategories(
            category='hazard')
        expected_result = hazard_all
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:28,代码来源:test_impact_function_metadata.py

示例2: test_allowed_units

# 需要导入模块: from safe.impact_functions.earthquake.earthquake_building.impact_function import EarthquakeBuildingFunction [as 别名]
# 或者: from safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction import metadata [as 别名]
    def test_allowed_units(self):
        """Test for allowed_units API."""
        impact_function = EarthquakeBuildingFunction()
        result = impact_function.metadata() .allowed_units(
            'structure', 'polygon')
        expected_result = [unit_building_type_type, unit_building_generic]
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertItemsEqual(result, expected_result, message)

        result = impact_function.metadata() .allowed_units(
            'structure', 'continuous')
        expected_result = []
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)

        impact_function = FloodRasterBuildingFunction
        result = impact_function.metadata().allowed_units(
            'structure', 'polygon')
        expected_result = [unit_building_type_type, unit_building_generic]
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertItemsEqual(result, expected_result, message)

        result = impact_function.metadata()\
            .allowed_units('flood', 'continuous')
        expected_result = [unit_metres_depth, unit_feet_depth]
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:29,代码来源:test_impact_function_metadata.py

示例3: test_exposures_for_layer

# 需要导入模块: from safe.impact_functions.earthquake.earthquake_building.impact_function import EarthquakeBuildingFunction [as 别名]
# 或者: from safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction import metadata [as 别名]
    def test_exposures_for_layer(self):
        """Test exposures_for_layer."""
        impact_function = EarthquakeBuildingFunction()
        exposures = impact_function.metadata().exposures_for_layer('polygon')
        expected = [exposure_structure]
        self.assertItemsEqual(exposures, expected)

        exposures = impact_function.metadata().exposures_for_layer('raster')
        expected = []
        self.assertItemsEqual(exposures, expected)
开发者ID:Mloweedgar,项目名称:inasafe,代码行数:12,代码来源:test_impact_function_metadata.py

示例4: test_inner_class

# 需要导入模块: from safe.impact_functions.earthquake.earthquake_building.impact_function import EarthquakeBuildingFunction [as 别名]
# 或者: from safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction import metadata [as 别名]
 def test_inner_class(self):
     """Test call inner class."""
     impact_function = EarthquakeBuildingFunction()
     # call from an object
     metadata = impact_function.metadata()
     metadata_dictionary = metadata.as_dict()
     assert isinstance(metadata_dictionary, dict), 'I did not got a dict'
     # call from the class
     metadata = impact_function.metadata()
     metadata_dictionary = metadata.as_dict()
     assert isinstance(metadata_dictionary, dict), 'I did not got a dict'
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:13,代码来源:test_impact_function_metadata.py

示例5: test_allowed_data_types

# 需要导入模块: from safe.impact_functions.earthquake.earthquake_building.impact_function import EarthquakeBuildingFunction [as 别名]
# 或者: from safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction import metadata [as 别名]
    def test_allowed_data_types(self):
        """Test for allowed_data_types API."""
        impact_function = EarthquakeBuildingFunction()
        result = impact_function.metadata().allowed_data_types('structure')
        expected_result = ['polygon', 'point']
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertItemsEqual(result, expected_result, message)

        result = impact_function.metadata().allowed_data_types('earthquake')
        expected_result = ['continuous']
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertItemsEqual(result, expected_result, message)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:14,代码来源:test_impact_function_metadata.py

示例6: test_has_exposure

# 需要导入模块: from safe.impact_functions.earthquake.earthquake_building.impact_function import EarthquakeBuildingFunction [as 别名]
# 或者: from safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction import metadata [as 别名]
    def test_has_exposure(self):
        """Test for has_exposure API."""
        impact_function = EarthquakeBuildingFunction()
        result = impact_function.metadata().has_exposure(exposure_structure)
        expected_result = True
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)

        impact_function = FloodRasterBuildingFunction()
        result = impact_function.metadata().has_exposure(exposure_structure)
        expected_result = True
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:15,代码来源:test_impact_function_metadata.py

示例7: test_get_exposures

# 需要导入模块: from safe.impact_functions.earthquake.earthquake_building.impact_function import EarthquakeBuildingFunction [as 别名]
# 或者: from safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction import metadata [as 别名]
    def test_get_exposures(self):
        """Test for get_exposures API."""
        impact_function = EarthquakeBuildingFunction()
        result = impact_function.metadata().get_exposures()
        expected_result = [exposure_structure]
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)

        impact_function = FloodRasterBuildingFunction()
        result = impact_function.metadata().get_exposures()
        expected_result = []
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertNotEqual(result, expected_result, message)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:15,代码来源:test_impact_function_metadata.py

示例8: test_get_hazards

# 需要导入模块: from safe.impact_functions.earthquake.earthquake_building.impact_function import EarthquakeBuildingFunction [as 别名]
# 或者: from safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction import metadata [as 别名]
    def test_get_hazards(self):
        """Test for get_hazards API."""
        impact_function = EarthquakeBuildingFunction()
        result = impact_function.metadata().get_hazards()
        expected_result = [hazard_earthquake]
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)

        impact_function = FloodRasterBuildingFunction()
        result = impact_function.metadata().get_hazards()
        expected_result = [hazard_flood, hazard_tsunami]
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:15,代码来源:test_impact_function_metadata.py

示例9: test_has_hazard_id

# 需要导入模块: from safe.impact_functions.earthquake.earthquake_building.impact_function import EarthquakeBuildingFunction [as 别名]
# 或者: from safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction import metadata [as 别名]
    def test_has_hazard_id(self):
        """Test for has_hazard_id API."""
        impact_function = EarthquakeBuildingFunction()
        result = impact_function.metadata().has_hazard_id(
            hazard_earthquake['id'])
        expected_result = True
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)

        impact_function = FloodRasterBuildingFunction()
        result = impact_function.metadata().has_hazard_id(
            hazard_earthquake['id'])
        expected_result = False
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:17,代码来源:test_impact_function_metadata.py

示例10: test_subcategories_for_layer

# 需要导入模块: from safe.impact_functions.earthquake.earthquake_building.impact_function import EarthquakeBuildingFunction [as 别名]
# 或者: from safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction import metadata [as 别名]
    def test_subcategories_for_layer(self):
        """Test for subcategories_for_layer API."""
        impact_function = EarthquakeBuildingFunction()
        result = impact_function.metadata().subcategories_for_layer(
            category='hazard', layer_type='raster', data_type='continuous')
        expected_result = [hazard_earthquake]
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)

        impact_function = EarthquakeBuildingFunction()
        result = impact_function.metadata().subcategories_for_layer(
            category='exposure', layer_type='vector', data_type='polygon')
        expected_result = [exposure_structure]
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:17,代码来源:test_impact_function_metadata.py

示例11: test_hazards_for_layer

# 需要导入模块: from safe.impact_functions.earthquake.earthquake_building.impact_function import EarthquakeBuildingFunction [as 别名]
# 或者: from safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction import metadata [as 别名]
    def test_hazards_for_layer(self):
        """Test hazards_for_layer"""
        impact_function = EarthquakeBuildingFunction()
        hazards = impact_function.metadata().hazards_for_layer(
            'raster', 'single_event')
        expected = [hazard_earthquake]
        self.assertItemsEqual(hazards, expected)

        hazards = impact_function.metadata().hazards_for_layer('raster',)
        expected = [hazard_earthquake]
        self.assertItemsEqual(hazards, expected)

        hazards = impact_function.metadata().hazards_for_layer(
            'polygon', 'single_event')
        expected = []
        self.assertItemsEqual(hazards, expected)
开发者ID:Mloweedgar,项目名称:inasafe,代码行数:18,代码来源:test_impact_function_metadata.py

示例12: test_purposes_for_layer

# 需要导入模块: from safe.impact_functions.earthquake.earthquake_building.impact_function import EarthquakeBuildingFunction [as 别名]
# 或者: from safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction import metadata [as 别名]
 def test_purposes_for_layer(self):
     """Test for purposes_for_layer."""
     impact_function = EarthquakeBuildingFunction()
     layer_purpose = impact_function.metadata().purposes_for_layer(
         'polygon')
     self.assertIsNotNone(layer_purpose)
     expected_result = [layer_purpose_exposure]
     self.assertItemsEqual(layer_purpose, expected_result)
开发者ID:Mloweedgar,项目名称:inasafe,代码行数:10,代码来源:test_impact_function_metadata.py

示例13: test_hazard_categories_for_layer

# 需要导入模块: from safe.impact_functions.earthquake.earthquake_building.impact_function import EarthquakeBuildingFunction [as 别名]
# 或者: from safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction import metadata [as 别名]
    def test_hazard_categories_for_layer(self):
        """Test for hazard_categories_for_layer"""
        impact_function = EarthquakeBuildingFunction()
        hazard_categories = impact_function.metadata()\
            .hazard_categories_for_layer('raster')
        expected = [
            hazard_category_single_event, hazard_category_multiple_event]
        self.assertItemsEqual(hazard_categories, expected)

        hazard_categories = impact_function.metadata() \
            .hazard_categories_for_layer('raster', 'earthquake')
        expected = [
            hazard_category_single_event, hazard_category_multiple_event]
        self.assertItemsEqual(hazard_categories, expected)

        hazard_categories = impact_function.metadata() \
            .hazard_categories_for_layer('polygon')
        expected = []
        self.assertItemsEqual(hazard_categories, expected)
开发者ID:Mloweedgar,项目名称:inasafe,代码行数:21,代码来源:test_impact_function_metadata.py

示例14: test_allowed_layer_constraints

# 需要导入模块: from safe.impact_functions.earthquake.earthquake_building.impact_function import EarthquakeBuildingFunction [as 别名]
# 或者: from safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction import metadata [as 别名]
    def test_allowed_layer_constraints(self):
        """Test for allowed_layer_constraints API."""
        impact_function = EarthquakeBuildingFunction()
        result = impact_function.metadata().allowed_layer_constraints()
        expected_result = [layer_raster_continuous, layer_vector_polygon,
                           layer_vector_point]
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)

        result = impact_function.metadata().allowed_layer_constraints(
            'hazard')
        expected_result = [layer_raster_continuous]
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)

        result = impact_function.metadata().allowed_layer_constraints(
            'exposure')
        expected_result = [layer_vector_polygon, layer_vector_point]
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:22,代码来源:test_impact_function_metadata.py

示例15: test_units_for_layer

# 需要导入模块: from safe.impact_functions.earthquake.earthquake_building.impact_function import EarthquakeBuildingFunction [as 别名]
# 或者: from safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction import metadata [as 别名]
    def test_units_for_layer(self):
        """Test for units_for_layer API."""
        impact_function = EarthquakeBuildingFunction()
        result = impact_function.metadata().units_for_layer(
            subcategory='earthquake',
            layer_type='raster',
            data_type='continuous')
        expected_result = [unit_mmi]
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)

        result = impact_function.metadata().units_for_layer(
            subcategory='flood', layer_type='raster', data_type='continuous')
        expected_result = []
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)

        result = impact_function.metadata().units_for_layer(
            subcategory='earthquake',
            layer_type='vector',
            data_type='continuous')
        expected_result = []
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)

        result = impact_function.metadata().units_for_layer(
            subcategory='earthquake', layer_type='raster', data_type='polygon')
        expected_result = []
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)

        impact_function = ContinuousHazardPopulationFunction()
        result = impact_function.metadata().units_for_layer(
            subcategory='flood', layer_type='raster', data_type='continuous')
        expected_result = []
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertEqual(result, expected_result, message)
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:39,代码来源:test_impact_function_metadata.py


注:本文中的safe.impact_functions.earthquake.earthquake_building.impact_function.EarthquakeBuildingFunction.metadata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。