safe.impact_functions.core module

Function to manage self-registering plugins.

The design is based on http://effbot.org/zone/metaclass-plugins.htm

To register the plugin, the module must be imported by the Python process using it.

InaSAFE Disaster risk assessment tool developed by AusAid -
IS Utilities implementation.

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.

safe.impact_functions.core.evacuated_population_needs(population, minimum_needs)[source]

Calculate estimated needs using minimum needs configuration provided in full_minimum_needs.

Parameters:
  • population – The number of evacuated population.
  • minimum_needs (list) – Ratios to use when calculating minimum needs. Defaults to perka 7 as described in assumptions below.
Type:

int, float

Returns:

The needs for the evacuated population.

Return type:

dict

safe.impact_functions.core.evacuated_population_weekly_needs(population, minimum_needs=None)[source]

Calculate estimated needs using minimum needs as specified or the default.

Parameters:
  • population – The number of evacuated population.
  • minimum_needs (list,) – Ratios used to calculate weekly needs in parameter form.
Type:

int, float

Returns:

The needs for the evacuated population.

Return type:

dict

safe.impact_functions.core.get_key_for_value(value, value_map)[source]

Obtain the key of a value from a value map.

Parameters:
  • value (int, str, float) – The value mapped to a key in value_map.
  • value_map (dict) – A value mapping.
Returns:

A key for the value.

Return type:

str

safe.impact_functions.core.has_no_data(layer_data)[source]

Determine whether or not a layer contains nan values. :param layer_data: Layer data that is to be inspected. :type layer_data: ndarry :return: The True if there is nodata in layer_data. :rtype: bool

safe.impact_functions.core.population_rounding(number)[source]

A shorthand for population_rounding_full(number)[0].

Parameters:number (int, float) – The amount of people as calculated.
Returns:result and rounding bracket.
Return type:int
safe.impact_functions.core.population_rounding_full(number)[source]

This function performs a rigorous population rounding.

Parameters:number (int, float) – The amount of people as calculated.
Returns:result and rounding bracket.
Return type:(int, int)