def as_dict():
        """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": "EarthquakeBuildingFunction",
            "name": tr("Earthquake on buildings"),
            "impact": tr("Be affected"),
            "title": tr("Be affected"),
            "function_type": "old-style",
            "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."
            ),
            "detailed_description": "",
            "hazard_input": "",
            "exposure_input": "",
            "output": "",
            "actions": "",
            "limitations": [],
            "citations": [],
            "categories": {
                "hazard": {
                    "definition": hazard_definition,
                    "subcategories": [hazard_earthquake],
                    "units": [unit_mmi],
                    "layer_constraints": [layer_raster_continuous],
                },
                "exposure": {
                    "definition": exposure_definition,
                    "subcategories": [exposure_structure],
                    "units": [unit_building_type_type, unit_building_generic],
                    "layer_constraints": [layer_vector_polygon, layer_vector_point],
                },
            },
            "parameters": OrderedDict(
                [
                    ("low_threshold", 6),
                    ("medium_threshold", 7),
                    ("high_threshold", 8),
                    (
                        "postprocessors",
                        OrderedDict([("AggregationCategorical", aggregation_categorical_postprocessor())]),
                    ),
                ]
            ),
        }
        return dict_meta
Esempio n. 2
0
    def as_dict():
        """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':
            'EarthquakeBuildingFunction',
            'name':
            tr('Earthquake on buildings'),
            'impact':
            tr('Be affected'),
            'title':
            tr('Be affected'),
            'function_type':
            'old-style',
            '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.'),
            'detailed_description':
            '',
            'hazard_input':
            '',
            'exposure_input':
            '',
            'output':
            '',
            'actions':
            '',
            'limitations': [],
            'citations': [],
            'categories': {
                'hazard': {
                    'definition': hazard_definition,
                    'subcategories': [hazard_earthquake],
                    'units': [unit_mmi],
                    'layer_constraints': [layer_raster_continuous],
                },
                'exposure': {
                    'definition': exposure_definition,
                    'subcategories': [exposure_structure],
                    'units': [unit_building_type_type, unit_building_generic],
                    'layer_constraints':
                    [layer_vector_polygon, layer_vector_point]
                }
            },
            'parameters':
            OrderedDict([
                ('low_threshold', 6), ('medium_threshold', 7),
                ('high_threshold', 8),
                ('postprocessors',
                 OrderedDict([('AggregationCategorical',
                               aggregation_categorical_postprocessor())]))
            ])
        }
        return dict_meta
Esempio n. 3
0
    def as_dict():
        """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': 'EarthquakeBuildingFunction',
            'name': tr('Earthquake on buildings'),
            'impact': tr('Be affected'),
            'title': tr('Be affected'),
            'function_type': 'old-style',
            '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.'),
            'detailed_description': '',
            'hazard_input': '',
            'exposure_input': '',
            'output': '',
            'actions': '',
            'limitations': [],
            'citations': [],
            'layer_requirements': {
                'hazard': {
                    'layer_mode': layer_mode_continuous,
                    'layer_geometries': [layer_geometry_raster],
                    'hazard_categories': [
                        hazard_category_single_event,
                        hazard_category_multiple_event
                    ],
                    'hazard_types': [hazard_earthquake],
                    'continuous_hazard_units': [unit_mmi],
                    'vector_hazard_classifications': [],
                    'raster_hazard_classifications': [],
                    'additional_keywords': []
                },
                'exposure': {
                    'layer_mode': layer_mode_classified,
                    'layer_geometries': [
                        layer_geometry_point,
                        layer_geometry_polygon
                    ],
                    'exposure_types': [exposure_structure],
                    'exposure_units': [],
                    'exposure_class_fields': [structure_class_field],
                    'additional_keywords': []
                }
            },
            'parameters': OrderedDict(
                [('low_threshold', low_threshold()),
                 ('medium_threshold', medium_threshold()),
                 ('high_threshold', high_threshold()),
                 ('postprocessors', OrderedDict([
                     ('AggregationCategorical',
                      aggregation_categorical_postprocessor())]))]
            )
        }
        return dict_meta