InaSAFE Disaster risk assessment tool developed by AusAid - Impact Function Base Class
Contact : ole.moller.nielsen@gmail.com
Note
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Bases: object
Abstract base class for all impact functions.
Property for the actual extent for analysis.
Returns: | A list in the form [xmin, ymin, xmax, ymax]. |
---|---|
Return type: | list |
Property for the actual extent crs for analysis.
Returns: | A number representing the EPSG code for the CRS. e.g. 4326 |
---|---|
Return type: | int |
Property for the aggregation layer to be used for the analysis.
Returns: | A map layer. |
---|---|
Return type: | SafeLayer |
Property for the callback used to relay processing progress.
Returns: | A callback function. The callback function will have the
following parameter requirements. progress_callback(current, maximum, message=None) |
---|---|
Return type: | function |
See also
console_progress_callback
Simple console based callback implementation for tests.
Parameters: |
|
---|
Property for the exposure layer to be used for the analysis.
Returns: | A map layer. |
---|---|
Return type: | SafeLayer |
Property for function category based on hazard categories.
Function category could be ‘single_event’ or/and ‘multiple_event’. Single event data type means that the data is captured by a single observation, while ‘multiple_event’ has been aggregated for some observations.
Returns: | The hazard categories that this function supports. |
---|---|
Return type: | list |
Property for the type of impact function (‘old-style’ or ‘qgis2.0’).
QGIS2 impact functions are using the QGIS api and have more dependencies. Legacy IF’s use only numpy, gdal etc. and can be used in contexts where no QGIS is present.
Property for the hazard layer to be used for the analysis.
Returns: | A map layer. |
---|---|
Return type: | SafeLayer |
Property for the host name that runs this.
Returns: | The host name. |
---|---|
Return type: | basestring |
Property for the impact layer generated by the analysis.
Note
It is not guaranteed that all impact functions produce a spatial layer.
Returns: | A map layer. |
---|---|
Return type: | QgsMapLayer, QgsVectorLayer, QgsRasterLayer |
Prepare this impact function for running the analysis.
This method should normally be called in your concrete class’s run method before it attempts to do any real processing. This method will do any needed house keeping such as:
- checking that the exposure and hazard layers sufficiently
overlap (post 3.1) * clipping or subselecting features from both layers such that
only features / coverage within the actual analysis extent will be analysed (post 3.1)
- raising errors if any untenable condition exists e.g. extent has no valid CRS. (post 3.1)
We suggest to overload this method in your concrete class implementation so that it includes any impact function specific checks too.
#
Formulate the question for this impact function.
This method produces a natural language question for this impact function derived from the following three inputs:
- descriptive name of the hazard layer e.g. ‘a flood like in
January 2004’
descriptive name of the exposure layer e.g. ‘people’
- question statement in the impact function metadata e.g.
‘will be affected’.
These inputs will be concatenated into a string e.g.:
“In the event of a flood like in January 2004, how many people will be affected.”
Property for the extent of impact function analysis.
Returns: | A list in the form [xmin, ymin, xmax, ymax]. |
---|---|
Return type: | list |
Property for the extent CRS of impact function analysis.
Returns: | A number representing the EPSG code for the CRS. e.g. 4326 |
---|---|
Return type: | int |
Check to clip or not to clip layers.
If function type is a ‘qgis2.0’ impact function, then return False – clipping is unnecessary, else return True.
Returns: | To clip or not to clip. |
---|---|
Return type: | bool |
Property for the style for the impact layer.
This property is read only.
Returns: | A dictionary containing the analysis style. Generally this should be an adjunct to the qml style applied to the impact layer so that other types of style (e.g. SLD) can be generated for the impact layer. |
---|---|
Return type: | dict |
Property for the result (excluding GIS layer) of the analysis.
This property is read only.
Returns: | A dictionary containing the analysis results. The format of
the dictionary may vary between impact function but the following
sections are expected:
The returned dictionary is probably best described with a simple example: Example to follow here....
|
---|---|
Return type: | dict |
Property for the target_field of the impact layer.
Returns: | The target field in the impact layer in case it’s a vector. |
---|---|
Return type: | basestring |