本文整理汇总了Python中safe.defaults.default_minimum_needs函数的典型用法代码示例。如果您正苦于以下问题:Python default_minimum_needs函数的具体用法?Python default_minimum_needs怎么用?Python default_minimum_needs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default_minimum_needs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: evacuated_population_weekly_needs
def evacuated_population_weekly_needs(
population,
minimum_needs=None):
"""Calculate estimated needs using minimum needs as specified or the
default.
:param population: The number of evacuated population.
:type: int, float
:param minimum_needs: Ratios used to calculate weekly needs in parameter
form.
:type minimum_needs: list,
:returns: The needs for the evacuated population.
:rtype: dict
"""
if not minimum_needs:
minimum_needs = default_minimum_needs()
minimum_needs = filter_needs_parameters(minimum_needs)
population_needs = OrderedDict()
for resource in minimum_needs:
resource = resource.serialize()
amount = resource['value']
name = resource['name']
population_needs[name] = int(ceil(population * float(amount)))
return population_needs
示例2: as_dict
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': 'PAGFatalityFunction',
'name': tr('Earthquake PAGER fatality function'),
'impact': tr('Die or be displaced according Pager model'),
'title': tr('Die or be displaced according Pager model'),
'function_type': 'old-style',
'author': 'Helen Crowley',
'date_implemented': 'N/A',
'overview': tr(
'To assess the impact of an earthquake on population based '
'on the Population Vulnerability Pager Model.'),
'detailed_description': '',
'hazard_input': '',
'exposure_input': '',
'output': '',
'actions': '',
'limitations': [],
'citations': [
tr('Jaiswal, K. S., Wald, D. J., and Hearne, M. (2009a). '
'Estimating casualties for large worldwide earthquakes '
'using an empirical approach. U.S. Geological Survey '
'Open-File Report 2009-1136.')
],
'categories': {
'hazard': {
'definition': hazard_definition,
'subcategories': [hazard_earthquake],
'units': [unit_mmi],
'layer_constraints': [layer_raster_continuous]
},
'exposure': {
'definition': exposure_definition,
'subcategories': [exposure_population],
'units': [unit_people_per_pixel],
'layer_constraints': [layer_raster_continuous]
}
},
'parameters': OrderedDict([
('postprocessors', OrderedDict([
('Gender', default_gender_postprocessor()),
('Age', age_postprocessor()),
('MinimumNeeds', minimum_needs_selector()),
])),
('minimum needs', default_minimum_needs()),
('provenance', default_provenance())])
}
return dict_meta
示例3: setUp
def setUp(self):
"""Run before each test."""
params = {
'impact_total': 146458,
'function_params': {
'minimum needs': default_minimum_needs()
}
}
POSTPROCESSOR.setup(params)
示例4: test_default_needs
def test_default_needs(self):
"""default calculated needs are as expected
"""
minimum_needs = [
parameter.serialize() for parameter in default_minimum_needs()]
# 20 Happens to be the smallest number at which integer rounding
# won't make a difference to the result
result = evacuated_population_needs(20, minimum_needs)['weekly']
result = OrderedDict([[r['table name'], r['amount']] for r in result])
assert (result['Rice [kg]'] == 56
and result['Drinking Water [l]'] == 350
and result['Clean Water [l]'] == 1340
and result['Family Kits'] == 4)
result = evacuated_population_needs(10, minimum_needs)['single']
result = OrderedDict([[r['table name'], r['amount']] for r in result])
assert result['Toilets'] == 1
示例5: test_arbitrary_needs
def test_arbitrary_needs(self):
"""custom need ratios calculated are as expected
"""
minimum_needs = [
parameter.serialize() for parameter in default_minimum_needs()]
minimum_needs[0]['value'] = 4
minimum_needs[1]['value'] = 3
minimum_needs[2]['value'] = 2
minimum_needs[3]['value'] = 1
minimum_needs[4]['value'] = 0.2
result = evacuated_population_needs(10, minimum_needs)['weekly']
result = OrderedDict([[r['table name'], r['amount']] for r in result])
assert (result['Rice [kg]'] == 40
and result['Drinking Water [l]'] == 30
and result['Clean Water [l]'] == 20
and result['Family Kits'] == 10)
result = evacuated_population_needs(10, minimum_needs)['single']
result = OrderedDict([[r['table name'], r['amount']] for r in result])
assert result['Toilets'] == 2
示例6: as_dict
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': 'VolcanoPolygonPopulationFunction',
'name': tr('Polygon volcano on population'),
'impact': tr('Need evacuation'),
'title': tr('Need evacuation'),
'function_type': 'old-style',
'author': 'AIFDR',
'date_implemented': 'N/A',
'hazard_input': tr(
'The hazard layer must be a polygon layer. This layer '
'must have an attribute representing the volcano hazard '
'zone that can be specified in the impact function option. '
'There are three classes low, medium, and high. The default '
'values are "Kawasan Rawan Bencana I" for low, "Kawasan Rawan '
'Bencana II" for medium, and "Kawasan Rawan Bencana III for '
'high." If you want to see the name of the volcano in the '
'result, you need to specify the volcano name attribute in '
'the Impact Function options.'),
'exposure_input': tr(
'An exposure raster layer where each cell represents a '
'population count for that cell.'),
'output': tr(
'A vector layer containing people affected per hazard zone '
'and the minimum needs based on the number of people '
'affected.'),
'actions': tr(
'Provide details about the number of people that are within '
'each hazard zone.'),
'limitations': [],
'citations': [
{
'text': None,
'link': None
}
],
'map_title': tr('People affected by Volcano Hazard Zones'),
'legend_title': tr('Population'),
'legend_units': tr('(people per cell)'),
'legend_notes': tr(
'Thousand separator is represented by %s' %
get_thousand_separator()),
'layer_name': tr('People affected by volcano hazard zones'),
'overview': tr(
'To assess the impact of a volcano eruption on people.'),
'detailed_description': '',
'layer_requirements': {
'hazard': {
'layer_mode': layer_mode_classified,
'layer_geometries': [layer_geometry_polygon],
'hazard_categories': [
hazard_category_multiple_event,
hazard_category_single_event
],
'hazard_types': [hazard_volcano],
'continuous_hazard_units': [],
'vector_hazard_classifications': [
volcano_vector_hazard_classes],
'raster_hazard_classifications': [],
'additional_keywords': [
volcano_name_field]
},
'exposure': {
'layer_mode': layer_mode_continuous,
'layer_geometries': [layer_geometry_raster],
'exposure_types': [exposure_population],
'exposure_units': [count_exposure_unit],
'exposure_class_fields': [],
'additional_keywords': []
}
},
'parameters': OrderedDict([
('postprocessors', OrderedDict([
('Gender', default_gender_postprocessor()),
('Age', age_postprocessor()),
('MinimumNeeds', minimum_needs_selector()),
])),
('minimum needs', default_minimum_needs())
])
}
return dict_meta
示例7: as_dict
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': 'VolcanoPointPopulationFunction',
'name': tr('Point volcano on population'),
'impact': tr('Be impacted'),
'title': tr('Be impacted'),
'function_type': 'old-style',
'author': 'AIFDR',
'date_implemented': 'N/A',
'hazard_input': tr(
'A point vector layer.'),
'exposure_input': tr(
'An exposure raster layer where each cell represent '
'population count.'),
'output': tr(
'Vector layer contains people affected and the minimum '
'needs based on the number of people affected.'),
'actions': tr(
'Provide details about how many people would likely '
'be affected by each hazard zone.'),
'limitations': [],
'citations': [],
'map_title': tr('People affected by the buffered point volcano'),
'legend_title': tr('Population'),
'legend_units': tr('(people per cell)'),
'legend_notes': tr(
'Thousand separator is represented by %s' %
get_thousand_separator()),
'layer_name': tr('People affected by the buffered point volcano'),
'overview': tr(
'To assess the impacts of volcano eruption on '
'population.'),
'detailed_description': '',
'layer_requirements': {
'hazard': {
'layer_mode': layer_mode_classified,
'layer_geometries': [layer_geometry_point],
'hazard_categories': [
hazard_category_multiple_event,
hazard_category_single_event
],
'hazard_types': [hazard_volcano],
'continuous_hazard_units': [],
'vector_hazard_classifications': [],
'raster_hazard_classifications': [],
'additional_keywords': [volcano_name_field]
},
'exposure': {
'layer_mode': layer_mode_continuous,
'layer_geometries': [layer_geometry_raster],
'exposure_types': [exposure_population],
'exposure_units': [count_exposure_unit],
'exposure_class_fields': [],
'additional_keywords': []
}
},
'parameters': OrderedDict([
# The radii
('distances', distance()),
('postprocessors', OrderedDict([
('Gender', default_gender_postprocessor()),
('Age', age_postprocessor()),
('MinimumNeeds', minimum_needs_selector()),
])),
('minimum needs', default_minimum_needs())
])
}
return dict_meta
示例8: as_dict
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": "ClassifiedRasterHazardPopulationFunction",
"name": tr("Classified raster hazard on population"),
"impact": tr("Be affected by each class"),
"title": tr("Be affected by each hazard class"),
"function_type": "old-style",
"author": "Dianne Bencito",
"date_implemented": "N/A",
"overview": tr(
"To assess the impacts of classified hazards in raster " "format on a population raster layer."
),
"detailed_description": tr(
"This function will treat the values in the hazard raster "
"layer as classes representing low, medium and high "
"impact. You need to ensure that the keywords for the hazard "
"layer have been set appropriately to define these classes."
"The number of people that will be affected will be "
"calculated for each class. The report will show the total "
"number of people that will be affected for each "
"hazard class."
),
"hazard_input": tr(
"A hazard raster layer where each cell represents the "
"class of the hazard. There should be three classes: e.g. "
"1, 2, and 3."
),
"exposure_input": tr(
"An exposure raster layer where each cell represents the" "population count for that cell."
),
"output": tr(
"Map of population exposed to the highest class and a table " "with the number of people in each class"
),
"actions": tr("Provide details about how many people would likely be " "affected for each hazard class."),
"limitations": [tr("The number of classes is three.")],
"citations": [],
"categories": {
"hazard": {
"definition": hazard_definition,
"subcategories": hazard_all,
"units": [unit_classified],
"layer_constraints": [layer_raster_classified],
},
"exposure": {
"definition": exposure_definition,
"subcategories": [exposure_population],
"units": [unit_people_per_pixel],
"layer_constraints": [layer_raster_continuous],
},
},
"parameters": OrderedDict(
[
("low_hazard_class", 1.0),
("medium_hazard_class", 2.0),
("high_hazard_class", 3.0),
(
"postprocessors",
OrderedDict(
[
("Gender", default_gender_postprocessor()),
("Age", age_postprocessor()),
("MinimumNeeds", minimum_needs_selector()),
]
),
),
("minimum needs", default_minimum_needs()),
("provenance", default_provenance()),
]
),
}
return dict_meta
示例9: as_dict
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': 'VolcanoPolygonPopulationFunction',
'name': tr('Polygon volcano on population'),
'impact': tr('Need evacuation'),
'title': tr('Need evacuation'),
'function_type': 'old-style',
'author': 'AIFDR',
'date_implemented': 'N/A',
'hazard_input': tr(
'The hazard vector layer must be a polygon that has a '
'specific hazard zone attribute.'),
'exposure_input': tr(
'An exposure raster layer where each cell represents a '
'population count for that cell.'),
'output': tr(
'A vector layer containing people affected per hazard zone '
'and the minimum needs based on the number of people '
'affected.'),
'actions': tr(
'Provide details about the number of people that are within '
'each hazard zone.'),
'limitations': [],
'citations': [],
'overview': tr(
'To assess the impact of a volcano eruption on people.'),
'detailed_description': '',
'layer_requirements': {
'hazard': {
'layer_mode': layer_mode_classified,
'layer_geometries': [layer_geometry_polygon],
'hazard_categories': [
hazard_category_multiple_event,
hazard_category_single_event
],
'hazard_types': [hazard_volcano],
'continuous_hazard_units': [],
'vector_hazard_classifications': [
volcano_vector_hazard_classes],
'raster_hazard_classifications': [],
'additional_keywords': [
volcano_name_field]
},
'exposure': {
'layer_mode': layer_mode_continuous,
'layer_geometries': [layer_geometry_raster],
'exposure_types': [exposure_population],
'exposure_units': [count_exposure_unit],
'exposure_class_fields': [],
'additional_keywords': []
}
},
'parameters': OrderedDict([
('postprocessors', OrderedDict([
('Gender', default_gender_postprocessor()),
('Age', age_postprocessor()),
('MinimumNeeds', minimum_needs_selector()),
])),
('minimum needs', default_minimum_needs())
])
}
return dict_meta
示例10: as_dict
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': 'ContinuousHazardPopulationFunction',
'name': tr('Continuous raster hazard on population'),
'impact': tr('Be impacted'),
'title': tr('Be impacted'),
'function_type': 'old-style',
'author': 'AIFDR',
'date_implemented': 'N/A',
'overview': tr(
'To assess the impacts of continuous hazards in raster '
'format on population raster layer.'),
'detailed_description': tr(
'This function will categorised the continuous hazard '
'level into 3 category based on the threshold that has '
'been input by the user. After that, this function will '
'calculate how many people will be impacted per category '
'for all categories in the hazard layer.'),
'hazard_input': tr(
'A hazard raster layer where each cell represents the '
'level of the hazard. The hazard has continuous value of '
'hazard level.'),
'exposure_input': tr(
'An exposure raster layer where each cell represent '
'population count.'),
'output': tr(
'Map of population exposed to high category and a table '
'with number of people in each category'),
'actions': tr(
'Provide details about how many people would likely '
'be impacted in each category.'),
'limitations': [tr('Only three categories can be used.')],
'citations': [],
'layer_requirements': {
'hazard': {
'layer_mode': layer_mode_continuous,
'layer_geometries': [layer_geometry_raster],
'hazard_categories': [
hazard_category_multiple_event,
hazard_category_single_event
],
'hazard_types': hazard_all,
'continuous_hazard_units': [unit_generic],
'vector_hazard_classifications': [],
'raster_hazard_classifications': [],
'additional_keywords': []
},
'exposure': {
'layer_mode': layer_mode_continuous,
'layer_geometries': [layer_geometry_raster],
'exposure_types': [exposure_population],
'exposure_units': [
count_exposure_unit, density_exposure_unit],
'exposure_class_fields': [],
'additional_keywords': []
}
},
# Configurable parameters
'parameters': OrderedDict([
('Categorical thresholds', categorical_thresholds()),
('postprocessors', OrderedDict([
('Gender', default_gender_postprocessor()),
('Age', age_postprocessor()),
('MinimumNeeds', minimum_needs_selector()),
])),
('minimum needs', default_minimum_needs())
])
}
return dict_meta
示例11: as_dict
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': 'FloodEvacuationVectorHazardFunction',
'name': tr('Polygon flood on people'),
'impact': tr('Need evacuation'),
'title': tr('Need evacuation'),
'function_type': 'old-style',
'author': 'AIFDR',
'date_implemented': 'N/A',
'overview': tr(
'To assess the impacts of flood inundation in vector '
'format on population.'),
'detailed_description': tr(
'The population subject to inundation is determined by '
'whether they are in a flood affected area or not. You can '
'also set an evacuation percentage to calculate what '
'percentage of the affected population should be '
'evacuated. This number will be used to estimate needs '
'based on the user defined minimum needs file.'),
'hazard_input': tr(
'A hazard vector layer which has an affected attribute. If '
'it does not have that attribute, all polygons will be '
'considered as affected.'),
'exposure_input': tr(
'An exposure raster layer where each cell represents a '
'population count.'),
'output': tr(
'A vector layer containing the number of people affected '
'per flood area and the minimum needs based on '
'evacuation percentage.'),
'actions': tr(
'Provide details about how many people would likely need '
'to be evacuated, where they are located and what '
'resources would be required to support them.'),
'limitations': [],
'citations': [],
'map_title': tr('People affected by flood prone areas'),
'legend_title': tr('Population Count'),
'legend_units': tr('(people per polygon)'),
'legend_notes': tr(
'Thousand separator is represented by %s' %
get_thousand_separator()),
'layer_name': tr('People affected by flood prone areas'),
'layer_requirements': {
'hazard': {
'layer_mode': layer_mode_classified,
'layer_geometries': [layer_geometry_polygon],
'hazard_categories': [
hazard_category_single_event,
hazard_category_multiple_event
],
'hazard_types': [hazard_flood],
'continuous_hazard_units': [],
'vector_hazard_classifications': [
flood_vector_hazard_classes],
'raster_hazard_classifications': [],
'additional_keywords': []
},
'exposure': {
'layer_mode': layer_mode_continuous,
'layer_geometries': [layer_geometry_raster],
'exposure_types': [exposure_population],
'exposure_units': [count_exposure_unit],
'exposure_class_fields': [],
'additional_keywords': []
}
},
'parameters': OrderedDict([
# Percent of affected needing evacuation
('evacuation_percentage',
parameter_definitions.evacuation_percentage()),
('postprocessors', OrderedDict([
('Gender', default_gender_postprocessor()),
('Age', age_postprocessor()),
('MinimumNeeds', minimum_needs_selector()),
])),
('minimum needs', default_minimum_needs())
])
}
return dict_meta
示例12: as_dict
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': 'ITBBayesianFatalityFunction',
'name': tr(
'Earthquake ITB fatality function based on a Bayesian '
'approach'),
'impact': tr('Die or be displaced according ITB bayesian model'),
'title': tr('Die or be displaced according ITB bayesian model'),
'function_type': 'old-style',
'author': 'ITB and GA', # FIXME
'date_implemented': 'N/A',
'overview': tr(
'Estimates the number of fatalities resulting from an '
'earthquake. Uses data from an Indonesian database of '
'earthquake events to calculate fatality rates. Based on the '
'Population Vulnerability ITB Bayesian Model. This model is '
'better at capturing uncertainty in the results.'),
'detailed_description': '',
'hazard_input': '',
'exposure_input': '',
'output': '',
'actions': '',
'limitations': [],
'citations': [
{
'text': tr(
'Sengara, W., Suarjana, M., Yulman, M.A., Ghasemi, '
'H., and Ryu, H. (2015). An empirical fatality model '
'for Indonesia based on a Bayesian approach. '
'Submitted for Journal of the Geological Society'),
'link': None
}
],
'map_title': 'Earthquake impact to population',
'legend_title': '',
'legend_units': '',
'legend_notes': '',
'layer_name': '',
'layer_requirements': {
'hazard': {
'layer_mode': layer_mode_continuous,
'layer_geometries': [layer_geometry_raster],
'hazard_categories': [hazard_category_single_event],
'hazard_types': [hazard_earthquake],
'continuous_hazard_units': [unit_mmi],
'vector_hazard_classifications': [],
'raster_hazard_classifications': [],
'additional_keywords': []
},
'exposure': {
'layer_mode': layer_mode_continuous,
'layer_geometries': [layer_geometry_raster],
'exposure_types': [exposure_population],
'exposure_units': [count_exposure_unit],
'exposure_class_fields': [],
'additional_keywords': []
}
},
'parameters': OrderedDict([
('postprocessors', OrderedDict([
('Gender', default_gender_postprocessor()),
('Age', age_postprocessor()),
('MinimumNeeds', minimum_needs_selector()),
])),
('minimum needs', default_minimum_needs())
])
}
return dict_meta
示例13: as_dict
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': 'VolcanoPointPopulationFunction',
'name': tr('Point volcano on population'),
'impact': tr('Be impacted'),
'title': tr('Be impacted'),
'function_type': 'old-style',
'author': 'AIFDR',
'date_implemented': 'N/A',
'hazard_input': tr(
'A point vector layer.'),
'exposure_input': tr(
'An exposure raster layer where each cell represent '
'population count.'),
'output': tr(
'Vector layer contains people affected and the minimum '
'needs based on the number of people affected.'),
'actions': tr(
'Provide details about how many people would likely '
'be affected by each hazard zone.'),
'limitations': [],
'citations': [],
'overview': tr(
'To assess the impacts of volcano eruption on '
'population.'),
'detailed_description': '',
'categories': {
'hazard': {
'definition': hazard_definition,
'subcategories': [hazard_volcano],
'units': [unit_volcano_categorical],
'layer_constraints': [
layer_vector_point
]
},
'exposure': {
'definition': exposure_definition,
'subcategories': [exposure_population],
'units': [unit_people_per_pixel],
'layer_constraints': [layer_raster_continuous]
}
},
'parameters': OrderedDict([
# The radii
('distance [km]', [3, 5, 10]),
# The attribute for name of the volcano in hazard layer
('volcano name attribute', 'NAME'),
('postprocessors', OrderedDict([
('Gender', default_gender_postprocessor()),
('Age', age_postprocessor()),
('MinimumNeeds', minimum_needs_selector()),
])),
('minimum needs', default_minimum_needs()),
('provenance', default_provenance())
])
}
return dict_meta
示例14: as_dict
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': 'AshRasterHazardPopulationFunctionMetadata',
'name': tr('Ash raster on population'),
'impact': tr('Be affected'),
'title': tr('Be affected'),
'function_type': 'old-style',
'author': 'Ismail Sunni',
'date_implemented': '13/07/2016',
'overview': tr(
'To assess the impact of each hazard zone on population.'),
'detailed_description': '',
'hazard_input': tr(
'The hazard layer must be an ash raster layer.'),
'exposure_input': tr(
'An exposure raster layer where each cell represents the '
'population count for that cell.'),
'output': tr(
'Map of population exposed to the highest hazard zone and a '
'table with the number of population in each hazard zone'),
'actions': tr(
'Provide details about how big area fall within '
'each hazard zone.'),
'limitations': [],
'citations': [
{
'text': None,
'link': None
}
],
'legend_title': '',
'legend_units': '',
'legend_notes': '',
'map_title': tr('Affected Population'),
'layer_name': tr('Population affected'),
'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_volcanic_ash],
'continuous_hazard_units': [unit_centimetres],
'vector_hazard_classifications': [],
'raster_hazard_classifications': [],
'additional_keywords': []
},
'exposure': {
'layer_mode': layer_mode_continuous,
'layer_geometries': [layer_geometry_raster],
'exposure_types': [exposure_population],
'exposure_units': [count_exposure_unit],
'exposure_class_fields': [],
'additional_keywords': []
}
},
'parameters': OrderedDict(
[
('group_threshold', threshold_group_parameter()),
('postprocessors', OrderedDict([
('Gender', default_gender_postprocessor()),
('Age', age_postprocessor()),
('MinimumNeeds', minimum_needs_selector()),
])),
('minimum needs', default_minimum_needs())
])
}
return dict_meta
示例15: as_dict
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': 'FloodEvacuationRasterHazardFunction',
'name': tr('Raster flood on population'),
'impact': tr('Need evacuation'),
'title': tr('Need evacuation'),
'function_type': 'old-style',
'author': 'AIFDR',
'date_implemented': 'N/A',
'overview': tr(
'To assess the impacts of flood inundation in raster '
'format on population.'),
'detailed_description': tr(
'The population subject to inundation exceeding a '
'threshold (default 1m) is calculated and returned as a '
'raster layer. In addition the total number of affected '
'people and the required needs based on the user '
'defined minimum needs are reported. The threshold can be '
'changed and even contain multiple numbers in which case '
'evacuation and needs are calculated using the largest number '
'with population breakdowns provided for the smaller numbers. '
'The population raster is resampled to the resolution of the '
'hazard raster and is rescaled so that the resampled '
'population counts reflect estimates of population count '
'per resampled cell. The resulting impact layer has the '
'same resolution and reflects population count per cell '
'which are affected by inundation.'),
'hazard_input': tr(
'A hazard raster layer where each cell represents flood '
'depth (in meters).'),
'exposure_input': tr(
'An exposure raster layer where each cell represent '
'population count.'),
'output': tr(
'Raster layer contains population affected and the minimum '
'needs based on number of the population affected.'),
'actions': tr(
'Provide details about how many people would likely need '
'to be evacuated, where they are located and what '
'resources would be required to support them.'),
'limitations': [
tr('The default threshold of 1 meter was selected based '
'on consensus, not hard evidence.')
],
'citations': [
{
'text': None,
'link': None
}
],
'map_title': tr('People in need of evacuation'),
'legend_title': tr('Population Count'),
'legend_units': tr('(people per cell)'),
'legend_notes': tr(
'Thousand separator is represented by %s' %
get_thousand_separator()),
'layer_name': tr('Population which need evacuation'),
'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_flood],
'continuous_hazard_units': [unit_feet, unit_metres],
'vector_hazard_classifications': [],
'raster_hazard_classifications': [],
'additional_keywords': []
},
'exposure': {
'layer_mode': layer_mode_continuous,
'layer_geometries': [layer_geometry_raster],
'exposure_types': [exposure_population],
'exposure_units': [count_exposure_unit],
'exposure_class_fields': [],
'additional_keywords': []
}
},
'parameters': OrderedDict([
('thresholds', threshold()),
('postprocessors', OrderedDict([
('Gender', default_gender_postprocessor()),
('Age', age_postprocessor()),
('MinimumNeeds', minimum_needs_selector()),
])),
('minimum needs', default_minimum_needs())
])
}
return dict_meta