def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id': 'PAGFatalityFunction.',
                'name': tr('PAG Fatality Function.'),
                'impact': tr('Die or be displaced according Pager model'),
                'author': 'Helen Crowley',
                'date_implemented': 'N/A',
                'overview': tr(
                    'To assess the impact of earthquake on population based '
                    'on Population Vulnerability Model Pager'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': hazard_earthquake,
                        'units': [unit_mmi],
                        'layer_constraints': [layer_raster_numeric]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_population,
                        'units': [unit_people_per_pixel],
                        'layer_constraints': [layer_raster_numeric]
                    }
                }
            }
            return dict_meta
    def _calculate_total(self):
        """Indicator that shows total population.

        this indicator reports the total population

        Args:
            None
        Returns:
            None
        Raises:
            None
        """

        myName = tr('Total')
        if self.target_field is not None:
            myName = '%s %s' % (myName, tr(self.target_field).lower())

        #FIXME (MB) Shameless hack to deal with issue #368
        if self.impact_total > 8000000000 or self.impact_total < 0:
            self._append_result(myName, self.NO_DATA_TEXT)
            return

        myResult = self.impact_total
        try:
            myResult = int(round(myResult))
        except ValueError:
            myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult)
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id': 'FloodEvacuationFunctionVectorHazard',
                'name': tr('Flood Evacuation Function Vector Hazard'),
                'impact': tr('Need evacuation'),
                'author': 'AIFDR',
                'date_implemented': 'N/A',
                'overview': tr(
                    'To assess the impacts of flood inundation '
                    'in vector format on population.'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': [hazard_flood],
                        'units': unit_wetdry,
                        'layer_constraints': [layer_vector_polygon]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_population,
                        'units': [unit_people_per_pixel],
                        'layer_constraints': [layer_raster_numeric]
                    }
                }
            }
            return dict_meta
    def _calculate_type(self, title, types):
        """Indicator that shows total population.

        this indicator reports the total population

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        myName = tr(title)
        if self.target_field is not None:
            myName = '%s %s' % (myName, tr(self.target_field).lower())

        myResult = 0
        if self.type_field is not None:
            try:
                for building in self.impact_attrs:
                    if building[self.type_field] in types:
                        myResult += building[self.target_field]

                myResult = int(round(myResult))
            except (ValueError, KeyError):
                myResult = self.NO_DATA_TEXT
        else:
            if self.noFeatures:
                myResult = 0
            else:
                myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult)
Пример #5
0
    def _calculate_total(self):
        """Indicator that shows total population.

        this indicator reports the total population

        Args:
            None
        Returns:
            None
        Raises:
            None
        """

        myName = tr('Total')
        if self.target_field is not None:
            myName = '%s %s' % (myName, tr(self.target_field).lower())

        #FIXME (MB) Shameless hack to deal with issue #368
        if self.impact_total > 8000000000 or self.impact_total < 0:
            self._append_result(myName, self.NO_DATA_TEXT)
            return

        myResult = self.impact_total
        try:
            myResult = int(round(myResult))
        except ValueError:
            myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult)
Пример #6
0
    def _calculate_type(self, title, types):
        """Indicator that shows total population.

        this indicator reports the total population

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        myName = tr(title)
        if self.target_field is not None:
            myName = '%s %s' % (myName, tr(self.target_field).lower())

        myResult = 0
        if self.type_field is not None:
            try:
                for building in self.impact_attrs:
                    if building[self.type_field] in types:
                        myResult += building[self.target_field]

                myResult = int(round(myResult))
            except (ValueError, KeyError):
                myResult = self.NO_DATA_TEXT
        else:
            if self.noFeatures:
                myResult = 0
            else:
                myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult)
Пример #7
0
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id': 'FloodNativePolygonExperimentalFunction',
                'name': tr('Flood Native Polygon Experimental Function'),
                'impact': tr('Be-flooded'),
                'author': 'Dmitry Kolesov',
                'date_implemented': 'N/A',
                'overview': tr('N/A'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': [hazard_flood],
                        'units': unit_wetdry,
                        'layer_constraints': [layer_vector_polygon]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_structure,
                        'units': [unit_building_type_type],
                        'layer_constraints': [layer_vector_polygon]
                    }
                }
            }
            return dict_meta
Пример #8
0
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'disabled': True,
                'id': 'FloodRasterRoadsExperimentalFunction',
                'name': tr('Flood Raster Roads Experimental Function'),
                'impact': tr('Be flooded in given thresholds'),
                'author': 'Dmitry Kolesov',
                'date_implemented': 'N/A',
                'overview': tr('N/A'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': [hazard_flood, hazard_tsunami],
                        'units': [unit_metres_depth, unit_feet_depth],
                        'layer_constraints': [layer_raster_numeric]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_road,
                        'units': [unit_road_type_type],
                        'layer_constraints': [layer_vector_line]
                    }
                }
            }
            return dict_meta
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id': 'CategorisedHazardPopulationImpactFunction',
                'name': tr('Categorised Hazard Population Impact Function'),
                'impact': tr('Be impacted'),
                'author': 'AIFDR',
                'date_implemented': 'N/A',
                'overview': tr(
                    'To assess the impacts of categorized hazards in raster '
                    'format on population raster layer.'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': hazard_all,
                        'units': [unit_normalised],
                        'layer_constraints': [layer_raster_numeric]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_population,
                        'units': [unit_people_per_pixel],
                        'layer_constraints': [layer_raster_numeric]
                    }
                }
            }
            return dict_meta
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id': 'FloodNativePolygonExperimentalFunction',
                'name': tr('Flood Native Polygon Experimental Function'),
                'impact': tr('Be-flooded'),
                'author': 'Dmitry Kolesov',
                'date_implemented': 'N/A',
                'overview': tr('N/A'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': [hazard_flood],
                        'units': unit_wetdry,
                        'layer_constraints': [layer_vector_polygon]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_structure,
                        'units': [unit_building_type_type],
                        'layer_constraints': [layer_vector_polygon]
                    }
                }
            }
            return dict_meta
        def get_metadata():
            """Return metadata as a dictionary

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id': 'ITBFatalityFunction',
                'name': tr('ITB Fatality Function'),
                'impact': tr('Die or be displaced'),
                'author': 'Hadi Ghasemi',
                'date_implemented': 'N/A',
                'overview': tr(
                    'To assess the impact of earthquake on population based '
                    'on earthquake model developed by ITB'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': hazard_earthquake,
                        'units': [unit_mmi],
                        'layer_constraints': [layer_raster_numeric]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_population,
                        'units': [unit_people_per_pixel],
                        'layer_constraints': [layer_raster_numeric]
                    }
                }
            }
            return dict_meta
Пример #12
0
def evacuated_population_weekly_needs(population,
                                      minimum_needs=False,
                                      human_names=False):
    """Calculate estimated needs using BNPB Perka 7/2008 minimum bantuan.


    :param population: The number of evacuated population.
    :type: int, float

    :param minimum_needs: Ratios to use when calculating minimum needs.
        Defaults to perka 7 as described in assumptions below.
    :type minimum_needs: dict

    :returns: The weekly needs for the evacuated population.
    :rtype: dict

    Assumptions:
    * 400g rice per person per day
    * 2.5L drinking water per person per day
    * 15L clean water per person per day
    * assume 5 people per family (not in perka - 0.2 people per family)
    * 20 people per toilet (0.05 per person)
    """
    rice = tr('Rice')
    drinking_water = tr('Drinking Water')
    water = tr('Water')
    family_kits = tr('Family Kits')
    toilets = tr('Toilets')
    if not minimum_needs:
        minimum_needs = default_minimum_needs()

    min_rice = minimum_needs[rice]
    min_drinking_water = minimum_needs[drinking_water]
    min_water = minimum_needs[water]
    min_family_kits = minimum_needs[family_kits]
    min_toilets = minimum_needs[toilets]

    val_rice = int(ceil(population * min_rice))
    val_drinking_water = int(ceil(population * min_drinking_water))
    val_water = int(ceil(population * min_water))
    val_family_kits = int(ceil(population * min_family_kits))
    val_toilets = int(ceil(population * min_toilets))

    if human_names:
        weekly_needs = {
            rice: val_rice,
            drinking_water: val_drinking_water,
            water: val_water,
            family_kits: val_family_kits,
            toilets: val_toilets}
    else:
        weekly_needs = {
            'rice': val_rice,
            'drinking_water': val_drinking_water,
            'water': val_water,
            'family_kits': val_family_kits,
            'toilets': val_toilets}

    return weekly_needs
Пример #13
0
def default_minimum_needs():
    """Helper to get the default minimum needs.

    .. note:: Key names will be translated.
    """
    rice = tr('Rice')
    drinking_water = tr('Drinking Water')
    water = tr('Water')
    family_kits = tr('Family Kits')
    toilets = tr('Toilets')
    minimum_needs = OrderedDict([(rice, 2.8), (drinking_water, 17.5),
                                 (water, 105), (family_kits, 0.2),
                                 (toilets, 0.05)])
    return minimum_needs
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id':
                'FloodBuildingImpactFunction',
                'name':
                tr('Flood Building Impact Function'),
                'impact':
                tr('Be flooded'),
                'author': ['Ole Nielsen', 'Kristy van Putten'],
                'date_implemented':
                'N/A',
                'overview':
                tr('To assess the impacts of (flood or tsunami) inundation '
                   'on building footprints originating from OpenStreetMap '
                   '(OSM).'),
                'categories': {
                    'hazard': {
                        'definition':
                        hazard_definition,
                        'subcategory': [hazard_flood, hazard_tsunami],
                        'units':
                        [unit_wetdry, unit_metres_depth, unit_feet_depth],
                        'layer_constraints': [
                            layer_vector_polygon,
                            layer_raster_numeric,
                        ]
                    },
                    'exposure': {
                        'definition':
                        exposure_definition,
                        'subcategory':
                        exposure_structure,
                        'units':
                        [unit_building_type_type, unit_building_generic],
                        'layer_constraints':
                        [layer_vector_polygon, layer_vector_point]
                    }
                }
            }
            return dict_meta
Пример #15
0
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id': 'FloodBuildingImpactFunction',
                'name': tr('Flood Building Impact Function'),
                'impact': tr('Be flooded'),
                'author': ['Ole Nielsen', 'Kristy van Putten'],
                'date_implemented': 'N/A',
                'overview': tr(
                    'To assess the impacts of (flood or tsunami) inundation '
                    'on building footprints originating from OpenStreetMap '
                    '(OSM).'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': [
                            hazard_flood,
                            hazard_tsunami
                        ],
                        'units': [
                            unit_wetdry,
                            unit_metres_depth,
                            unit_feet_depth],
                        'layer_constraints': [
                            layer_vector_polygon,
                            layer_raster_numeric,
                        ]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_structure,
                        'units': [
                            unit_building_type_type,
                            unit_building_generic],
                        'layer_constraints': [
                            layer_vector_polygon,
                            layer_vector_point]
                    }
                }
            }
            return dict_meta
Пример #16
0
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id':
                'EarthQuakeBuildingImpactFunction',
                'name':
                tr('Earthquake Building Impact Function'),
                'impact':
                tr('Be affected'),
                'author':
                'N/A',
                'date_implemented':
                'N/A',
                'overview':
                tr('This impact function will calculate the impact of an '
                   'earthquake on buildings, reporting how many are expected '
                   'to be damaged etc.'),
                'categories': {
                    'hazard': {
                        'definition':
                        hazard_definition,
                        'subcategory':
                        hazard_earthquake,
                        'units': [unit_mmi],
                        'layer_constraints':
                        [layer_vector_polygon, layer_raster_numeric]
                    },
                    'exposure': {
                        'definition':
                        exposure_definition,
                        'subcategory':
                        exposure_structure,
                        'units':
                        [unit_building_type_type, unit_building_generic],
                        'layer_constraints':
                        [layer_vector_polygon, layer_vector_point]
                    }
                }
            }
            return dict_meta
Пример #17
0
    def _calculate_weekly_increased_calories(self):
        """Weekly additional kg of rice for pregnant and lactating women
        indicator.

        This indicator reports the weekly additional kg of rice for pregnant
        and lactating women.
        for further detail refer to the "Sample InaSAFE Actions for Vulnerable
        Populations" [27.07.2012] paper

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        name = tr('Additional weekly rice kg for pregnant and lactating women')
        meta = {
            'description':
            'Additional rice kg per week for pregnant and '
            'lactating women'
        }

        # weekly Kg rice =
        # affected pop * fem_ratio * 0.7937 * week / intended day-of-use
        lact_kg = self.impact_total * self.female_ratio * 2 * 0.033782
        preg_kg = self.impact_total * self.female_ratio * 2 * 0.01281
        result = lact_kg + preg_kg
        try:
            result = int(round(result))
        except ValueError:
            result = self.NO_DATA_TEXT
        self._append_result(name, result, meta)
Пример #18
0
    def _calculate_weekly_hygene_packs(self):
        """Weekly requirements of female hygiene packs indicator.

        This indicator reports the weekly requirements of female hygiene packs
        for further detail refer to the "Sample InaSAFE Actions for Vulnerable
        Populations" [27.07.2012] paper

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        name = tr('Weekly hygiene packs')
        meta = {'description': 'Females hygiene packs for weekly use'}

        # weekly hygene packs =
        # affected pop * fem_ratio * 0.7937 * week / intended day-of-use
        result = self.impact_total * self.female_ratio * 0.7937 * (7 / 7)
        try:
            result = int(round(result))
        except ValueError:
            result = self.NO_DATA_TEXT
        self._append_result(name, result, meta)
Пример #19
0
    def _calculate_adult(self):
        """Indicator that shows population between 15 and 64 years old.

        this indicator reports the amount of young population according to the
        set adult_ratio

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        myName = tr('Adult count')

        #FIXME (MB) Shameless hack to deal with issue #368
        if self.population_total > 8000000000 or self.population_total < 0:
            self._append_result(myName, self.NO_DATA_TEXT)
            return

        myResult = self.population_total * self.adult_ratio
        try:
            myResult = int(round(myResult))
        except ValueError:
            myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult)
    def _calculate_total(self):
        """Indicator that shows total population.

        This indicator reports the total population.
        """

        name = tr('Total')
        if self.target_field is not None:
            name = '%s %s' % (name, tr(self.target_field).lower())

        result = self.impact_total
        try:
            result = int(round(result))
        except ValueError:
            result = self.NO_DATA_TEXT
        self._append_result(name, result)
    def description(self):
        """Describe briefly what the post processor does.

        :returns: The translated description.
        :rtype: str
        """
        return tr('Calculates building types related statistics.')
Пример #22
0
    def _calculate_weekly_hygene_packs(self):
        """Weekly requirements of female hygiene packs indicator.

        This indicator reports the weekly requirements of female hygiene packs
        for further detail refer to the "Sample InaSAFE Actions for Vulnerable
        Populations" [27.07.2012] paper

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        myName = tr("Weekly hygiene packs")
        myMeta = {"description": "Females hygiene packs for weekly use"}

        # weekly hygene packs =
        # affected pop * fem_ratio * 0.7937 * week / intended day-of-use
        myResult = self.impact_total * self.female_ratio * 0.7937 * (7 / 7)
        try:
            myResult = int(round(myResult))
        except ValueError:
            myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult, myMeta)
Пример #23
0
    def _calculate_females(self):
        """Female population count indicator.

        this indicator reports the amount of female population according to the
        set female_ratio

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        myName = tr('Female population')

        #FIXME (MB) Shameless hack to deal with issue #368
        if self.impact_total > 8000000000 or self.impact_total < 0:
            self._append_result(myName, self.NO_DATA_TEXT)
            return

        myResult = self.impact_total * self.female_ratio
        try:
            myResult = int(round(myResult))
        except ValueError:
            myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult)
Пример #24
0
    def _calculate_elder(self):
        """Indicator that shows population above 64 years old.

        this indicator reports the amount of young population according to the
        set elder_ratio

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        myName = tr('Elderly count (affected)')

        #FIXME (MB) Shameless hack to deal with issue #368
        if self.impact_total > 8000000000 or self.impact_total < 0:
            self._append_result(myName, self.NO_DATA_TEXT)
            return

        myResult = self.impact_total * self.elder_ratio
        try:
            myResult = int(round(myResult))
        except ValueError:
            myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult)
Пример #25
0
    def _calculate_total(self):
        """Total population indicator.

        this indicator reports the total population

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        myName = tr('Total')

        #FIXME (MB) Shameless hack to deal with issue #368
        if self.impact_total > 8000000000 or self.impact_total < 0:
            self._append_result(myName, self.NO_DATA_TEXT)
            return

        try:
            myResult = self.impact_total
            myResult = int(round(myResult))
        except ValueError:
            myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult)
Пример #26
0
    def _calculate_weekly_hygene_packs(self):
        """Weekly requirements of female hygiene packs indicator.

        This indicator reports the weekly requirements of female hygiene packs
        for further detail refer to the "Sample InaSAFE Actions for Vulnerable
        Populations" [27.07.2012] paper

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        myName = tr('Weekly hygiene packs')
        myMeta = {'description': 'Females hygiene packs for weekly use'}

        #FIXME (MB) Shameless hack to deal with issue #368
        if self.impact_total > 8000000000 or self.impact_total < 0:
            self._append_result(myName, self.NO_DATA_TEXT, myMeta)
            return

        #weekly hygene packs =
        # affected pop * fem_ratio * 0.7937 * week / intended day-of-use
        myResult = self.impact_total * self.female_ratio * 0.7937 * (7 / 7)
        try:
            myResult = int(round(myResult))
        except ValueError:
            myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult, myMeta)
Пример #27
0
    def _calculate_adult(self):
        """Indicator that shows population between 15 and 64 years old.

        this indicator reports the amount of young population according to the
        set adult_ratio

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        myName = tr('Adult count')

        #FIXME (MB) Shameless hack to deal with issue #368
        if self.population_total > 8000000000 or self.population_total < 0:
            self._append_result(myName, self.NO_DATA_TEXT)
            return

        myResult = self.population_total * self.adult_ratio
        try:
            myResult = int(round(myResult))
        except ValueError:
            myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult)
Пример #28
0
    def _calculate_weekly_increased_calories(self):
        """Weekly additional kg of rice for pregnant and lactating women
        indicator.

        This indicator reports the weekly additional kg of rice for pregnant
        and lactating women.
        for further detail refer to the "Sample InaSAFE Actions for Vulnerable
        Populations" [27.07.2012] paper

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        myName = tr('Additional weekly rice kg for pregnant and lactating'
                    ' women')
        myMeta = {'description': 'Additional rice kg per week for pregnant and'
                                 ' lactating women'}

        #weekly Kg rice =
        # affected pop * fem_ratio * 0.7937 * week / intended day-of-use
        myLactKg = self.impact_total * self.female_ratio * 2 * 0.033782
        myPregKg = self.impact_total * self.female_ratio * 2 * 0.01281
        myResult = myLactKg + myPregKg
        try:
            myResult = int(round(myResult))
        except ValueError:
            myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult, myMeta)
Пример #29
0
def categorical_style(target_field,
                      categories,
                      no_data_value,
                      no_data_label,
                      data_defined_saturation_field=None,
                      max_impact_value=None):
    """Style with equidistant hue and optional data defined saturation
    :param target_field: field name that needs to be classified
    :type: target_field, str

    :param categories: values of target_field
    :type: categories, list

    :param no_data_value: value for no data
    :type: no_data_value, int, str

    :param no_data_label: label for the no data category
    :type: no_data_label, str

    :param data_defined_saturation_field: field for saturation for the
        generated colors.
    :type: data_defined_saturation_field, None, str

    :param max_impact_value: maximum value in data_defined_saturation_field,
        used to normalize saturation values for the generated colors.
    :type: max_impact_value, int, float

    :returns: a dict with target_field, style_classes and style_type
    :rtype: dict
    """
    # Create style
    classes = []
    colors = generate_categorical_color_ramp(len(categories))

    for index, category in enumerate(categories):
        hsv = colors['hsv'][index]
        if category == no_data_value:
            label = no_data_label
        else:
            label = '%s %s' % (tr('Category'), category)
        style_class = dict(label=label,
                           value=category,
                           colour=colors['hex'][index],
                           border_color=colors['hex'][index],
                           border_width=0.8,
                           transparency=0,
                           size=1)

        if data_defined_saturation_field is not None:
            # expr is like 'color_hsv(270.0, "pop"/9807.0*100, 70.0)'
            expr = 'color_hsv(%s, "%s"/%s*100, %s)' % (
                hsv[0] * 360, data_defined_saturation_field, max_impact_value,
                hsv[2] * 100)
            style_class.update({'data_defined': {'color': expr}})
        classes.append(style_class)

    style_info = dict(target_field=target_field,
                      style_classes=classes,
                      style_type='categorizedSymbol')
    return style_info
    def _calculate_categories(self):
        """Indicator that shows total population.

        this indicator reports the total population

        Args:
            None
        Returns:
            None
        Raises:
            None
        """

        impact_name = tr(self.target_field).lower()

        results = {}
        for impact_class in self.impact_classes:
            results[impact_class] = 0

        for feature in self.impact_attrs:
            myTarget = feature[self.target_field]
            results[myTarget] += 1

        for impact_class in self.impact_classes:
            result = results[impact_class]
            self._append_result('%s %s' % (impact_name, impact_class), result)
    def _calculate_categories(self):
        """Indicator that shows total population.

        this indicator reports the total population

        Args:
            None
        Returns:
            None
        Raises:
            None
        """

        impact_name = tr(self.target_field).lower()

        results = {}
        for impact_class in self.impact_classes:
            results[impact_class] = 0

        for feature in self.impact_attrs:
            myTarget = feature[self.target_field]
            results[myTarget] += 1

        for impact_class in self.impact_classes:
            result = results[impact_class]
            self._append_result('%s %s' % (impact_name, impact_class), result)
Пример #32
0
    def _calculate_weekly_hygene_packs(self):
        """Weekly requirements of female hygiene packs indicator.

        This indicator reports the weekly requirements of female hygiene packs
        for further detail refer to the "Sample InaSAFE Actions for Vulnerable
        Populations" [27.07.2012] paper

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        myName = tr('Weekly hygiene packs')
        myMeta = {'description': 'Females hygiene packs for weekly use'}

        #FIXME (MB) Shameless hack to deal with issue #368
        if self.impact_total > 8000000000 or self.impact_total < 0:
            self._append_result(myName, self.NO_DATA_TEXT, myMeta)
            return

        #weekly hygene packs =
        # affected pop * fem_ratio * 0.7937 * week / intended day-of-use
        myResult = self.impact_total * self.female_ratio * 0.7937 * (7 / 7)
        try:
            myResult = int(round(myResult))
        except ValueError:
            myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult, myMeta)
Пример #33
0
    def _calculate_females(self):
        """Female population count indicator.

        this indicator reports the amount of female population according to the
        set female_ratio

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        myName = tr('Female population (affected)')

        #FIXME (MB) Shameless hack to deal with issue #368
        if self.impact_total > 8000000000 or self.impact_total < 0:
            self._append_result(myName, self.NO_DATA_TEXT)
            return

        myResult = self.impact_total * self.female_ratio
        try:
            myResult = int(round(myResult))
        except ValueError:
            myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult)
Пример #34
0
    def _calculate_total(self):
        """Total population indicator.

        this indicator reports the total population

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        myName = tr('Total')

        #FIXME (MB) Shameless hack to deal with issue #368
        if self.impact_total > 8000000000 or self.impact_total < 0:
            self._append_result(myName, self.NO_DATA_TEXT)
            return

        try:
            myResult = self.impact_total
            myResult = int(round(myResult))
        except ValueError:
            myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult)
Пример #35
0
    def description(self):
        """Describe briefly what the post processor does.

        :returns: The translated description.
        :rtype: str
        """
        return tr('Calculates building types related statistics.')
Пример #36
0
    def _calculate_total(self):
        """Indicator that shows total population.

        This indicator reports the total population.
        """

        name = tr('Total')
        if self.target_field is not None:
            name = '%s %s' % (name, tr(self.target_field).lower())

        result = self.impact_total
        try:
            result = int(round(result))
        except ValueError:
            result = self.NO_DATA_TEXT
        self._append_result(name, result)
Пример #37
0
    def _calculate_elderly(self):
        """Indicator that shows population above 64 years old.

        this indicator reports the amount of young population according to the
        set elderly_ratio

        Args:
            None
        Returns:
            None
        Raises:
            None
        """
        myName = tr('Elderly count (affected)')

        #FIXME (MB) Shameless hack to deal with issue #368
        if self.impact_total > 8000000000 or self.impact_total < 0:
            self._append_result(myName, self.NO_DATA_TEXT)
            return

        myResult = self.impact_total * self.elderly_ratio
        try:
            myResult = int(round(myResult))
        except ValueError:
            myResult = self.NO_DATA_TEXT
        self._append_result(myName, myResult)
Пример #38
0
def default_minimum_needs():
    """Helper to get the default minimum needs.

    .. note:: Key names will be translated.
    """
    rice = tr('Rice')
    drinking_water = tr('Drinking Water')
    water = tr('Water')
    family_kits = tr('Family Kits')
    toilets = tr('Toilets')
    minimum_needs = OrderedDict([
        (rice, 2.8),
        (drinking_water, 17.5),
        (water, 105),
        (family_kits, 0.2),
        (toilets, 0.05)])
    return minimum_needs
Пример #39
0
def interpolate_raster_vector_points(source,
                                     target,
                                     layer_name=None,
                                     attribute_name=None,
                                     mode='linear'):
    """Interpolate from raster layer to point data

    Args:
        * source: Raster data set (grid)
        * target: Vector data set (points)
        * layer_name: Optional name of returned interpolated layer.
              If None the name of target is used for the returned layer.
        * attribute_name: Name for new attribute.
              If None (default) the name of layer source is used
        * mode: 'linear' or 'constant' - determines whether interpolation
              from grid to points should be bilinear or piecewise constant

    Output
        I: Vector data set; points located as target with values
           interpolated from source

    """

    msg = ('There are no data points to interpolate to. Perhaps zoom out '
           'and try again')
    verify(len(target) > 0, msg)

    # Input checks
    verify(source.is_raster)
    verify(target.is_vector)
    verify(target.is_point_data)

    # Get raster data and corresponding x and y axes
    A = source.get_data(nan=True)
    longitudes, latitudes = source.get_geometry()
    verify(len(longitudes) == A.shape[1])
    verify(len(latitudes) == A.shape[0])

    # Get vector point geometry as Nx2 array
    coordinates = numpy.array(target.get_geometry(), dtype='d', copy=False)
    # Get original attributes
    attributes = target.get_data()

    # Create new attribute and interpolate
    try:
        values = interpolate_raster(longitudes,
                                    latitudes,
                                    A,
                                    coordinates,
                                    mode=mode)
    except (BoundsError, InaSAFEError), e:
        msg = (tr('Could not interpolate from raster layer %(raster)s to '
                  'vector layer %(vector)s. Error message: %(error)s') % {
                      'raster': source.get_name(),
                      'vector': target.get_name(),
                      'error': str(e)
                  })
        raise InaSAFEError(msg)
Пример #40
0
def safe_to_qgis_layer(layer):
    """Helper function to make a QgsMapLayer from a safe read_layer layer.

    :param layer: Layer object as provided by InaSAFE engine.
    :type layer: read_layer

    :returns: A validated QGIS layer or None. Returns None when QGIS is not
        available.
    :rtype: QgsMapLayer, QgsVectorLayer, QgsRasterLayer, None

    :raises: Exception if layer is not valid.
    """
    try:
        from qgis.core import QgsVectorLayer, QgsRasterLayer
    except ImportError:
        return None

    # noinspection PyUnresolvedReferences
    message = tr(
        'Input layer must be a InaSAFE spatial object. I got %s'
    ) % (str(type(layer)))
    if not hasattr(layer, 'is_inasafe_spatial_object'):
        raise Exception(message)
    if not layer.is_inasafe_spatial_object:
        raise Exception(message)

    # Get associated filename and symbolic name
    filename = layer.get_filename()
    name = layer.get_name()

    qgis_layer = None
    # Read layer
    if layer.is_vector:
        qgis_layer = QgsVectorLayer(filename, name, 'ogr')
    elif layer.is_raster:
        qgis_layer = QgsRasterLayer(filename, name)

    # Verify that new qgis layer is valid
    if qgis_layer.isValid():
        return qgis_layer
    else:
        # noinspection PyUnresolvedReferences
        message = tr('Loaded impact layer "%s" is not valid') % filename
        raise Exception(message)
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id': 'EarthQuakeBuildingImpactFunction',
                'name': tr('Earthquake Building Impact Function'),
                'impact': tr('Be affected'),
                'author': 'N/A',
                'date_implemented': 'N/A',
                'overview': tr(
                    'This impact function will calculate the impact of an '
                    'earthquake on buildings, reporting how many are expected '
                    'to be damaged etc.'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': hazard_earthquake,
                        'units': [unit_mmi],
                        'layer_constraints': [
                            layer_vector_polygon,
                            layer_raster_numeric
                        ]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_structure,
                        'units': [
                            unit_building_type_type,
                            unit_building_generic],
                        'layer_constraints': [
                            layer_vector_polygon,
                            layer_vector_point
                        ]
                    }
                }
            }
            return dict_meta
Пример #42
0
def safe_to_qgis_layer(layer):
    """Helper function to make a QgsMapLayer from a safe read_layer layer.

    :param layer: Layer object as provided by InaSAFE engine.
    :type layer: read_layer

    :returns: A validated QGIS layer or None. Returns None when QGIS is not
        available.
    :rtype: QgsMapLayer, QgsVectorLayer, QgsRasterLayer, None

    :raises: Exception if layer is not valid.
    """
    try:
        from qgis.core import QgsVectorLayer, QgsRasterLayer
    except ImportError:
        return None

    # noinspection PyUnresolvedReferences
    message = tr('Input layer must be a InaSAFE spatial object. I got %s') % (
        str(type(layer)))
    if not hasattr(layer, 'is_inasafe_spatial_object'):
        raise Exception(message)
    if not layer.is_inasafe_spatial_object:
        raise Exception(message)

    # Get associated filename and symbolic name
    filename = layer.get_filename()
    name = layer.get_name()

    qgis_layer = None
    # Read layer
    if layer.is_vector:
        qgis_layer = QgsVectorLayer(filename, name, 'ogr')
    elif layer.is_raster:
        qgis_layer = QgsRasterLayer(filename, name)

    # Verify that new qgis layer is valid
    if qgis_layer.isValid():
        return qgis_layer
    else:
        # noinspection PyUnresolvedReferences
        message = tr('Loaded impact layer "%s" is not valid') % filename
        raise Exception(message)
Пример #43
0
    def _calculate_type(self, title, fields_values):
        """Indicator that shows total population.

        this indicator reports the building by type. the logic is:
        - look for the fields that occurs with a name included in
        self.valid_type_fields
        - look in those fields for any of the values of self.fields_values
        - if a record has one of the valid fields with one of the valid
        fields_values then it is considered affected

        Args:
            None
        Returns:
            None
        Raises:
            None
        """

        title = tr(title)
        if self.target_field is not None:
            title = '%s %s' % (title, tr(self.target_field).lower())

        result = 0
        if self.type_fields is not None:
            try:
                for building in self.impact_attrs:
                    for type_field in self.type_fields:
                        building_type = building[type_field]
                        if building_type in fields_values:
                            result += building[self.target_field]
                            break
                        elif self._is_unknown_type(building_type):
                            self._update_known_types(building_type)

                result = int(round(result))
            except (ValueError, KeyError):
                result = self.NO_DATA_TEXT
        else:
            if self.no_features:
                result = 0
            else:
                result = self.NO_DATA_TEXT
        self._append_result(title, result)
Пример #44
0
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id':
                'VolcanoPolygonHazardPopulation',
                'name':
                tr('Volcano Polygon Hazard Population'),
                'impact':
                tr('Need evacuation'),
                'author':
                'AIFDR',
                'date_implemented':
                'N/A',
                'overview':
                tr('To assess the impacts of volcano eruption '
                   'on population.'),
                'categories': {
                    'hazard': {
                        'definition':
                        hazard_definition,
                        'subcategory':
                        hazard_volcano,
                        'units': [unit_volcano_categorical],
                        'layer_constraints':
                        [layer_vector_polygon, layer_vector_point]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_population,
                        'units': [unit_people_per_pixel],
                        'layer_constraints': [layer_raster_numeric]
                    }
                }
            }
            return dict_meta
Пример #45
0
def interpolate_raster_vector_points(source, target,
                                     layer_name=None,
                                     attribute_name=None,
                                     mode='linear'):
    """Interpolate from raster layer to point data

    Args:
        * source: Raster data set (grid)
        * target: Vector data set (points)
        * layer_name: Optional name of returned interpolated layer.
              If None the name of target is used for the returned layer.
        * attribute_name: Name for new attribute.
              If None (default) the name of layer source is used
        * mode: 'linear' or 'constant' - determines whether interpolation
              from grid to points should be bilinear or piecewise constant

    Output
        I: Vector data set; points located as target with values
           interpolated from source

    """

    msg = ('There are no data points to interpolate to. Perhaps zoom out '
           'and try again')
    verify(len(target) > 0, msg)

    # Input checks
    verify(source.is_raster)
    verify(target.is_vector)
    verify(target.is_point_data)

    # Get raster data and corresponding x and y axes
    A = source.get_data(nan=True)
    longitudes, latitudes = source.get_geometry()
    verify(len(longitudes) == A.shape[1])
    verify(len(latitudes) == A.shape[0])

    # Get vector point geometry as Nx2 array
    coordinates = numpy.array(target.get_geometry(),
                              dtype='d',
                              copy=False)
    # Get original attributes
    attributes = target.get_data()

    # Create new attribute and interpolate
    try:
        values = interpolate_raster(longitudes, latitudes, A,
                                    coordinates, mode=mode)
    except (BoundsError, InaSAFEError), e:
        msg = (tr('Could not interpolate from raster layer %(raster)s to '
                 'vector layer %(vector)s. Error message: %(error)s')
               % {'raster': source.get_name(),
                  'vector': target.get_name(),
                  'error': str(e)})
        raise InaSAFEError(msg)
Пример #46
0
def evacuated_population_weekly_needs(population, minimum_needs=False):
    """Calculate estimated needs using BNPB Perka 7/2008 minimum bantuan.


    :param population: The number of evacuated population.
    :type: int, float

    :param minimum_needs: Ratios to use when calculating minimum needs.
        Defaults to perka 7 as described in assumptions below.
    :type minimum_needs: dict

    :returns: The weekly needs for the evacuated population.
    :rtype: dict

    Assumptions:
    * 400g rice per person per day
    * 2.5L drinking water per person per day
    * 15L clean water per person per day
    * assume 5 people per family (not in perka - 0.2 people per family)
    * 20 people per toilet (0.05 per person)
    """
    rice = tr('Rice')
    drinking_water = tr('Drinking Water')
    water = tr('Water')
    family_kits = tr('Family Kits')
    toilets = tr('Toilets')
    if not minimum_needs:
        minimum_needs = default_minimum_needs()

    min_rice = minimum_needs[rice]
    min_drinking_water = minimum_needs[drinking_water]
    min_water = minimum_needs[water]
    min_family_kits = minimum_needs[family_kits]
    min_toilets = minimum_needs[toilets]
    weekly_needs = {
        'rice': int(ceil(population * min_rice)),
        'drinking_water': int(ceil(population * min_drinking_water)),
        'water': int(ceil(population * min_water)),
        'family_kits': int(ceil(population * min_family_kits)),
        'toilets': int(ceil(population * min_toilets))
    }
    return weekly_needs
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id':
                'CategoricalHazardBuildingImpactFunction',
                'name':
                tr('Categorised Hazard Building Impact Function'),
                'impact':
                tr('Be impacted'),
                'author':
                'Dianne Bencito',
                'date_implemented':
                'N/A',
                'overview':
                tr('To assess the impacts of categorized hazards in raster '
                   'format on building vector layer.'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': hazard_all,
                        'units': [unit_categorised],
                        'layer_constraints': [layer_raster_numeric]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_structure,
                        'units':
                        [unit_building_type_type, unit_building_generic],
                        'layer_constraints': [layer_vector_polygon]
                    }
                }
            }
            return dict_meta
Пример #48
0
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id': 'VolcanoBuildingImpact',
                'name': tr('Volcano Building Impact'),
                'impact': tr('Be affected'),
                'author': 'AIFDR',
                'date_implemented': 'N/A',
                'overview': tr('To assess the impacts of volcano eruption '
                               'on building.'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': hazard_volcano,
                        'units': [unit_volcano_categorical],
                        'layer_constraints': [
                            layer_vector_polygon,
                            layer_vector_point
                        ]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_structure,
                        'units': [
                            unit_building_type_type,
                            unit_building_generic],
                        'layer_constraints': [
                            layer_vector_polygon,
                            layer_vector_point]
                    }
                }
            }
            return dict_meta
Пример #49
0
def get_postprocessor_human_name(postprocessor):
    """
    Returns the human readable name of  post processor

    :param postprocessor: Machine name of the postprocessor

    :returns : Human readable name for the postprocessor.
    :rtype: str
    """
    # Sunni : translate it first
    human_name_translated = tr(AVAILABLE_POSTPTOCESSORS[postprocessor])
    return human_name_translated
Пример #50
0
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id':
                'PAGFatalityFunction.',
                'name':
                tr('PAG Fatality Function.'),
                'impact':
                tr('Die or be displaced according Pager model'),
                'author':
                'Helen Crowley',
                'date_implemented':
                'N/A',
                'overview':
                tr('To assess the impact of earthquake on population based '
                   'on Population Vulnerability Model Pager'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': hazard_earthquake,
                        'units': [unit_mmi],
                        'layer_constraints': [layer_raster_numeric]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_population,
                        'units': [unit_people_per_pixel],
                        'layer_constraints': [layer_raster_numeric]
                    }
                }
            }
            return dict_meta
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'disabled': True,
                'id': 'FloodRasterRoadsExperimentalFunction',
                'name': tr('Flood Raster Roads Experimental Function'),
                'impact': tr('Be flooded in given thresholds'),
                'author': 'Dmitry Kolesov',
                'date_implemented': 'N/A',
                'overview': tr('N/A'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': [
                            hazard_flood,
                            hazard_tsunami
                        ],
                        'units': [
                            unit_metres_depth,
                            unit_feet_depth
                        ],
                        'layer_constraints': [layer_raster_numeric]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_road,
                        'units': [unit_road_type_type],
                        'layer_constraints': [layer_vector_line]
                    }
                }
            }
            return dict_meta
Пример #52
0
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id':
                'TsunamiEvacuationFunction',
                'name':
                tr('Tsunami Evacuation Function'),
                'impact':
                tr('Need evacuation'),
                'author':
                'AIFDR',
                'date_implemented':
                'N/A',
                'overview':
                tr('To assess the impacts of tsunami inundation '
                   'in raster format on population.'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': [hazard_tsunami],
                        'units': [unit_feet_depth, unit_metres_depth],
                        'layer_constraints': [layer_raster_numeric]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_population,
                        'units': [unit_people_per_pixel],
                        'layer_constraints': [layer_raster_numeric]
                    }
                }
            }
            return dict_meta
        def get_metadata():
            """Return metadata as a dictionary.

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id':
                'CategorisedHazardPopulationImpactFunction',
                'name':
                tr('Categorised Hazard Population Impact Function'),
                'impact':
                tr('Be impacted'),
                'author':
                'AIFDR',
                'date_implemented':
                'N/A',
                'overview':
                tr('To assess the impacts of categorized hazards in raster '
                   'format on population raster layer.'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': hazard_all,
                        'units': [unit_normalised],
                        'layer_constraints': [layer_raster_numeric]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_population,
                        'units': [unit_people_per_pixel],
                        'layer_constraints': [layer_raster_numeric]
                    }
                }
            }
            return dict_meta
Пример #54
0
        def get_metadata():
            """Return metadata as a dictionary

            This is a static method. You can use it to get the metadata in
            dictionary format for an impact function.

            :returns: A dictionary representing all the metadata for the
                concrete impact function.
            :rtype: dict
            """
            dict_meta = {
                'id':
                'ITBFatalityFunction',
                'name':
                tr('ITB Fatality Function'),
                'impact':
                tr('Die or be displaced'),
                'author':
                'Hadi Ghasemi',
                'date_implemented':
                'N/A',
                'overview':
                tr('To assess the impact of earthquake on population based '
                   'on earthquake model developed by ITB'),
                'categories': {
                    'hazard': {
                        'definition': hazard_definition,
                        'subcategory': hazard_earthquake,
                        'units': [unit_mmi],
                        'layer_constraints': [layer_raster_numeric]
                    },
                    'exposure': {
                        'definition': exposure_definition,
                        'subcategory': exposure_population,
                        'units': [unit_people_per_pixel],
                        'layer_constraints': [layer_raster_numeric]
                    }
                }
            }
            return dict_meta
Пример #55
0
    def description(self):
        """Describe briefly what the post processor does.

        Args:
            None

        Returns:
            Str the translated description

        Raises:
            Errors are propagated
        """
        return tr('Calculates age related statistics.')
    def description(self):
        """Describe briefly what the post processor does.

        Args:
            None

        Returns:
            Str the translated description

        Raises:
            Errors are propagated
        """
        return tr('Calculates generic aggregation statistics')
    def description(self):
        """Describe briefly what the post processor does.

        Args:
            None

        Returns:
            Str the translated description

        Raises:
            Errors are propagated
        """
        return tr('Aggregates minimum needs.')
def get_postprocessor_human_name(postprocesor):
    """
    Returns the human readable name of  post processor

    Args:
        * postprocessor: Machine name of the postprocessor

    Returns:
        str with the human readable name
    """
    # Sunni : translete it first
    human_name_translated = tr(AVAILABLE_POSTPTOCESSORS[postprocesor])
    return human_name_translated
Пример #59
0
    def description(self):
        """Describe briefly what the post processor does.

        Args:
            None

        Returns:
            Str the translated description

        Raises:
            Errors are propagated
        """
        return tr('Calculates building types related statistics.')