This is the concrete Minimum Needs class that contains the logic to load the minimum needs to and from the QSettings


Bases: safe.common.minimum_needs.MinimumNeeds

The concrete MinimumNeeds class to be used in a QGIS environment.

In the case where we assume QGIS we use the QSettings object to store the minimum needs.

New in version 2.2..

static format_sentence(sentence, resource)[source]

Populate the placeholders in the sentence.

  • sentence (basestring, str) – The sentence with placeholder keywords.
  • resource (dict) – The resource to be placed into the sentence.

The formatted sentence.

Return type:



Get the minimum needs resources in parameter format

Returns:The minimum needs resources wrapped in parameters.
Return type:list

Get all the minimum needs profiles.

Returns:The minimum needs by name.
Return type:list

Load the minimum needs.

If the minimum needs defined in QSettings use it, if not, get the most relevant available minimum needs (based on QGIS locale). The last thing to do is to just use the default minimum needs.


Load a specific profile into the current minimum needs.

Parameters:profile (basestring, str) – The profile’s name

The number of digits after the decimal will be counted and used as returned as the precision.

Parameters:number_as_text (basestring) – A textual representation of the number whose precision we wish to determine.
Returns:The precision of the passed in textual representation of a number.
Return type:int

The provenance that is provided with the loaded profile.

Returns:The provenance.
Return type:str

Remove a profile.

Parameters:profile (basestring, str) – The profile to be removed.

Get the home root directory

Returns:root directory
Return type:QString

Save the minimum needs to the QSettings object.


Save the current minimum needs into a new profile.

Parameters:profile (basestring, str) – The profile’s name[source]

Add minimum needs to an impact functions parameters.

Parameters:parameters (dict) – A dictionary of impact function parameters.
Returns:A dictionary of parameters with minimum needs appended.
Return type:dict[source]

Get all minimum needs parameters.

Parameters:parameter_list (list) – A list of parameters
Returns:A list of ResourceParameter
Return type:list[source]

Get the provenance of minimum needs.

Parameters:parameters (dict) – A dictionary of impact function parameters.
Returns:A parameter of provenance
Return type:TextParameter[source]

Get the value of provenance.

Parameters:parameters (dict) – A dictionary of impact function parameters.
Returns:A string value of provenance
Return type:str