本文整理汇总了Python中safe.postprocessors.abstract_postprocessor.AbstractPostprocessor类的典型用法代码示例。如果您正苦于以下问题:Python AbstractPostprocessor类的具体用法?Python AbstractPostprocessor怎么用?Python AbstractPostprocessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AbstractPostprocessor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: clear
def clear(self):
"""Clear the parameters.
"""
AbstractPostprocessor.clear(self)
self.impact_total = None
self.female_ratio = None
开发者ID:Samweli,项目名称:inasafe,代码行数:7,代码来源:gender_postprocessor.py
示例2: __init__
def __init__(self):
"""
Constructor for AgePostprocessor postprocessor class,
It takes care of defining self.impact_total
"""
AbstractPostprocessor.__init__(self)
self.impact_total = None
开发者ID:mook-worldbank,项目名称:inasafe,代码行数:7,代码来源:age_postprocessor.py
示例3: __init__
def __init__(self):
"""
Constructor for postprocessor class,
It takes care of defining self.impact_total
"""
AbstractPostprocessor.__init__(self)
self.impact_total = None
self.impact_attrs = None
self.target_field = None
self.no_features = None
self.fields_values = {
'Medical': ['Clinic/Doctor', 'Hospital'],
'Schools': ['School', 'University/College', ],
'Places of worship': ['Place of Worship - Unitarian',
'Place of Worship - Islam',
'Place of Worship - Buddhist',
'Place of Worship'],
'Residential': ['Residential'],
'Government': ['Government'],
'Public Building': ['Public Building'],
'Fire Station': ['Fire Station'],
'Police Station': ['Police Station'],
'Supermarket': ['Supermarket'],
'Commercial': ['Commercial'],
'Industrial': ['Industrial'],
'Utility': ['Utility'],
'Sports Facility': ['Sports Facility'], }
self.type_fields = None
self.valid_type_fields = ['type']
开发者ID:meymeynard,项目名称:angularsafe,代码行数:29,代码来源:building_type_postprocessor.py
示例4: clear
def clear(self):
"""concrete implementation it takes care of the needed parameters being
properly cleared
"""
AbstractPostprocessor.clear(self)
self.impact_total = None
self.minimum_needs = None
开发者ID:cccs-ip,项目名称:inasafe,代码行数:7,代码来源:minimum_needs_postprocessor.py
示例5: __init__
def __init__(self):
"""
Constructor for postprocessor class,
It takes care of defining self.impact_total
"""
AbstractPostprocessor.__init__(self)
# Integer with total number of features/meters affected.
self.impact_total = None
# List of features
self.impact_attrs = None
# Name the field in the impact layer for the result.
self.target_field = None
# The name of field in the exposure layer.
self.valid_type_fields = None
# The value mapping for the exposure layer.
self.value_mapping = None
# Bool to know if there are some features. We will be computed later.
self.no_features = None
# Find which attribute field has to be used
self.type_fields = None
# Dictionary key - display name for the mapping.
self._labels = {}
# The categories order.
self._order = None
开发者ID:jobel-openscience,项目名称:inasafe,代码行数:33,代码来源:abstract_building_road_type_postprocessor.py
示例6: setup
def setup(self, params):
"""concrete implementation it takes care of the needed parameters being
initialized
Args:
params: dict of parameters to pass to the post processor
Returns:
None
Raises:
None
"""
AbstractPostprocessor.setup(self, None)
if self.impact_total is not None:
self._raise_error('clear needs to be called before setup')
self.impact_total = params['impact_total']
try:
#either all 3 ratio are custom set or we use defaults
self.youth_ratio = params['youth_ratio']
self.adult_ratio = params['adult_ratio']
self.elder_ratio = params['elder_ratio']
except KeyError:
self._log_message('either all 3 age ratio are custom set or we'
' use defaults')
defaults = get_defaults()
self.youth_ratio = defaults['YOUTH_RATIO']
self.adult_ratio = defaults['ADULT_RATIO']
self.elder_ratio = defaults['ELDER_RATIO']
开发者ID:borysiasty,项目名称:inasafe,代码行数:28,代码来源:age_postprocessor.py
示例7: clear
def clear(self):
"""Clear properly parameters.
"""
AbstractPostprocessor.clear(self)
self.impact_classes = None
self.impact_attrs = None
self.target_field = None
开发者ID:tomkralidis,项目名称:inasafe,代码行数:7,代码来源:aggregation_categorical_postprocessor.py
示例8: __init__
def __init__(self):
"""
Constructor for postprocessor class,
It takes care of defining self.impact_total
"""
AbstractPostprocessor.__init__(self)
self.impact_total = None
self.impact_attrs = None
self.target_field = None
self.no_features = None
self.type_fields = None
self.valid_type_fields = None
self.fields_values = OrderedDict([
('Medical', ['Clinic/Doctor', 'Hospital']),
('Schools', ['School', 'University/College', ]),
('Places of worship', ['Place of Worship - Unitarian',
'Place of Worship - Islam',
'Place of Worship - Buddhist',
'Place of Worship']),
('Residential', ['Residential']),
('Government', ['Government']),
('Public Building', ['Public Building']),
('Fire Station', ['Fire Station']),
('Police Station', ['Police Station']),
('Supermarket', ['Supermarket']),
('Commercial', ['Commercial']),
('Industrial', ['Industrial']),
('Utility', ['Utility']),
('Sports Facility', ['Sports Facility']),
('Other', [])])
self.known_types = []
self._update_known_types()
开发者ID:dynaryu,项目名称:inasafe,代码行数:33,代码来源:building_type_postprocessor.py
示例9: setup
def setup(self, params):
"""concrete implementation it takes care of the needed parameters being
initialized
:param params: Parameters to pass to the post processor.
:type params: dict
"""
AbstractPostprocessor.setup(self, None)
if self.impact_total is not None or self.minimum_needs is not None:
self._raise_error('clear needs to be called before setup')
try:
evacuation_percentage = 1
if 'function_params' in params.keys():
function_params = params['function_params']
if 'evacuation_percentage' in function_params.keys():
evacuation_percentage = function_params[
'evacuation_percentage']
evacuation_percentage /= 100.0 # make it decimal
self.impact_total = int(round(params['impact_total'] *
evacuation_percentage))
except (ValueError, TypeError):
self.impact_total = self.NO_DATA_TEXT
self.minimum_needs = params['function_params']['minimum needs']
开发者ID:severinmenard,项目名称:inasafe,代码行数:25,代码来源:minimum_needs_postprocessor.py
示例10: setup
def setup(self, params):
"""concrete implementation it takes care of the needed parameters being
initialized
:param params: dict of parameters to pass to the post processor
"""
AbstractPostprocessor.setup(self, None)
if (self.impact_total is not None or
self.impact_attrs is not None or
self.target_field is not None or
self.valid_type_fields is not None or
self.type_fields is not None):
self._raise_error('clear needs to be called before setup')
self.impact_total = params['impact_total']
self.impact_attrs = params['impact_attrs']
self.target_field = params['target_field']
self.valid_type_fields = params['key_attribute']
# find which attribute field has to be used
self.type_fields = []
try:
for key in self.impact_attrs[0].iterkeys():
if key.lower() in self.valid_type_fields:
self.type_fields.append(key)
except IndexError:
pass
if len(self.type_fields) == 0:
self.type_fields = None
self.no_features = False
# there are no features in this postprocessing polygon
if self.impact_attrs == []:
self.no_features = True
开发者ID:dynaryu,项目名称:inasafe,代码行数:35,代码来源:building_type_postprocessor.py
示例11: __init__
def __init__(self):
"""
Constructor for MinimumNeedsPostprocessor postprocessor class,
It takes care of defining self.impact_total
"""
AbstractPostprocessor.__init__(self)
self.impact_total = None
self.minimum_needs = None
开发者ID:cccs-ip,项目名称:inasafe,代码行数:8,代码来源:minimum_needs_postprocessor.py
示例12: __init__
def __init__(self):
"""
Constructor for postprocessor class,
It takes care of defining self.impact_classes
"""
AbstractPostprocessor.__init__(self)
self.impact_classes = None
self.impact_attrs = None
self.target_field = None
开发者ID:lptorres,项目名称:noah-inasafe,代码行数:9,代码来源:aggregation_categorical_postprocessor.py
示例13: clear
def clear(self):
"""concrete implementation that ensures needed parameters are cleared.
"""
AbstractPostprocessor.clear(self)
self.impact_total = None
self.impact_attrs = None
self.target_field = None
self.type_fields = None
self.valid_type_fields = None
开发者ID:dynaryu,项目名称:inasafe,代码行数:9,代码来源:building_type_postprocessor.py
示例14: __init__
def __init__(self):
"""
Constructor for AgePostprocessor postprocessor class.
It takes care of defining self.impact_total
"""
AbstractPostprocessor.__init__(self)
self.youth_ratio = None
self.adult_ratio = None
self.elderly_ratio = None
self.impact_total = None
开发者ID:felix-yew,项目名称:inasafe,代码行数:11,代码来源:age_postprocessor.py
示例15: process
def process(self):
"""concrete implementation it takes care of the needed parameters being
available and performs all the indicators calculations
"""
AbstractPostprocessor.process(self)
if self.impact_total is None or self.minimum_needs is None:
self._log_message('%s not all params have been correctly '
'initialized, setup needs to be called before '
'process. Skipping this postprocessor'
% self.__class__.__name__)
else:
self._calculate_needs()
开发者ID:cccs-ip,项目名称:inasafe,代码行数:12,代码来源:minimum_needs_postprocessor.py
示例16: setup
def setup(self, params):
"""Initialise parameters.
"""
AbstractPostprocessor.setup(self, None)
if self.impact_total is not None or self.female_ratio is not None:
self._raise_error('clear needs to be called before setup')
self.impact_total = params['impact_total']
self.female_ratio = params['female_ratio']
if self.female_ratio > 1:
self._raise_error('Female ratio should be lower max 1. Found: '
'%s ' % self.female_ratio)
开发者ID:Samweli,项目名称:inasafe,代码行数:12,代码来源:gender_postprocessor.py
示例17: setup
def setup(self, params):
"""concrete implementation it takes care of the needed parameters being
initialized
:param params: Parameters to pass to the post processor.
:type params: dict
"""
AbstractPostprocessor.setup(self, None)
if self.impact_total is not None or self.minimum_needs is not None:
self._raise_error('clear needs to be called before setup')
self.impact_total = int(round(params['impact_total']))
self.minimum_needs = params['function_params']['minimum needs']
开发者ID:vdeparday,项目名称:inasafe,代码行数:13,代码来源:minimum_needs_postprocessor.py
示例18: clear
def clear(self):
"""concrete implementation it takes care of the needed parameters being
properly cleared
Args:
None
Returns:
None
Raises:
None
"""
AbstractPostprocessor.clear(self)
self.impact_total = None
开发者ID:mook-worldbank,项目名称:inasafe,代码行数:13,代码来源:age_postprocessor.py
示例19: setup
def setup(self, params):
"""Initialise needed parameters.
"""
AbstractPostprocessor.setup(self, None)
if (self.impact_classes is not None or
self.impact_attrs is not None or
self.target_field is not None):
self._raise_error('clear needs to be called before setup')
self.impact_classes = params['impact_classes']
self.impact_attrs = params['impact_attrs']
self.target_field = params['target_field']
self._log_message(self.impact_attrs)
开发者ID:cecep17,项目名称:inasafe,代码行数:13,代码来源:aggregation_categorical_postprocessor.py
示例20: process
def process(self):
"""Performs all the indicators calculations.
"""
AbstractPostprocessor.process(self)
if (self.impact_classes is None or
self.impact_attrs is None or
self.target_field is None):
self._log_message(
'%s not all params have been correctly '
'initialized, setup needs to be called before '
'process. Skipping this postprocessor'
% self.__class__.__name__)
else:
self._calculate_categories()
开发者ID:cecep17,项目名称:inasafe,代码行数:14,代码来源:aggregation_categorical_postprocessor.py
注:本文中的safe.postprocessors.abstract_postprocessor.AbstractPostprocessor类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论