Financial Helper Functions¶
Contains functions for financial computations.
calculate_activity_npv ¶
Determines the total NPV of an activity by calculating the individual NPV of the NCS pathways that constitute the activity.
The NPV per hectare for an NCS pathway is determined based on the value specified in the NPV PWL Manager.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
activity_id |
str
|
The ID of the specific activity. The function will check whether the NPV rate had been defined for pathways that constitute the activity. |
required |
activity_area |
float
|
The area of the activity in hectares. |
required |
Returns:
Type | Description |
---|---|
float
|
Returns the total NPV of the activity, or -1.0 if the activity does not exist or if found, lacks pathways or if the NPV rate for all pathways has not been specified. |
Source code in src/cplus_plugin/lib/financials.py
compute_discount_value ¶
Calculates the discounted value for the given year.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
revenue |
float
|
Projected total revenue. |
required |
cost |
float
|
Projected total costs. |
required |
year |
int
|
Relative year i.e. between 1 and 99. |
required |
discount |
float
|
Discount value as a percent i.e. between 0 and 100. |
required |
Returns:
Type | Description |
---|---|
float
|
The discounted value for the given year. |
Source code in src/cplus_plugin/lib/financials.py
create_npv_pwls ¶
create_npv_pwls(npv_collection, context, multi_step_feedback, feedback, target_crs_id, target_pixel_size, target_extent, on_finish_func=None, on_removed_func=None)
Creates constant raster layers based on the normalized NPV values for the specified NCS pathways.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
npv_collection |
NcsPathwayNpvCollection
|
The NCS pathway NPV collection containing the NPV parameters for NCS pathway. |
required |
context |
QgsProcessingContext
|
Context information for performing the processing. |
required |
multi_step_feedback |
QgsProcessingMultiStepFeedback
|
Feedback for updating the status of processing. |
required |
feedback |
QgsProcessingFeedback
|
Underlying feedback object for communicating to the caller. |
required |
target_crs_id |
str
|
CRS identifier of the target layers. |
required |
target_pixel_size |
float
|
Pixel size of the target layer: |
required |
target_extent |
str
|
Extent of the output layer as xmin, xmax, ymin, ymax. |
required |
on_finish_func |
Callable
|
Function to be executed when a constant raster has been created. |
None
|
on_removed_func |
Callable
|
Function to be executed when a disabled NPV PWL has been removed. |
None
|
Returns:
Type | Description |
---|---|
list
|
A list containing the processing results (as a dictionary) for each successful run. |
Source code in src/cplus_plugin/lib/financials.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|