InaSAFE Disaster risk assessment tool developed by AusAid - Aggregator.
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: PyQt4.QtCore.QObject
The aggregator class facilitates aggregation of impact function results.
Do any requested aggregation post processing.
Performs Aggregation postprocessing step by
- creating a copy of the data set clipped by the impact layer bounding box
- stripping all attributes beside the aggregation attribute
- delegating to the appropriate aggregator for raster and vectors
Parameters: | safe_impact_layer (read_layer) – The layer that will be aggregated. |
---|---|
Raises: | ReadLayerError |
It is a wrapper around self._keyword_io.copy_keywords
Parameters: |
|
---|---|
Raises: | All exceptions are propagated. |
Ensure there are no intersecting features with self.layer.
This should only happen after initial checks have been made.
Note
Buildings are not split up by this method.
Raises: | InsufficientParametersError if hazard_layer or exposure_layer is not set. |
---|
It is a wrapper around self._defaults. Returns default attribute keyword.
Parameters: | keyword (str) – A string containing the keyword to be returned for the layer. |
---|---|
Returns: | The value for the given key if it is present. |
Return type: | str |
Raises: | All exceptions are propagated. |
It is a wrapper around self._keyword_io.read_keywords
Parameters: | layer (QgsMapLayer) – Layer you want to get the keywords for. |
---|---|
Returns: | KeywordIO.get_statistics object |
Return type: | KeywordIO.get_statistics |
Raises: | All exceptions are propagated. |
It is a wrapper around self._keyword_io.read_keywords
Parameters: |
|
---|---|
Returns: | KeywordIO.read_keywords object |
Return type: | KeywordIO.read_keywords |
Raises: | All exceptions are propagated. |
Adapt from processing.runalg with our own Processing.
Parameters: |
|
---|---|
Returns: | The ouput of the algorithm. |
Return type: | dict |
Set up aggregator layers
Parameters: |
|
---|
Set field name for the sum column.
Parameters: | value (string) – A name of sum field |
---|---|
Returns: | None |
It is a wrapper around self._keyword_io.update_keywords
Parameters: |
|
---|---|
Raises: | All exceptions are propagated. |
Check if the postprocessing layer has all needed attribute keywords.
This is only applicable in the case where were are not using the AOI (in other words self.aoi_mode is False). When self.aoi_mode is True then we always use just the defaults and don’t allow the user to create custom aggregation field mappings.
This method is called on instance creation and should always be called if you change any state of the aggregator class.
On completion of this method the self.is_valid flag is set. If this flag is not True, then no aggregation or postprocessing work will be carried out (these methods will raise an InvalidAggregatorError).