def test_filter(self):
        """Test filtering IF from layer keywords"""
        hazard_keywords = {
            'subcategory': 'flood',
            'unit': 'metres_depth',
            'layer_type': 'raster',
            'data_type': 'continuous'
        }

        exposure_keywords = {
            'subcategory': 'population',
            'layer_type': 'raster',
            'data_type': 'continuous'
        }

        impact_functions = ImpactFunctionManager().filter_by_keywords(
            hazard_keywords, exposure_keywords)
        message = 'There should be 1 impact function, but there are: %s' % \
                  len(impact_functions)
        self.assertEqual(1, len(impact_functions), message)

        retrieved_if = impact_functions[0].metadata().as_dict()['id']
        expected = ImpactFunctionManager().get_function_id(
            FloodEvacuationRasterHazardFunction)
        message = 'Expecting %s, but getting %s instead' % (expected,
                                                            retrieved_if)
        self.assertEqual(expected, retrieved_if, message)
    def test_filter(self):
        """TestITBBayesianEarthquakeFatalityFunction: Test filtering IF"""
        hazard_keywords = {
            'layer_purpose': 'hazard',
            'layer_mode': 'continuous',
            'layer_geometry': 'raster',
            'hazard': 'earthquake',
            'hazard_category': 'single_event',
            'continuous_hazard_unit': 'mmi'
        }

        exposure_keywords = {
            'layer_purpose': 'exposure',
            'layer_mode': 'continuous',
            'layer_geometry': 'raster',
            'exposure': 'population',
            'exposure_unit': 'count'
        }
        impact_functions = ImpactFunctionManager().filter_by_keywords(
            hazard_keywords, exposure_keywords)
        message = 'There should be 1 impact function, but there are: %s' % \
                  len(impact_functions)
        self.assertEqual(1, len(impact_functions), message)

        retrieved_if = impact_functions[0].metadata().as_dict()['id']
        expected = ImpactFunctionManager().get_function_id(
            ITBBayesianFatalityFunction)
        message = 'Expecting %s, but getting %s instead' % (expected,
                                                            retrieved_if)
        self.assertEqual(expected, retrieved_if, message)
예제 #3
0
    def test_filter(self):
        """TestVolcanoPolygonPopulationFunction: Test filtering IF"""
        hazard_keywords = {
            'category': 'hazard',
            'subcategory': 'volcano',
            'layer_type': 'vector',
            'data_type': 'polygon'
        }

        exposure_keywords = {
            'category': 'exposure',
            'subcategory': 'population',
            'layer_type': 'raster',
            'data_type': 'continuous',
            'unit': 'people_per_pixel'
        }

        impact_functions = ImpactFunctionManager().filter_by_keywords(
            hazard_keywords, exposure_keywords)
        message = 'There should be 1 impact function, but there are: %s' % \
                  len(impact_functions)
        self.assertEqual(1, len(impact_functions), message)

        retrieved_if = impact_functions[0].metadata().as_dict()['id']
        expected = ImpactFunctionManager().get_function_id(
            VolcanoPolygonPopulationFunction)
        message = 'Expecting %s, but getting %s instead' % (expected,
                                                            retrieved_if)
        self.assertEqual(expected, retrieved_if, message)
예제 #4
0
    def test_filter(self):
        """Test filtering IF from layer keywords"""
        hazard_keywords = {
            'subcategory': 'flood',
            'unit': 'wetdry',
            'layer_type': 'vector',
            'data_type': 'polygon'
        }

        exposure_keywords = {
            'subcategory': 'road',
            'units': 'road_type',
            'layer_type': 'vector',
            'data_type': 'line'
        }

        impact_functions = ImpactFunctionManager().filter_by_keywords(
            hazard_keywords, exposure_keywords)
        message = 'There should be 1 impact function, but there are: %s' % \
                  len(impact_functions)
        self.assertEqual(1, len(impact_functions), message)

        retrieved_if = impact_functions[0].metadata().as_dict()['id']
        expected = ImpactFunctionManager().get_function_id(
            FloodVectorRoadsExperimentalFunction)
        message = 'Expecting %s, but getting %s instead' % (expected,
                                                            retrieved_if)
        self.assertEqual(expected, retrieved_if, message)
    def test_filter(self):
        """TestVolcanoPolygonBuildingFunction: Test filtering IF"""
        hazard_keywords = {
            'title': 'merapi',
            'layer_purpose': 'hazard',
            'layer_mode': 'classified',
            'layer_geometry': 'polygon',
            'hazard': 'volcano',
            'hazard_category': 'multiple_event',
            'vector_hazard_classification': 'volcano_vector_hazard_classes'
        }

        exposure_keywords = {
            'layer_purpose': 'exposure',
            'layer_mode': 'classified',
            'layer_geometry': 'polygon',
            'exposure': 'structure'
        }

        impact_functions = ImpactFunctionManager().filter_by_keywords(
            hazard_keywords, exposure_keywords)
        message = 'There should be 1 impact function, but there are: %s' % \
                  len(impact_functions)
        self.assertEqual(1, len(impact_functions), message)

        retrieved_if = impact_functions[0].metadata().as_dict()['id']
        expected = ImpactFunctionManager().get_function_id(
            VolcanoPolygonBuildingFunction)
        message = 'Expecting %s, but getting %s instead' % (
            expected, retrieved_if)
        self.assertEqual(expected, retrieved_if, message)
예제 #6
0
    def test_filter(self):
        """TestClassifiedPolygonPopulationFunction: Test filtering IF"""
        hazard_keywords = {
            'layer_purpose': 'hazard',
            'layer_mode': 'classified',
            'layer_geometry': 'polygon',
            'hazard': 'flood',
            'hazard_category': 'multiple_event',
            'vector_hazard_classification': 'generic_vector_hazard_classes'
        }

        exposure_keywords = {
            'layer_purpose': 'exposure',
            'layer_mode': 'continuous',
            'layer_geometry': 'raster',
            'exposure': 'population',
            'exposure_unit': 'count'
        }

        impact_functions = ImpactFunctionManager().filter_by_keywords(
            hazard_keywords, exposure_keywords)
        message = 'There should be 1 impact function, but there are: %s' % \
                  len(impact_functions)
        self.assertEqual(1, len(impact_functions), message)

        retrieved_if = impact_functions[0].metadata().as_dict()['id']
        expected = ImpactFunctionManager().get_function_id(
            ClassifiedPolygonHazardPopulationFunction)
        message = 'Expecting %s, but getting %s instead' % (expected,
                                                            retrieved_if)
        self.assertEqual(expected, retrieved_if, message)
예제 #7
0
    def test_filter(self):
        """Test filtering IF from layer keywords"""
        hazard_keywords = {
            'subcategory': 'flood',
            'unit': 'classes',
            'layer_type': 'raster',
            'data_type': 'classified'
        }

        exposure_keywords = {
            'subcategory': 'structure',
            'layer_type': 'vector',
            'data_type': 'polygon'
        }

        impact_functions = ImpactFunctionManager().filter_by_keywords(
            hazard_keywords, exposure_keywords)
        message = 'There should be 1 impact function, but there are: %s' % \
                  len(impact_functions)
        self.assertEqual(1, len(impact_functions), message)

        retrieved_if = impact_functions[0].metadata().as_dict()['id']
        expected = ImpactFunctionManager().get_function_id(
            ClassifiedRasterHazardBuildingFunction)
        message = 'Expecting %s, but getting %s instead' % (expected,
                                                            retrieved_if)
        self.assertEqual(expected, retrieved_if, message)
    def test_filter(self):
        """TestVolcanoPointBuildingFunction: Test filtering IF"""
        hazard_keywords = {
            'title': 'merapi',
            'category': 'hazard',
            'subcategory': 'volcano',
            'layer_type': 'vector',
            'data_type': 'point'
        }

        exposure_keywords = {
            'category': 'exposure',
            'subcategory': 'structure',
            'layer_type': 'vector',
            'data_type': 'polygon'
        }

        impact_functions = ImpactFunctionManager().filter_by_keywords(
            hazard_keywords, exposure_keywords)
        message = 'There should be 1 impact function, but there are: %s' % \
                  len(impact_functions)
        self.assertEqual(1, len(impact_functions), message)

        retrieved_if = impact_functions[0].metadata().as_dict()['id']
        expected = ImpactFunctionManager().get_function_id(
            VolcanoPointBuildingFunction)
        message = 'Expecting %s, but getting %s instead' % (expected,
                                                            retrieved_if)
        self.assertEqual(expected, retrieved_if, message)
    def test_filter(self):
        """Test filtering IF from layer keywords"""
        hazard_keywords = {
            'layer_purpose': 'hazard',
            'layer_mode': 'continuous',
            'layer_geometry': 'raster',
            'hazard': 'flood',
            'hazard_category': 'single_event',
            'continuous_hazard_unit': 'metres'
        }

        exposure_keywords = {
            'layer_purpose': 'exposure',
            'layer_mode': 'classified',
            'layer_geometry': 'line',
            'exposure': 'road'
        }

        impact_functions = ImpactFunctionManager().filter_by_keywords(
            hazard_keywords, exposure_keywords)
        message = 'There should be 1 impact function, but there are: %s' % \
                  len(impact_functions)
        self.assertEqual(1, len(impact_functions), message)

        retrieved_if = impact_functions[0].metadata().as_dict()['id']
        expected = ImpactFunctionManager().get_function_id(
            FloodRasterRoadsFunction)
        message = 'Expecting %s, but getting %s instead' % (expected,
                                                            retrieved_if)
        self.assertEqual(expected, retrieved_if, message)
예제 #10
0
    def test_filter(self):
        hazard_keywords = {
            'layer_purpose': 'hazard',
            'layer_mode': 'continuous',
            'layer_geometry': 'raster',
            'hazard': 'tsunami',
            'hazard_category': 'single_event',
            'continuous_hazard_unit': 'metres'
        }

        exposure_keywords = {
            'layer_purpose': 'exposure',
            'layer_mode': 'classified',
            'layer_geometry': 'polygon',
            'exposure': 'structure'
        }

        impact_functions = ImpactFunctionManager().filter_by_keywords(
            hazard_keywords, exposure_keywords)
        message = 'There should be 1 impact function, but there are: %s' % \
                  len(impact_functions)
        self.assertEqual(1, len(impact_functions), message)

        retrieved_if = impact_functions[0].metadata().as_dict()['id']
        expected = ImpactFunctionManager().get_function_id(
            TsunamiRasterBuildingFunction)
        message = 'Expecting %s, but getting %s instead' % (
            expected, retrieved_if)
        self.assertEqual(expected, retrieved_if, message)
예제 #11
0
    def test_functions_for_constraint(self):
        """Test functions_for_constraint."""
        ifm = ImpactFunctionManager()
        impact_functions = ifm.functions_for_constraint(
            'earthquake',
            'population',
            'raster',
            'raster',
            'continuous',
            'continuous',
        )
        expected = [
            ITBFatalityFunction.metadata().as_dict(),
            ITBBayesianFatalityFunction.metadata().as_dict(),
            PAGFatalityFunction.metadata().as_dict(),
            ContinuousHazardPopulationFunction.metadata().as_dict()
        ]

        for key in impact_functions[0].keys():
            if key == 'parameters':
                # We do not check the parameters since they are mutable.
                continue
            result = [x[key] for x in impact_functions]
            hope = [x[key] for x in expected]
            message = key
            self.assertItemsEqual(result, hope, message)
예제 #12
0
 def test_exposure_units_for_layer(self):
     """Test for exposure_units_for_layer"""
     impact_function_manager = ImpactFunctionManager()
     exposure_units = impact_function_manager.exposure_units_for_layer(
         'population', 'raster', 'continuous')
     expected = [count_exposure_unit, density_exposure_unit]
     self.assertItemsEqual(exposure_units, expected)
예제 #13
0
    def test_keywords(self):
        """Test filtering IF from layer keywords"""

        exposure_keywords = {
            'layer_purpose': 'exposure',
            'layer_mode': 'classified',
            'layer_geometry': 'point',
            'exposure': 'place',
            'exposure_unit': 'count'
        }

        hazard_keywords = {
            'layer_purpose': 'hazard',
            'layer_mode': 'continuous',
            'layer_geometry': 'raster',
            'hazard': 'volcanic_ash',
            'hazard_category': 'single_event',
            'continuous_hazard_unit': 'centimetres'
        }

        impact_functions = ImpactFunctionManager().filter_by_keywords(
            hazard_keywords, exposure_keywords)
        message = 'There should be 1 impact function, but there are: %s' % \
                  len(impact_functions)
        self.assertEqual(1, len(impact_functions), message)
예제 #14
0
def register_impact_functions():
    """Register all the impact functions available."""
    impact_function_registry = ImpactFunctionManager().registry
    # Inundation IF's
    impact_function_registry.register(FloodPolygonBuildingFunction)
    impact_function_registry.register(FloodPolygonRoadsFunction)
    impact_function_registry.register(FloodEvacuationVectorHazardFunction)
    impact_function_registry.register(FloodEvacuationRasterHazardFunction)
    impact_function_registry.register(FloodRasterBuildingFunction)
    impact_function_registry.register(FloodRasterRoadsFunction)
    impact_function_registry.register(TsunamiEvacuationFunction)
    # Generic IF's
    impact_function_registry.register(ClassifiedRasterHazardBuildingFunction)
    impact_function_registry.register(ClassifiedRasterHazardPopulationFunction)
    impact_function_registry.register(ContinuousHazardPopulationFunction)
    impact_function_registry.register(
        ClassifiedPolygonHazardPopulationFunction)
    impact_function_registry.register(ClassifiedPolygonHazardBuildingFunction)
    # Earthquake
    impact_function_registry.register(EarthquakeBuildingFunction)
    impact_function_registry.register(ITBFatalityFunction)
    impact_function_registry.register(PAGFatalityFunction)
    # Volcanic IF's
    impact_function_registry.register(VolcanoPointBuildingFunction)
    impact_function_registry.register(VolcanoPolygonBuildingFunction)
    impact_function_registry.register(VolcanoPointPopulationFunction)
    impact_function_registry.register(VolcanoPolygonPopulationFunction)
예제 #15
0
    def test_allowed_data_types(self):
        """Test allowed_data_types API."""
        impact_function_manager = ImpactFunctionManager()
        result = impact_function_manager.allowed_data_types('flood')
        expected_result = ['polygon', 'continuous', 'classified']
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertItemsEqual(result, expected_result, message)

        result = impact_function_manager.allowed_data_types('volcano')
        expected_result = ['point', 'polygon', 'continuous', 'classified']
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertItemsEqual(result, expected_result, message)

        result = impact_function_manager.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_manager.allowed_data_types('earthquake')
        expected_result = ['continuous', 'classified']
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertItemsEqual(result, expected_result, message)

        result = impact_function_manager.allowed_data_types('tsunami')
        expected_result = ['polygon', 'continuous', 'classified']
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertItemsEqual(result, expected_result, message)

        result = impact_function_manager.allowed_data_types('population')
        expected_result = ['continuous']
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertItemsEqual(result, expected_result, message)
예제 #16
0
    def test_keywords(self):
        """TestClassifiedPolygonPeopleFunction: Test keywords IF"""

        exposure_keywords = {
            'layer_purpose': 'exposure',
            'layer_mode': 'continuous',
            'layer_geometry': 'polygon',
            'exposure': 'population',
            'structure_class_field': '',
            'exposure_unit': 'count'
        }

        hazard_keywords = {
            'layer_purpose': 'hazard',
            'layer_mode': 'classified',
            'layer_geometry': 'polygon',
            'hazard': 'generic',
            'hazard_category': 'multiple_event',
            'field': 'h_zone',
            'vector_hazard_classification': 'generic_vector_hazard_classes',
        }

        impact_functions = ImpactFunctionManager().filter_by_keywords(
            hazard_keywords, exposure_keywords)
        message = 'There should be 1 impact function, but there are: %s' % \
                  len(impact_functions)
        self.assertEqual(1, len(impact_functions), message)
예제 #17
0
    def __init__(self):
        super(TsunamiEvacuationFunction, self).__init__()
        self.impact_function_manager = ImpactFunctionManager()

        # AG: Use the proper minimum needs, update the parameters
        self.parameters = add_needs_parameters(self.parameters)
        self.no_data_warning = False
    def test_keywords(self):

        exposure_keywords = {
            'layer_purpose': 'exposure',
            'layer_mode': 'classified',
            'layer_geometry': 'polygon',
            'exposure': 'land_cover',
            'field': 'FCODE',
        }

        hazard_keywords = {
            'layer_purpose': 'hazard',
            'layer_mode': 'classified',
            'layer_geometry': 'polygon',
            'hazard': 'generic',
            'hazard_category': 'multiple_event',
            'field': 'level',
            'vector_hazard_classification': 'generic_vector_hazard_classes',
        }

        impact_functions = ImpactFunctionManager().filter_by_keywords(
            hazard_keywords, exposure_keywords)
        message = 'There should be 1 impact function, but there are: %s' % \
                  len(impact_functions)
        self.assertEqual(1, len(impact_functions), message)
예제 #19
0
    def test_hazards_for_layer(self):
        """Test for hazards_for_layer"""
        impact_function_manager = ImpactFunctionManager()
        hazards = impact_function_manager.hazards_for_layer(
            'polygon', 'single_event')
        # print [x['key'] for x in hazards]
        expected = [
            hazard_flood,
            hazard_tsunami,
            hazard_earthquake,
            hazard_volcano,
            hazard_volcanic_ash,
            hazard_generic
        ]
        self.assertItemsEqual(hazards, expected)

        hazards = impact_function_manager.hazards_for_layer('polygon')
        expected = [hazard_flood, hazard_tsunami, hazard_earthquake,
                    hazard_volcano, hazard_volcanic_ash, hazard_generic]
        self.assertItemsEqual(hazards, expected)

        hazards = impact_function_manager.hazards_for_layer(
            'point', 'single_event')
        expected = [hazard_volcano]
        self.assertItemsEqual(hazards, expected)
예제 #20
0
    def __init__(self):
        super(ClassifiedRasterHazardPopulationFunction, self).__init__()
        self.impact_function_manager = ImpactFunctionManager()

        # AG: Use the proper minimum needs, update the parameters
        self.parameters = add_needs_parameters(self.parameters)
        self.no_data_warning = False
예제 #21
0
 def test_available_exposure_constraints(self):
     """Test for available_exposure_constraints."""
     ifm = ImpactFunctionManager()
     exposure_constraints = ifm.available_exposure_constraints('population')
     expected = [(layer_mode_continuous, layer_geometry_raster),
                 (layer_mode_continuous, layer_geometry_polygon)]
     self.assertItemsEqual(exposure_constraints, expected)
예제 #22
0
    def __init__(self, parent):
        """Constructor for the class.

        :param parent: Parent widget i.e. the wizard dialog.
        :type parent: QWidget
        """

        QtCore.QObject.__init__(self)
        self.parent = parent
        # Do not delete this
        self.iface = parent.iface
        self.keyword_io = KeywordIO()
        self.impact_function_manager = ImpactFunctionManager()
        self.extent = Extent(self.iface)
        self.analysis = None
        self.composer = None

        # Values for settings these get set in read_settings.
        self.run_in_thread_flag = None
        self.zoom_to_impact_flag = None
        self.hide_exposure_flag = None
        self.clip_hard = None
        self.show_intermediate_layers = None
        self.show_rubber_bands = False

        self.last_analysis_rubberband = None
        # This is a rubber band to show what the AOI of the
        # next analysis will be. Also added in 2.1.0
        self.next_analysis_rubberband = None

        self.read_settings()
예제 #23
0
    def test_get_functions_for_constraint(self):
        """Test get_functions_for_constraint."""
        impact_function_manager = ImpactFunctionManager()
        hazard = hazard_earthquake
        exposure = exposure_structure

        expected_result = [
            EarthquakeBuildingImpactFunction.Metadata.get_metadata(),
            ClassifiedHazardBuildingImpactFunction.Metadata.get_metadata()
        ]
        result = impact_function_manager.get_functions_for_constraint(
            hazard, exposure)
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertItemsEqual(expected_result, result, message)

        hazard_constraint = layer_raster_continuous
        exposure_constraint = None

        expected_result = [
            EarthquakeBuildingImpactFunction.Metadata.get_metadata()
        ]
        result = impact_function_manager.get_functions_for_constraint(
            hazard, exposure, hazard_constraint, exposure_constraint)
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertItemsEqual(expected_result, result, message)

        hazard_constraint = layer_vector_polygon
        exposure_constraint = layer_vector_line

        expected_result = []
        result = impact_function_manager.get_functions_for_constraint(
            hazard, exposure, hazard_constraint, exposure_constraint)
        message = ('I expect %s but I got %s.' % (expected_result, result))
        self.assertItemsEqual(expected_result, result, message)
예제 #24
0
    def test_hazard_categories_for_layer(self):
        """Test for hazard_categories_for_layer"""
        impact_function_manager = ImpactFunctionManager()
        hazard_categories = impact_function_manager.\
            hazard_categories_for_layer('polygon')
        expected = [
            hazard_category_single_event, hazard_category_multiple_event
        ]
        self.assertItemsEqual(hazard_categories, expected)

        hazard_categories = impact_function_manager.\
            hazard_categories_for_layer('line')
        expected = []
        self.assertItemsEqual(hazard_categories, expected)

        hazard_categories = impact_function_manager.\
            hazard_categories_for_layer('point')
        expected = [
            hazard_category_multiple_event, hazard_category_single_event
        ]
        self.assertItemsEqual(hazard_categories, expected)

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

        hazard_categories = impact_function_manager. \
            hazard_categories_for_layer('raster', 'earthquake')
        expected = [
            hazard_category_single_event, hazard_category_multiple_event
        ]
        self.assertItemsEqual(hazard_categories, expected)
예제 #25
0
    def calculate_impact(self):
        if_manager = ImpactFunctionManager()
        function_id = self.function_id
        impact_function = if_manager.get_instance(function_id)

        impact_function.hazard = SafeLayer(self.hazard_layer)
        impact_function.exposure = SafeLayer(self.exposure_layer)

        try:
            self.impact_layer = safe_calculate_impact(impact_function)
            self.set_style()
        except ZeroImpactException as e:
            # in case zero impact, just return
            LOGGER.info('No impact detected')
            LOGGER.info(e.message)
            return

        # copy results of impact to report_path directory
        base_name, _ = os.path.splitext(self.impact_layer.filename)
        dir_name = os.path.dirname(self.impact_layer.filename)
        for (root, dirs, files) in os.walk(dir_name):
            for f in files:
                source_filename = os.path.join(root, f)
                if source_filename.find(base_name) >= 0:
                    extensions = source_filename.replace(base_name, '')
                    new_path = os.path.join(self.report_path,
                                            'impact' + extensions)
                    shutil.copy(source_filename, new_path)

        self.impact_layer = read_layer(self.impact_path)
예제 #26
0
    def __init__(self):
        """Constructor."""
        super(FloodEvacuationRasterHazardFunction, self).__init__()
        self.target_field = 'population'
        self.impact_function_manager = ImpactFunctionManager()

        # AG: Use the proper minimum needs, update the parameters
        self.parameters = add_needs_parameters(self.parameters)
예제 #27
0
    def test_available_hazard_layer_modes(self):
        """Test for available_hazard_layer_modes."""
        ifm = ImpactFunctionManager()
        hazard_layer_mode = ifm.available_hazard_layer_modes(
            'earthquake', 'raster', 'single_event')
        expected = [layer_mode_continuous, layer_mode_classified]

        self.assertItemsEqual(hazard_layer_mode, expected)
예제 #28
0
 def test_get_function_title(self):
     """TestImpactFunctionManager: Test getting function title."""
     impact_function_title = ImpactFunctionManager().get_function_title(
         FloodPolygonBuildingFunction)
     expected_title = 'Be flooded'
     message = 'Expecting %s but got %s' % (impact_function_title,
                                            expected_title)
     self.assertEqual(impact_function_title, expected_title, message)
예제 #29
0
    def test_available_exposure_layer_modes(self):
        """Test for available_exposure_layer_modes."""
        ifm = ImpactFunctionManager()
        exposure_layer_mode = ifm.available_exposure_layer_modes(
            'population', 'raster')
        expected = [layer_mode_continuous]

        self.assertItemsEqual(exposure_layer_mode, expected)
예제 #30
0
    def __init__(self):
        super(ContinuousHazardPopulationFunction, self).__init__()
        PopulationExposureReportMixin.__init__(self)
        self.impact_function_manager = ImpactFunctionManager()

        # AG: Use the proper minimum needs, update the parameters
        self.parameters = add_needs_parameters(self.parameters)
        self.no_data_warning = False