11
11
12
12
13
13
# Function to get GEA based cost reduction data
14
- def get_cost_reduction_data (input_module ) -> pd .DataFrame :
14
+ def get_cost_reduction_data (module ) -> pd .DataFrame :
15
15
"""Get cost reduction data
16
16
17
17
Raw data on cost reduction in 2100 for technologies are read from \
@@ -45,10 +45,10 @@ def get_cost_reduction_data(input_module) -> pd.DataFrame:
45
45
.reset_index (drop = 1 )
46
46
)
47
47
48
- if input_module == "base" :
48
+ if module == "base" :
49
49
return base_rates
50
50
51
- elif input_module == "materials" :
51
+ elif module == "materials" :
52
52
# Read in materials technology mapping file
53
53
materials_file_path = package_data_path ("costs" , "technology_materials_map.csv" )
54
54
df_materials_tech = pd .read_csv (materials_file_path )
@@ -78,9 +78,7 @@ def get_cost_reduction_data(input_module) -> pd.DataFrame:
78
78
79
79
80
80
# Function to get technology learning scenarios data
81
- def get_technology_learning_scenarios_data (
82
- input_base_year , input_module
83
- ) -> pd .DataFrame :
81
+ def get_technology_learning_scenarios_data (base_year , module ) -> pd .DataFrame :
84
82
"""Read in technology first year and learning scenarios data
85
83
86
84
Raw data on technology first year and learning scenarios are read from \
@@ -90,7 +88,7 @@ def get_technology_learning_scenarios_data(
90
88
91
89
Parameters
92
90
----------
93
- input_base_year : int, optional
91
+ base_year : int, optional
94
92
The base year, by default set to global BASE_YEAR
95
93
96
94
Returns
@@ -109,9 +107,9 @@ def get_technology_learning_scenarios_data(
109
107
pd .read_csv (file )
110
108
.assign (
111
109
first_technology_year = lambda x : np .where (
112
- x .first_year_original > input_base_year ,
110
+ x .first_year_original > base_year ,
113
111
x .first_year_original ,
114
- input_base_year ,
112
+ base_year ,
115
113
),
116
114
)
117
115
.drop (columns = ["first_year_original" ])
@@ -122,10 +120,10 @@ def get_technology_learning_scenarios_data(
122
120
)
123
121
)
124
122
125
- if input_module == "base" :
123
+ if module == "base" :
126
124
return base_learn
127
125
128
- elif input_module == "materials" :
126
+ elif module == "materials" :
129
127
# Read in materials technology mapping file
130
128
materials_file_path = package_data_path ("costs" , "technology_materials_map.csv" )
131
129
df_materials_tech = pd .read_csv (materials_file_path )
@@ -157,10 +155,10 @@ def get_technology_learning_scenarios_data(
157
155
# Function to project reference region investment cost using learning rates
158
156
def project_ref_region_inv_costs_using_learning_rates (
159
157
regional_diff_df : pd .DataFrame ,
160
- input_node ,
161
- input_ref_region ,
162
- input_base_year ,
163
- input_module ,
158
+ node ,
159
+ ref_region ,
160
+ base_year ,
161
+ module ,
164
162
) -> pd .DataFrame :
165
163
"""Project investment costs using learning rates for reference region
166
164
@@ -172,11 +170,11 @@ def project_ref_region_inv_costs_using_learning_rates(
172
170
----------
173
171
regional_diff_df : pandas.DataFrame
174
172
Dataframe output from :func:`get_weo_region_differentiated_costs`
175
- input_node : str, optional
173
+ node : str, optional
176
174
The reference node, by default "r12"
177
- input_ref_region : str, optional
175
+ ref_region : str, optional
178
176
The reference region, by default None (defaults set in function)
179
- input_base_year : int, optional
177
+ base_year : int, optional
180
178
The base year, by default set to global BASE_YEAR
181
179
182
180
Returns
@@ -191,21 +189,21 @@ def project_ref_region_inv_costs_using_learning_rates(
191
189
"""
192
190
193
191
# Set default reference region
194
- if input_ref_region is None :
195
- if input_node .upper () == "R11" :
192
+ if ref_region is None :
193
+ if node .upper () == "R11" :
196
194
reference_region = "R11_NAM"
197
- if input_node .upper () == "R12" :
195
+ if node .upper () == "R12" :
198
196
reference_region = "R12_NAM"
199
- if input_node .upper () == "R20" :
197
+ if node .upper () == "R20" :
200
198
reference_region = "R20_NAM"
201
199
else :
202
- reference_region = input_ref_region
200
+ reference_region = ref_region
203
201
204
202
# Get cost reduction data
205
- df_cost_reduction = get_cost_reduction_data (input_module )
203
+ df_cost_reduction = get_cost_reduction_data (module )
206
204
207
205
# Get learning rates data
208
- df_learning = get_technology_learning_scenarios_data (input_base_year , input_module )
206
+ df_learning = get_technology_learning_scenarios_data (base_year , module )
209
207
210
208
# Merge cost reduction data with learning rates data
211
209
df_learning_reduction = df_learning .merge (
@@ -221,7 +219,7 @@ def project_ref_region_inv_costs_using_learning_rates(
221
219
cost_region_2100 = lambda x : x .reg_cost_base_year
222
220
- (x .reg_cost_base_year * x .cost_reduction ),
223
221
b = lambda x : (1 - PRE_LAST_YEAR_RATE ) * x .cost_region_2100 ,
224
- r = lambda x : (1 / (LAST_MODEL_YEAR - input_base_year ))
222
+ r = lambda x : (1 / (LAST_MODEL_YEAR - base_year ))
225
223
* np .log ((x .cost_region_2100 - x .b ) / (x .reg_cost_base_year - x .b )),
226
224
reference_region = reference_region ,
227
225
)
0 commit comments