Financial Data Classes¶
Data models for the financial elements of the tool.
ActivityNpv
dataclass
¶
ActivityNpv(value_info=None, component=None, prefix='', base_name='', suffix='', path='', skip_raster=False, enabled=True)
Bases: ConstantRasterComponent
Mapping of the NPV parameters to the corresponding activity.
activity
property
writable
¶
Wrapper for legacy support returning the activity model.
Returns:
| Type | Description |
|---|---|
Activity
|
The activity if defined else None. |
activity_id
property
¶
Gets the identifier of the activity model.
Returns:
| Type | Description |
|---|---|
str
|
The unique identifier of the activity model else an empty string if no activity has been set. |
computed_base_name
property
¶
Returns a proposed name for the activity NPV.
An empty string will be return id the activity attribute
is not set.
Returns:
| Type | Description |
|---|---|
str
|
Proposed base name for the activity NPV. |
params
property
writable
¶
Wrapper for legacy support returning the activity's parameters object.
Returns:
| Type | Description |
|---|---|
NpvParameters
|
The activity's parameters object or None if not specified. |
ActivityNpvCollection
dataclass
¶
ActivityNpvCollection(min_value=0.0, max_value=1.0, component_type=None, components=list(), skip_raster=False, allowable_max=sys.float_info.max, allowable_min=0.0, last_updated='', use_manual=False)
Bases: ConstantRasterCollection
Collection for all ActivityNpv configurations that have been specified by the user.
mappings
property
writable
¶
Get the mapping of activity NPVs.
This is a wrapper only used for legacy support.
Returns:
| Type | Description |
|---|---|
typing.List[ActivityNpv]
|
List of activity NPV mappings. |
activity_npv ¶
Gets the mapping of an activity's NPV mapping if defined.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
activity_identifier |
str
|
Unique identifier of an activity whose NPV mapping is to be retrieved. |
required |
Returns:
| Type | Description |
|---|---|
ActivityNpv
|
The activity's NPV mapping else None if not found. |
Source code in src/cplus_plugin/models/financial.py
normalize ¶
Normalize minimum and maximum values of the valid mappings in the collection.
Overrides base class implementation.
normalize_npvs ¶
Normalize the NPV values of activity using the specified normalization range.
If the absolute NPV values are less than or greater than the
normalization range, then they will be truncated to 0.0 and 1.0
respectively. To avoid such a situation from occurring, it is recommended
to make sure that the ranges are synchronized using the latest absolute
NPV values by calling update_computed_normalization_range before
normalizing the NPVs.
If there is only one NPV mapping, then assign a normalized value of 1.0.
Returns:
| Type | Description |
|---|---|
bool
|
True if the NPVs were successfully normalized else False due to various reasons such as if the minimum value is greater than the maximum value, if the min/max values are the same, or if there are no NPV mappings. |
Source code in src/cplus_plugin/models/financial.py
update_computed_normalization_range ¶
Update the minimum and maximum normalization values based on the absolute values of the existing ActivityNpv objects.
Values for disabled activity NPVs will be excluded from the computation.
Returns:
| Type | Description |
|---|---|
bool
|
True if the min/max values were updated else False if there are no mappings or valid absolute NPV values defined. |