本文整理汇总了Python中safe.common.utilities.format_int函数的典型用法代码示例。如果您正苦于以下问题:Python format_int函数的具体用法?Python format_int怎么用?Python format_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_int函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: format_breakdown
def format_breakdown(self):
"""Breakdown by road type.
:returns: The roads breakdown report.
:rtype: safe.message.Message
"""
road_breakdown = self.roads_breakdown
attributes = road_breakdown['attributes']
fields = road_breakdown['fields']
message = m.Message(style_class='container')
table = m.Table(style_class='table table-condensed table-striped')
table.caption = None
row = m.Row()
row.add(m.Cell(tr('Breakdown by road type'), header=True))
for _ in attributes:
# Add empty cell as many as affected_categories
row.add(m.Cell('', header=True))
# Add empty cell for total column
row.add(m.Cell('', header=True))
table.add(row)
row = m.Row()
# We align left the first column, then right.
row.add(m.Cell(tr(attributes[0]), header=True))
for attribute in attributes[1:]:
row.add(m.Cell(tr(attribute), header=True, align='right'))
table.add(row)
for field in fields:
row = m.Row()
# First column
# proper format for i186
row.add(m.Cell(
tr('%(road_type)s (m)') % {
'road_type': tr(field[0].capitalize())}))
# Start from second column
for value in field[1:]:
row.add(m.Cell(
format_int(int(value)), align='right'))
table.add(row)
impact_summary_fields = self.impact_summary['fields']
row = m.Row()
row.add(m.Cell(tr('Total (m)'), header=True))
for field in impact_summary_fields:
for value in field:
row.add(m.Cell(
format_int(int(value)),
align='right',
header=True))
table.add(row)
message.add(table)
return message
开发者ID:jobel-openscience,项目名称:inasafe,代码行数:60,代码来源:road_report_template.py
示例2: action_checklist
def action_checklist(self):
"""Action Checklist Data.
:returns: An action list in dictionary format.
:rtype: dict
"""
title = tr('Action checklist')
fields = [
tr('Which structures have warning capacity (eg. sirens, speakers, '
'etc.)?'),
tr('Are the water and electricity services still operating?'),
tr('Are the health centres still open?'),
tr('Are the other public services accessible?'),
tr('Which buildings will be evacuation centres?'),
tr('Where will we locate the operations centre?'),
tr('Where will we locate warehouse and/or distribution centres?'),
tr('Are the schools and hospitals still active?'),
]
if self.schools_closed > 0:
fields.append(tr(
'Where will the students from the %s closed schools go to '
'study?') % format_int(self.schools_closed))
if self.hospitals_closed > 0:
fields.append(tr(
'Where will the patients from the %s closed hospitals go '
'for treatment and how will we transport them?') % format_int(
self.hospitals_closed))
return {
'title': title,
'fields': fields
}
开发者ID:jobel-openscience,项目名称:inasafe,代码行数:33,代码来源:building_exposure_report_mixin.py
示例3: action_checklist
def action_checklist(self):
"""Action checklist for the itb earthquake fatality report.
:returns: The action checklist
:rtype: list
"""
total_fatalities = self.total_fatalities
total_displaced = self.total_evacuated
rounded_displaced = format_int(population_rounding(total_displaced))
fields = super(ITBFatalityFunction, self).action_checklist()
if total_fatalities:
fields.append(tr(
'Are there enough victim identification units available '
'for %s people?') % (
format_int(population_rounding(total_fatalities))))
if total_displaced:
fields.append(tr(
'Are there enough shelters and relief items available for '
'%s people?') % rounded_displaced)
if rounded_displaced:
fields.append(tr(
'If yes, where are they located and how will we '
'distribute them?'))
if total_displaced:
fields.append(tr(
'If no, where can we obtain additional relief items '
'from and how will we transport them?'))
return fields
开发者ID:easmetz,项目名称:inasafe,代码行数:30,代码来源:impact_function.py
示例4: test_volcano_circle_population_impact
def test_volcano_circle_population_impact(self):
"""Volcano function runs circular evacuation zone."""
# Name file names for hazard level, exposure and expected fatalities
hazard_filename = '%s/Merapi_alert.shp' % TESTDATA
exposure_filename = ('%s/glp10ag.asc' % EXPDATA)
# Calculate impact using API
hazard_layer = read_layer(hazard_filename)
exposure_layer = read_layer(exposure_filename)
plugin_name = 'Volcano Polygon Hazard Population'
impact_function = get_plugin(plugin_name)
impact_layer = calculate_impact(
layers=[hazard_layer, exposure_layer], impact_fcn=impact_function)
impact_filename = impact_layer.get_filename()
impact_layer = read_layer(impact_filename)
keywords = impact_layer.get_keywords()
print keywords
# This is the expected number of people affected
# Distance [km] Total Cumulative
# 3 15.800 15.800
# 5 17.300 33.100
# 10 125.000 158.000
message = 'Result not as expected'
impact_summary = keywords['impact_summary']
self.assertTrue(format_int(15800) in impact_summary, message)
self.assertTrue(format_int(17300) in impact_summary, message)
self.assertTrue(format_int(125000) in impact_summary, message)
开发者ID:severinmenard,项目名称:inasafe,代码行数:30,代码来源:test_volcano_population_evacuation_polygon.py
示例5: roads_breakdown
def roads_breakdown(self):
"""Breakdown by road type.
:returns: The roads breakdown report.
:rtype: list
"""
category_names = self.affected_road_categories
roads_breakdown_report = [({"content": (tr("Breakdown by road type")), "header": True})]
for road_type in self.road_lengths:
affected_by_usage = []
for category in category_names:
if road_type in self.affected_road_lengths[category]:
affected_by_usage.append(self.affected_road_lengths[category][road_type])
else:
affected_by_usage.append(0)
road_detail = (
# building type
[road_type.capitalize()]
+
# categories
[format_int(int(x)) for x in affected_by_usage]
+
# total
[format_int(int(self.road_lengths[road_type]))]
)
roads_breakdown_report.append({"content": road_detail})
return roads_breakdown_report
开发者ID:tomkralidis,项目名称:inasafe,代码行数:28,代码来源:road_exposure_report_mixin.py
示例6: action_checklist
def action_checklist(self):
"""Breakdown by building type.
:returns: The buildings breakdown report.
:rtype: safe.messaging.Message
"""
schools_closed = self.schools_closed
hospitals_closed = self.hospitals_closed
message = m.Message(style_class='container')
message.add(m.Heading(tr('Action checklist'), **styles.INFO_STYLE))
checklist = m.BulletedList()
checklist.add(tr('Are the critical facilities still open?'))
checklist.add(tr(
'Which structures have warning capacity (eg. sirens, speakers, '
'etc.)?'))
checklist.add(tr('Which buildings will be evacuation centres?'))
checklist.add(tr('Where will we locate the operations centre?'))
checklist.add(
tr('Where will we locate warehouse and/or distribution centres?'))
if schools_closed > 0:
checklist.add(tr(
'Where will the students from the %s closed schools '
'go to study?') % format_int(schools_closed))
if hospitals_closed > 0:
checklist.add(tr(
'Where will the patients from the %s closed hospitals go '
'for treatment and how will we transport them?') % format_int(
hospitals_closed))
message.add(checklist)
return message
开发者ID:Mloweedgar,项目名称:inasafe,代码行数:31,代码来源:building_exposure_report_mixin.py
示例7: test_earthquake_building_impact_function
def test_earthquake_building_impact_function(self):
"""Earthquake Building Impact Function works as expected."""
# Name file names for hazard level, exposure and expected fatalities
hazard_filename = '%s/eq_yogya_2006.asc' % HAZDATA
exposure_filename = '%s/OSM_building_polygons_20110905.shp' % TESTDATA
# Calculate impact using API
hazard_layer = read_layer(hazard_filename)
exposure_layer = read_layer(exposure_filename)
plugin_name = 'Earthquake Building Impact Function'
impact_function = get_plugin(plugin_name)
# Call calculation engine
impact_layer = calculate_impact(
layers=[hazard_layer, exposure_layer], impact_fcn=impact_function)
impact_filename = impact_layer.get_filename()
impact_layer = read_layer(impact_filename)
# calculated_result = I.get_data()
# print calculated_result.shape
keywords = impact_layer.get_keywords()
impact_summary = keywords['impact_summary']
# This is the expected number of building might be affected
# Hazard Level - Buildings Affected
# Low - 845
# Medium - 15524
# High - 122
message = 'Result not as expected'
self.assertTrue(format_int(845) in impact_summary, message)
self.assertTrue(format_int(15524) in impact_summary, message)
self.assertTrue(format_int(122) in impact_summary, message)
开发者ID:severinmenard,项目名称:inasafe,代码行数:33,代码来源:test_earthquake_building_impact.py
示例8: test_format_int
def test_format_int(self):
"""Test formatting integer
"""
my_int = 10000000
lang = os.getenv('LANG')
my_formated_int = format_int(my_int)
if lang == 'id':
expected_str = '10.000.000'
else:
expected_str = '10,000,000'
my_msg = 'Format integer is not valid'
assert (my_formated_int == expected_str or
my_formated_int == str(my_int)), my_msg
my_int = 1234
lang = os.getenv('LANG')
print lang
my_formated_int = format_int(my_int)
if lang == 'id':
expected_str = '1.234'
else:
expected_str = '1,234'
my_msg = 'Format integer %s is not valid' % my_formated_int
assert (my_formated_int == expected_str or
my_formated_int == str(my_int)), my_msg
开发者ID:lptorres,项目名称:noah-inasafe,代码行数:25,代码来源:test_plugin_core.py
示例9: action_checklist
def action_checklist(self):
"""Action checklist for the itb earthquake fatality report.
:returns: The action checklist
:rtype: list
"""
total_fatalities = self.total_fatalities
total_displaced = self.total_evacuated
rounded_displaced = format_int(population_rounding(total_displaced))
message = m.Message(style_class='container')
message.add(m.Heading(tr('Action checklist'), **styles.INFO_STYLE))
checklist = m.BulletedList()
if total_fatalities:
checklist.add(tr(
'Are there enough victim identification units available '
'for %s people?') % (
format_int(population_rounding(total_fatalities))))
if total_displaced:
checklist.add(tr(
'Are there enough shelters and relief items available for '
'%s people?') % rounded_displaced)
if rounded_displaced:
checklist.add(tr(
'If yes, where are they located and how will we '
'distribute them?'))
if total_displaced:
checklist.add(tr(
'If no, where can we obtain additional relief items '
'from and how will we transport them?'))
message.add(checklist)
return message
开发者ID:Mloweedgar,项目名称:inasafe,代码行数:31,代码来源:impact_function.py
示例10: notes
def notes(self):
"""Return the notes section of the report.
:return: The notes that should be attached to this impact report.
:rtype: list
"""
population = format_int(population_rounding(self.total_population))
threshold = format_int(self.parameters['evacuation_percentage'].value)
if get_needs_provenance_value(self.parameters) is None:
needs_provenance = ''
else:
needs_provenance = tr(get_needs_provenance_value(self.parameters))
fields = [
tr('Total population in the analysis area: %s') % population,
tr('<sup>1</sup>The evacuation threshold used to determine '
'population needing evacuation is %s%%.') % threshold,
needs_provenance,
]
if self.no_data_warning:
fields = fields + no_data_warning
# include any generic exposure specific notes from definitions.py
fields = fields + self.exposure_notes()
# include any generic hazard specific notes from definitions.py
fields = fields + self.hazard_notes()
return fields
开发者ID:easmetz,项目名称:inasafe,代码行数:28,代码来源:impact_function.py
示例11: _tabulate
def _tabulate(self, counts, evacuated, minimum_needs, question, rounding,
thresholds, total, no_data_warning):
# noinspection PyListCreation
table_body = [
question,
TableRow([(tr('People in %.1f m of water') % thresholds[-1]),
'%s*' % format_int(evacuated)],
header=True),
TableRow(
tr('* Number is rounded up to the nearest %s') % rounding),
TableRow(tr('Map shows the numbers of people needing evacuation'))]
total_needs = evacuated_population_needs(
evacuated, minimum_needs)
for frequency, needs in total_needs.items():
table_body.append(TableRow(
[
tr('Needs should be provided %s' % frequency),
tr('Total')
],
header=True))
for resource in needs:
table_body.append(TableRow([
tr(resource['table name']),
format_int(resource['amount'])]))
table_body.append(TableRow(tr('Action Checklist:'), header=True))
table_body.append(TableRow(tr('How will warnings be disseminated?')))
table_body.append(TableRow(tr('How will we reach stranded people?')))
table_body.append(TableRow(tr('Do we have enough relief items?')))
table_body.append(TableRow(tr('If yes, where are they located and how '
'will we distribute them?')))
table_body.append(TableRow(tr(
'If no, where can we obtain additional relief items from and how '
'will we transport them to here?')))
# Extend impact report for on-screen display
table_body.extend([
TableRow(tr('Notes'), header=True),
tr('Total population: %s') % format_int(total),
tr('People need evacuation if tsunami levels exceed %(eps).1f m') %
{'eps': thresholds[-1]},
tr('Minimum needs are defined in BNPB regulation 7/2008'),
tr('All values are rounded up to the nearest integer in order to '
'avoid representing human lives as fractions.')])
if len(counts) > 1:
table_body.append(TableRow(tr('Detailed breakdown'), header=True))
for i, val in enumerate(counts[:-1]):
s = (tr('People in %(lo).1f m to %(hi).1f m of water: %(val)i')
% {'lo': thresholds[i],
'hi': thresholds[i + 1],
'val': format_int(val[0])})
table_body.append(TableRow(s))
if no_data_warning:
table_body.extend([
tr('The layers contained `no data`. This missing data was '
'carried through to the impact layer.'),
tr('`No data` values in the impact layer were treated as 0 '
'when counting the affected or total population.')
])
return table_body, total_needs
开发者ID:Charlotte-Morgan,项目名称:inasafe,代码行数:60,代码来源:impact_function.py
示例12: hazard_table
def hazard_table(self, hazard_table):
""" Return updated hazard table.
:param hazard_table: hazard table.
:type hazard_table: Table
:returns hazard_table: Updated Hazard Table
:rtype area_name: Table
"""
hazard_table.caption = None
for key, value in self.hazard_levels.iteritems():
name = self.hazard_class_mapping[key][0]
# This skips reporting people not affected in No zone
if key == 'wet':
row = m.Row()
row.add(m.Cell(tr(
'People within hazard field ("%s") of value "%s"')
% (self.hazard_class_field, name),
header=True))
value = format_int(population_rounding(value))
row.add(m.Cell(value, align='right'))
elif key == 'dry':
continue
else:
row = m.Row()
row.add(m.Cell(name, header=True))
value = format_int(population_rounding(value))
row.add(m.Cell(value, align='right'))
hazard_table.add(row)
# Total affected population
row = m.Row()
row.add(m.Cell(
tr('Total affected people'),
header=True))
affected = format_int(
population_rounding(self.total_affected_population))
row.add(m.Cell(affected, align='right'))
hazard_table.add(row)
# Non affected population
row = m.Row()
unaffected = format_int(
population_rounding(self.unaffected_population))
row.add(m.Cell(tr('Unaffected people'), header=True))
row.add(m.Cell(unaffected, align='right'))
hazard_table.add(row)
# Total Population
row = m.Row()
total_population = format_int(
population_rounding(self.total_population))
row.add(m.Cell(tr('Total people'), header=True))
row.add(m.Cell(total_population, align='right'))
hazard_table.add(row)
return hazard_table
开发者ID:codeforresilience,项目名称:inasafe,代码行数:59,代码来源:polygon_population_exposure_report_mixin.py
示例13: impact_summary
def impact_summary(self):
"""The impact summary as per category
:returns: The impact summary.
:rtype: safe.message.Message
"""
affected_categories = self.affected_road_categories
message = m.Message(style_class='container')
table = m.Table(style_class='table table-condensed table-striped')
table.caption = None
row = m.Row()
row.add(m.Cell(tr('Summary by road type'), header=True))
for _ in affected_categories:
# Add empty cell as many as affected_categories
row.add(m.Cell('', header=True))
if self.add_unaffected_column:
# Add empty cell for un-affected road
row.add(m.Cell('', header=True))
# Add empty cell for total column
row.add(m.Cell('', header=True))
table.add(row)
row = m.Row()
row.add(m.Cell(tr('Road Type'), header=True))
for affected_category in affected_categories:
row.add(m.Cell(affected_category, header=True, align='right'))
if self.add_unaffected_column:
row.add(m.Cell(tr('Unaffected'), header=True, align='right'))
row.add(m.Cell(tr('Total'), header=True, align='right'))
table.add(row)
total_affected = [0] * len(affected_categories)
for (category, road_breakdown) in self.affected_road_lengths.items():
number_affected = sum(road_breakdown.values())
count = affected_categories.index(category)
total_affected[count] = number_affected
row = m.Row()
row.add(m.Cell(tr('All (m)')))
for total_affected_value in total_affected:
row.add(m.Cell(
format_int(int(total_affected_value)), align='right'))
if self.add_unaffected_column:
row.add(m.Cell(format_int(int(
self.total_road_length - sum(total_affected))), align='right'))
row.add(m.Cell(format_int(int(self.total_road_length)), align='right'))
table.add(row)
message.add(table)
return message
开发者ID:codeforresilience,项目名称:inasafe,代码行数:58,代码来源:road_exposure_report_mixin.py
示例14: notes
def notes(self):
"""Return the notes section of the report.
:return: The notes that should be attached to this impact report.
:rtype: list
"""
notes = [
{'content': tr('Notes'), 'header': True},
{
'content': tr('Total population: %s') % format_int(
population_rounding(self.total_population))
},
{
'content': tr(
'<sup>1</sup>The evacuation threshold used to determine '
'population needing evacuation is %s%%.'),
'arguments': format_int(
self.parameters['evacuation_percentage'].value)
},
{
'content': tr(
''
'are within any polygons.'),
'condition': not self.use_affected_field
},
{
'content': tr(
'The layers contained `no data`. This missing data was '
'carried through to the impact layer.'),
'condition': self.no_data_warning
},
{
'content': tr(
'`No data` values in the impact layer were treated as 0 '
'when counting the affected or total population.'),
'condition': self.no_data_warning
},
{
'content': get_needs_provenance_value(self.parameters)
},
{
'content': tr(
'All values are rounded up to the nearest integer in '
'order to avoid representing human lives as fractions.'),
},
{
'content': tr(
'Population rounding is applied to all population '
'values, which may cause discrepancies when adding '
'values.'
)
}
]
return notes
开发者ID:tomkralidis,项目名称:inasafe,代码行数:54,代码来源:impact_function.py
示例15: impact_row
def impact_row(
area_name,
affected,
percent_affected,
single_total_area,
number_people_affected,
percent_people_affected,
area_population):
"""Adds the calculated results into respective impact row
:param area_name: Area Name
:type area_name: str
:param affected: table with first and second row
:type affected: Table
:param percent_affected: percentage of affected area
:type percent_affected: float
:param single_total_area: total area of the land
:type single_total_area: float
:param number_people_affected: number of people affected
:type number_people_affected: float
:param percent_people_affected: percentage of people affected
in the area
:type percent_people_affected: float
:param area_population: Population of the area
:type area_population: float
:return row: the new impact row
:rtype row: Row
"""
row = m.Row()
row.add(m.Cell(area_name))
row.add(m.Cell(format_int(int(affected)), align='right'))
row.add(m.Cell(
"%.1f%%" % percent_affected, align='right'))
row.add(m.Cell(
format_int(int(single_total_area)), align='right'))
row.add(m.Cell(
format_int(int(number_people_affected)),
align='right'))
row.add(m.Cell("%.1f%%" % percent_people_affected, align='right'))
row.add(m.Cell(
format_int(int(area_population)),
align='right'))
return row
开发者ID:easmetz,项目名称:inasafe,代码行数:52,代码来源:polygon_people_report_template.py
示例16: impact_summary
def impact_summary(self):
"""Create impact summary as data.
:returns: Impact Summary in dictionary format.
:rtype: dict
"""
attributes = ['category', 'value']
fields = []
# Breakdown by hazard level (if available)
if len(self.impact_category_ordering):
for category in self.impact_category_ordering:
population_in_category = self.lookup_category(category)
population_in_category = format_int(population_rounding(
population_in_category
))
row = [tr(category), population_in_category]
fields.append(row)
# Total affected population
row = [
tr('Total affected population'),
format_int(population_rounding(self.total_affected_population))
]
fields.append(row)
# Non affected population
row = [
tr('Unaffected population'),
format_int(population_rounding(self.unaffected_population))
]
fields.append(row)
# Total Population
row = [
tr('Total population'),
format_int(population_rounding(self.total_population))
]
fields.append(row)
# Population needing evacuation
row = [
tr('Population needing evacuation <sup>1</sup>'),
format_int(population_rounding(self.total_evacuated))
]
fields.append(row)
return {
'attributes': attributes,
'fields': fields
}
开发者ID:jobel-openscience,项目名称:inasafe,代码行数:51,代码来源:population_exposure_report_mixin.py
示例17: format_postprocessing
def format_postprocessing(self):
"""Format postprocessing.
:returns: The postprocessing.
:rtype: safe.messaging.Message
"""
if not self.postprocessing:
return False
message = m.Message()
for k, v in self.postprocessing.items():
table = m.Table(
style_class='table table-condensed table-striped')
table.caption = v['caption']
attributes = v['attributes']
if attributes:
header = m.Row()
# Bold and align left the 1st one.
header.add(m.Cell(attributes[0], header=True, align='left'))
for attribute in attributes[1:]:
# Bold and align right.
header.add(m.Cell(attribute, header=True, align='right'))
header.add(m.Cell('Total', header=True, align='right'))
table.add(header)
for field in v['fields']:
row = m.Row()
# First column is string
row.add(m.Cell(field[0]))
total = 0
for value in field[1:]:
try:
val = int(value)
total += val
# Align right integers.
row.add(m.Cell(format_int(val), align='right'))
except ValueError:
# Catch no data value. Align left strings.
row.add(m.Cell(value, align='left'))
row.add(m.Cell(
format_int(int(round(total))), align='right'))
table.add(row)
message.add(table)
for note in v['notes']:
message.add(m.EmphasizedText(note))
return message
开发者ID:jobel-openscience,项目名称:inasafe,代码行数:51,代码来源:abstract_road_building_report_template.py
示例18: impact_summary
def impact_summary(self):
"""The impact summary as per category.
:returns: The impact summary.
:rtype: safe.messaging.Message
"""
affect_types = self._impact_breakdown
message = m.Message(style_class='container')
table = m.Table(style_class='table table-condensed table-striped')
table.caption = None
row = m.Row()
row.add(m.Cell('', header=True)) # intentionally empty top left cell
row.add(m.Cell('Buildings affected', header=True))
for (category, building_breakdown) in self.affected_buildings.items():
total_affected = [0] * len(affect_types)
for affected_breakdown in building_breakdown.values():
for affect_type, number_affected in affected_breakdown.items():
count = affect_types.index(affect_type)
total_affected[count] += number_affected
row = m.Row()
row.add(m.Cell(tr(category), header=True))
for affected in total_affected:
row.add(m.Cell(format_int(affected), align='right'))
table.add(row)
if len(self._affected_categories) > 1:
row = m.Row()
row.add(m.Cell(tr('Affected buildings'), header=True))
row.add(m.Cell(
format_int(self.total_affected_buildings), align='right'))
table.add(row)
# Only show not affected building row if the IF does not use custom
# affected categories
if self._affected_categories == self.affected_buildings.keys():
row = m.Row()
row.add(m.Cell(tr('Not affected buildings'), header=True))
row.add(m.Cell(
format_int(self.total_unaffected_buildings), align='right'))
table.add(row)
row = m.Row()
row.add(m.Cell(tr('Total'), header=True))
row.add(m.Cell(
format_int(self.total_buildings), align='right'))
table.add(row)
message.add(table)
return message
开发者ID:codeforresilience,项目名称:inasafe,代码行数:48,代码来源:building_exposure_report_mixin.py
示例19: notes
def notes(self):
"""Return the notes section of the report.
:return: The notes that should be attached to this impact report.
:rtype: safe.messaging.Message
"""
message = m.Message(style_class="container")
message.add(m.Heading(tr("Notes and assumptions"), **styles.INFO_STYLE))
checklist = m.BulletedList()
population = format_int(population_rounding(self.total_population))
checklist.add(tr("Total population in the analysis area: %s") % population)
checklist.add(tr("<sup>1</sup>People need evacuation if they are in a " "hazard zone."))
checklist.add(tr("Map shows population count in high, medium, and low " "hazard areas."))
checklist.add(
tr(
"All values are rounded up to the nearest integer in "
"order to avoid representing human lives as fractions."
)
)
checklist.add(
tr(
"Population rounding is applied to all population "
"values, which may cause discrepancies when adding values."
)
)
message.add(checklist)
return message
开发者ID:codeforresilience,项目名称:inasafe,代码行数:27,代码来源:impact_function.py
示例20: _append_result
def _append_result(self, name, result, metadata=None):
"""add an indicator results to the postprocessors result.
internal method to be used by the postprocessors to add an indicator
results to the postprocessors result
Args:
* name: str the name of the indicator
* result the value calculated by the indicator
* metadata Dict of metadata
Returns:
None
Raises:
None
"""
if metadata is None:
metadata = dict()
# LOGGER.debug('name : ' + str(name) + '\nresult : ' + str(result))
if result is not None and result != self.NO_DATA_TEXT:
try:
result = format_int(result)
except ValueError as e:
LOGGER.debug(e)
result = result
self._results[name] = {'value': result,
'metadata': metadata}
开发者ID:opengeogroep,项目名称:inasafe,代码行数:27,代码来源:abstract_postprocessor.py
注:本文中的safe.common.utilities.format_int函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论