|
17 | 17 | "\n", |
18 | 18 | " * tag (Tag): information about the source data\n", |
19 | 19 | " * years (np.array): years\n", |
20 | | - " * rates (np.array): discount rates for each year (between 0 and 1)" |
21 | | - ] |
22 | | - }, |
23 | | - { |
24 | | - "cell_type": "code", |
25 | | - "execution_count": 1, |
26 | | - "metadata": { |
27 | | - "ExecuteTime": { |
28 | | - "end_time": "2021-10-15T12:25:12.663121Z", |
29 | | - "start_time": "2021-10-15T12:25:08.668156Z" |
30 | | - } |
31 | | - }, |
32 | | - "outputs": [ |
33 | | - { |
34 | | - "name": "stdout", |
35 | | - "output_type": "stream", |
36 | | - "text": [ |
37 | | - "Help on class DiscRates in module climada.entity.disc_rates.base:\n", |
38 | | - "\n", |
39 | | - "class DiscRates(builtins.object)\n", |
40 | | - " | DiscRates(years: Optional[numpy.ndarray] = None, rates: Optional[numpy.ndarray] = None)\n", |
41 | | - " | \n", |
42 | | - " | Defines discount rates and basic methods. Loads from\n", |
43 | | - " | files with format defined in FILE_EXT.\n", |
44 | | - " | \n", |
45 | | - " | Attributes\n", |
46 | | - " | ---------\n", |
47 | | - " | years: np.array\n", |
48 | | - " | list of years\n", |
49 | | - " | rates: np.array\n", |
50 | | - " | list of discount rates for each year (between 0 and 1)\n", |
51 | | - " | \n", |
52 | | - " | Methods defined here:\n", |
53 | | - " | \n", |
54 | | - " | __init__(self, years: Optional[numpy.ndarray] = None, rates: Optional[numpy.ndarray] = None)\n", |
55 | | - " | Fill discount rates with values and check consistency data\n", |
56 | | - " | \n", |
57 | | - " | Parameters\n", |
58 | | - " | ----------\n", |
59 | | - " | years : numpy.ndarray(int)\n", |
60 | | - " | Array of years. Default is numpy.array([]).\n", |
61 | | - " | rates : numpy.ndarray(float)\n", |
62 | | - " | Discount rates for each year in years.\n", |
63 | | - " | Default is numpy.array([]).\n", |
64 | | - " | Note: rates given in float, e.g., to set 1% rate use 0.01\n", |
65 | | - " | \n", |
66 | | - " | append(self, disc_rates)\n", |
67 | | - " | Check and append discount rates to current DiscRates. Overwrite\n", |
68 | | - " | discount rate if same year.\n", |
69 | | - " | \n", |
70 | | - " | Parameters\n", |
71 | | - " | ----------\n", |
72 | | - " | disc_rates: climada.entity.DiscRates\n", |
73 | | - " | DiscRates instance to append\n", |
74 | | - " | \n", |
75 | | - " | Raises\n", |
76 | | - " | ------\n", |
77 | | - " | ValueError\n", |
78 | | - " | \n", |
79 | | - " | check(self)\n", |
80 | | - " | Check attributes consistency.\n", |
81 | | - " | \n", |
82 | | - " | Raises\n", |
83 | | - " | ------\n", |
84 | | - " | ValueError\n", |
85 | | - " | \n", |
86 | | - " | clear(self)\n", |
87 | | - " | Reinitialize attributes.\n", |
88 | | - " | \n", |
89 | | - " | net_present_value(self, ini_year, end_year, val_years)\n", |
90 | | - " | Compute net present value between present year and future year.\n", |
91 | | - " | \n", |
92 | | - " | Parameters\n", |
93 | | - " | ----------\n", |
94 | | - " | ini_year: float\n", |
95 | | - " | initial year\n", |
96 | | - " | end_year: float\n", |
97 | | - " | end year\n", |
98 | | - " | val_years: np.array\n", |
99 | | - " | cash flow at each year btw ini_year and end_year (both included)\n", |
100 | | - " | \n", |
101 | | - " | Returns\n", |
102 | | - " | -------\n", |
103 | | - " | net_present_value: float\n", |
104 | | - " | net present value between present year and future year.\n", |
105 | | - " | \n", |
106 | | - " | plot(self, axis=None, figsize=(6, 8), **kwargs)\n", |
107 | | - " | Plot discount rates per year.\n", |
108 | | - " | \n", |
109 | | - " | Parameters\n", |
110 | | - " | ----------\n", |
111 | | - " | axis: matplotlib.axes._subplots.AxesSubplot, optional\n", |
112 | | - " | axis to use\n", |
113 | | - " | figsize: tuple(int, int), optional\n", |
114 | | - " | size of the figure. The default is (6,8)\n", |
115 | | - " | kwargs: optional\n", |
116 | | - " | keyword arguments passed to plotting function axis.plot\n", |
117 | | - " | \n", |
118 | | - " | Returns\n", |
119 | | - " | -------\n", |
120 | | - " | axis: matplotlib.axes._subplots.AxesSubplot\n", |
121 | | - " | axis handles of the plot\n", |
122 | | - " | \n", |
123 | | - " | read_excel(self, *args, **kwargs)\n", |
124 | | - " | This function is deprecated, use DiscRates.from_excel instead.\n", |
125 | | - " | \n", |
126 | | - " | read_mat(self, *args, **kwargs)\n", |
127 | | - " | This function is deprecated, use DiscRates.from_mats instead.\n", |
128 | | - " | \n", |
129 | | - " | select(self, year_range)\n", |
130 | | - " | Select discount rates in given years.\n", |
131 | | - " | \n", |
132 | | - " | Parameters\n", |
133 | | - " | ----------\n", |
134 | | - " | year_range: np.array(int)\n", |
135 | | - " | continuous sequence of selected years.\n", |
136 | | - " | \n", |
137 | | - " | Returns: climada.entity.DiscRates\n", |
138 | | - " | The selected discrates in the year_range\n", |
139 | | - " | \n", |
140 | | - " | write_excel(self, file_name, var_names=None)\n", |
141 | | - " | Write excel file following template.\n", |
142 | | - " | \n", |
143 | | - " | Parameters\n", |
144 | | - " | ----------\n", |
145 | | - " | file_name: str\n", |
146 | | - " | filename including path and extension\n", |
147 | | - " | var_names: dict, optional\n", |
148 | | - " | name of the variables in the file. The Default is\n", |
149 | | - " | \n", |
150 | | - " | >>> DEF_VAR_EXCEL = {\n", |
151 | | - " | ... 'sheet_name': 'discount',\n", |
152 | | - " | ... 'col_name': {\n", |
153 | | - " | ... 'year': 'year',\n", |
154 | | - " | ... 'disc': 'discount_rate',\n", |
155 | | - " | ... }\n", |
156 | | - " | ... }\n", |
157 | | - " | \n", |
158 | | - " | ----------------------------------------------------------------------\n", |
159 | | - " | Class methods defined here:\n", |
160 | | - " | \n", |
161 | | - " | from_excel(file_name, var_names=None) from builtins.type\n", |
162 | | - " | Read excel file following template and store variables.\n", |
163 | | - " | \n", |
164 | | - " | Parameters\n", |
165 | | - " | ----------\n", |
166 | | - " | file_name: str\n", |
167 | | - " | filename including path and extension\n", |
168 | | - " | description: str, optional\n", |
169 | | - " | description of the data. The default is ''\n", |
170 | | - " | var_names: dict, optional\n", |
171 | | - " | name of the variables in the file. The Default is\n", |
172 | | - " | \n", |
173 | | - " | >>> DEF_VAR_EXCEL = {\n", |
174 | | - " | ... 'sheet_name': 'discount',\n", |
175 | | - " | ... 'col_name': {\n", |
176 | | - " | ... 'year': 'year',\n", |
177 | | - " | ... 'disc': 'discount_rate',\n", |
178 | | - " | ... }\n", |
179 | | - " | ... }\n", |
180 | | - " | \n", |
181 | | - " | Returns\n", |
182 | | - " | -------\n", |
183 | | - " | climada.entity.DiscRates :\n", |
184 | | - " | The disc rates from excel\n", |
185 | | - " | \n", |
186 | | - " | from_mat(file_name, var_names=None) from builtins.type\n", |
187 | | - " | Read MATLAB file generated with previous MATLAB CLIMADA version.\n", |
188 | | - " | \n", |
189 | | - " | Parameters\n", |
190 | | - " | ----------\n", |
191 | | - " | file_name: str\n", |
192 | | - " | filename including path and extension\n", |
193 | | - " | description: str, optional\n", |
194 | | - " | description of the data. The default is ''\n", |
195 | | - " | var_names: dict, optional\n", |
196 | | - " | name of the variables in the file. Default:\n", |
197 | | - " | \n", |
198 | | - " | >>> DEF_VAR_MAT = {\n", |
199 | | - " | ... 'sup_field_name': 'entity',\n", |
200 | | - " | ... 'field_name': 'discount',\n", |
201 | | - " | ... 'var_name': {\n", |
202 | | - " | ... 'year': 'year',\n", |
203 | | - " | ... 'disc': 'discount_rate',\n", |
204 | | - " | ... }\n", |
205 | | - " | ... }\n", |
206 | | - " | \n", |
207 | | - " | Returns\n", |
208 | | - " | -------\n", |
209 | | - " | climada.entity.DiscRates :\n", |
210 | | - " | The disc rates from matlab\n", |
211 | | - " | \n", |
212 | | - " | ----------------------------------------------------------------------\n", |
213 | | - " | Data descriptors defined here:\n", |
214 | | - " | \n", |
215 | | - " | __dict__\n", |
216 | | - " | dictionary for instance variables (if defined)\n", |
217 | | - " | \n", |
218 | | - " | __weakref__\n", |
219 | | - " | list of weak references to the object (if defined)\n", |
220 | | - "\n" |
221 | | - ] |
222 | | - } |
223 | | - ], |
224 | | - "source": [ |
225 | | - "from climada.entity import DiscRates\n", |
226 | | - "help(DiscRates)" |
| 20 | + " * rates (np.array): discount rates for each year (between 0 and 1)\n", |
| 21 | + "\n", |
| 22 | + "For a complete class documentation, refer to the Python modules docs: {py:class}`climada.entity.disc_rates.base.DiscRates`" |
227 | 23 | ] |
228 | 24 | }, |
229 | 25 | { |
|
0 commit comments