本文整理汇总了Python中safe.impact_function.impact_function.ImpactFunction.notes方法的典型用法代码示例。如果您正苦于以下问题:Python ImpactFunction.notes方法的具体用法?Python ImpactFunction.notes怎么用?Python ImpactFunction.notes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类safe.impact_function.impact_function.ImpactFunction
的用法示例。
在下文中一共展示了ImpactFunction.notes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_provenance_without_aggregation
# 需要导入模块: from safe.impact_function.impact_function import ImpactFunction [as 别名]
# 或者: from safe.impact_function.impact_function.ImpactFunction import notes [as 别名]
def test_provenance_without_aggregation(self):
"""Test provenance of impact function without aggregation."""
hazard_layer = load_test_vector_layer(
'gisv4', 'hazard', 'classified_vector.geojson')
exposure_layer = load_test_vector_layer(
'gisv4', 'exposure', 'building-points.geojson')
hazard = definition(hazard_layer.keywords['hazard'])
exposure = definition(exposure_layer.keywords['exposure'])
hazard_category = definition(hazard_layer.keywords['hazard_category'])
expected_provenance = {
'gdal_version': gdal.__version__,
'host_name': gethostname(),
'map_title': get_map_title(hazard, exposure, hazard_category),
'map_legend_title': exposure['layer_legend_title'],
'inasafe_version': get_version(),
'pyqt_version': PYQT_VERSION_STR,
'qgis_version': QGis.QGIS_VERSION,
'qt_version': QT_VERSION_STR,
'user': getpass.getuser(),
'os': readable_os_version(),
'aggregation_layer': None,
'aggregation_layer_id': None,
'exposure_layer': exposure_layer.source(),
'exposure_layer_id': exposure_layer.id(),
'hazard_layer': hazard_layer.source(),
'hazard_layer_id': hazard_layer.id(),
'analysis_question': get_analysis_question(hazard, exposure),
'aggregation_keywords': None,
'exposure_keywords': deepcopy(exposure_layer.keywords),
'hazard_keywords': deepcopy(hazard_layer.keywords),
}
# Set up impact function
impact_function = ImpactFunction()
impact_function.exposure = exposure_layer
impact_function.hazard = hazard_layer
status, message = impact_function.prepare()
self.assertEqual(PREPARE_SUCCESS, status, message)
status, message = impact_function.run()
self.assertEqual(ANALYSIS_SUCCESS, status, message)
self.maxDiff = None
expected_provenance.update({
'action_checklist': impact_function.action_checklist(),
'analysis_extent': impact_function.analysis_extent.exportToWkt(),
'impact_function_name': impact_function.name,
'impact_function_title': impact_function.title,
'notes': impact_function.notes(),
'requested_extent': impact_function.requested_extent,
'data_store_uri': impact_function.datastore.uri_path,
'start_datetime': impact_function.start_datetime,
'end_datetime': impact_function.end_datetime,
'duration': impact_function.duration
})
self.assertDictEqual(expected_provenance, impact_function.provenance)
示例2: test_provenance_without_aggregation
# 需要导入模块: from safe.impact_function.impact_function import ImpactFunction [as 别名]
# 或者: from safe.impact_function.impact_function.ImpactFunction import notes [as 别名]
def test_provenance_without_aggregation(self):
"""Test provenance of impact function without aggregation."""
hazard_layer = load_test_vector_layer(
'gisv4', 'hazard', 'classified_vector.geojson')
exposure_layer = load_test_vector_layer(
'gisv4', 'exposure', 'building-points.geojson')
hazard = definition(hazard_layer.keywords['hazard'])
exposure = definition(exposure_layer.keywords['exposure'])
hazard_category = definition(hazard_layer.keywords['hazard_category'])
expected_provenance = {
provenance_gdal_version['provenance_key']: gdal.__version__,
provenance_host_name['provenance_key']: gethostname(),
provenance_map_title['provenance_key']: get_map_title(
hazard, exposure, hazard_category),
provenance_map_legend_title['provenance_key']: exposure[
'layer_legend_title'],
provenance_user['provenance_key']: getpass.getuser(),
provenance_os['provenance_key']: readable_os_version(),
provenance_pyqt_version['provenance_key']: PYQT_VERSION_STR,
provenance_qgis_version['provenance_key']: QGis.QGIS_VERSION,
provenance_qt_version['provenance_key']: QT_VERSION_STR,
provenance_inasafe_version['provenance_key']: get_version(),
provenance_aggregation_layer['provenance_key']: None,
provenance_aggregation_layer_id['provenance_key']: None,
provenance_exposure_layer['provenance_key']:
exposure_layer.source(),
provenance_exposure_layer_id['provenance_key']:
exposure_layer.id(),
provenance_hazard_layer['provenance_key']: hazard_layer.source(),
provenance_hazard_layer_id['provenance_key']: hazard_layer.id(),
provenance_analysis_question['provenance_key']:
get_analysis_question(hazard, exposure),
provenance_aggregation_keywords['provenance_key']: None,
provenance_exposure_keywords['provenance_key']:
deepcopy(exposure_layer.keywords),
provenance_hazard_keywords['provenance_key']: deepcopy(
hazard_layer.keywords),
}
# Set up impact function
impact_function = ImpactFunction()
impact_function.exposure = exposure_layer
impact_function.hazard = hazard_layer
status, message = impact_function.prepare()
self.assertEqual(PREPARE_SUCCESS, status, message)
status, message = impact_function.run()
self.assertEqual(ANALYSIS_SUCCESS, status, message)
self.maxDiff = None
expected_provenance.update({
provenance_action_checklist['provenance_key']:
impact_function.action_checklist(),
provenance_analysis_extent['provenance_key']:
impact_function.analysis_extent.exportToWkt(),
provenance_impact_function_name['provenance_key']:
impact_function.name,
provenance_impact_function_title['provenance_key']:
impact_function.title,
provenance_notes['provenance_key']: impact_function.notes(),
provenance_requested_extent['provenance_key']: impact_function.
requested_extent,
provenance_data_store_uri['provenance_key']: impact_function.
datastore.uri_path,
provenance_start_datetime['provenance_key']: impact_function.
start_datetime,
provenance_end_datetime['provenance_key']:
impact_function.end_datetime,
provenance_duration['provenance_key']: impact_function.duration
})
self.assertDictContainsSubset(
expected_provenance, impact_function.provenance)
output_layer_provenance_keys = [
provenance_layer_exposure_summary['provenance_key'],
provenance_layer_aggregate_hazard_impacted['provenance_key'],
provenance_layer_aggregation_summary['provenance_key'],
provenance_layer_analysis_impacted['provenance_key'],
provenance_layer_exposure_summary_table['provenance_key']
]
for key in output_layer_provenance_keys:
self.assertIn(key, impact_function.provenance.keys())