Etl
ETL TOOL BOX
- Abstracted transformations (Transformation, register_etl)
- ETL registry (list of named conversions)
- pre-defined conversions (convert_loads, technoeconomic_data)
Transformation
dataclass
Data class representing the YAML config for the ETL target
Source code in src/rpycpl/etl.py
37 38 39 40 41 42 43 44 45 46 47 |
|
build_tech_groups(frames, map_param='investment')
Wrapper for the utils.build_tech_map function
Source code in src/rpycpl/etl.py
50 51 52 53 |
|
convert_loads(loads, region=None)
conversion for loads
Parameters:
Name | Type | Description | Default |
---|---|---|---|
loads
|
dict
|
dictionary of dataframes with loads |
required |
region
|
(str, Optional)
|
region to filter the data by |
None
|
Returns: pd.DataFrame: converted loads (year: load type, value in Mwh)
Source code in src/rpycpl/etl.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
convert_remind_capacities(frames, cutoff=0, region=None)
conversion for capacities
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frames
|
dict
|
dictionary of dataframes with capacities |
required |
region
|
(str, Optional)
|
region to filter the data by |
None
|
cutoff
|
(int, Optional)
|
min capacity in MW |
0
|
Returns: pd.DataFrame: converted capacities (year: load type, value in Mwh)
Source code in src/rpycpl/etl.py
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 |
|
harmonize_capacities(pypsa_capacities, remind_capacities)
Harmonize the REMIND and PyPSA capacities - scale down the pypsa capacities to not exceed the remind capacities - where REMIND exceeds the pypsa capacities, calculate a paid-off capacity which will be added to the pypsa model as zero-capex techs. The model can allocate it where it sees fit but the total is constrained
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pypsa_capacities
|
dict[str, DataFrame]
|
Dictionary with the pypsa capacities {year: powerplantmatching_capacities}. |
required |
remind_capacities
|
DataFrame
|
DataFrame with the remind capacities for all years |
required |
Returns: dict[str, pd.DataFrame]: Dictionary with the harmonized capacities {year: harmonized_capacities}.
Source code in src/rpycpl/etl.py
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 |
|
paidoff_capacities(remind_capacities, harmonized_pypsa_caps)
Wrapper for the capacities_etl.calc_paid_off_capacity function.
Calculate the additional paid-off capacity available to PyPSA from REMIND investment decisions. The paid-off capacity is the difference between the REMIND capacities and the harmonized PyPSA capacities. The paid-off capacity is available to PyPSA as a zero-capex tech.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
remind_capacities
|
DataFrame
|
DataFrame with REMIND capacities in MW. |
required |
harmonized_pypsa_caps
|
dict[str, DataFrame]
|
Dictionary with harmonized PyPSA capacities by year (capped to REMIND cap) |
required |
Returns: pd.DataFrame: DataFrame with the available paid-off capacity by tech group.
Source code in src/rpycpl/etl.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
|
register_etl(name)
decorator factory to register ETL functions
Source code in src/rpycpl/etl.py
26 27 28 29 30 31 32 33 |
|
technoeconomic_data(frames, mappings, pypsa_costs, currency_conversion, years=None)
Mapping adapted from Johannes Hemp, based on csv mapping table
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frames
|
Dict[str, DataFrame]
|
dictionary of remind frames |
required |
mappings
|
DataFrame
|
the mapping dataframe |
required |
pypsa_costs
|
DataFrame
|
pypsa costs dataframe |
required |
currency_conversion
|
float
|
conversion factor for the currency |
required |
years
|
Optional[list]
|
years to consider, if None REMIND capex years is used |
None
|
Returns: pd.DataFrame: dataframe with the mapped techno-economic data
Source code in src/rpycpl/etl.py
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 |
|