Build powerplants
Build the existing capacities for each node from GEM (global energy monitor) tracker data. This script is intended for use as part of the Snakemake workflow.
The GEM data has to be downloaded manually and placed in the source directory of the snakemake rule. download page: https://globalenergymonitor.org/projects/global-integrated-power-tracker/download-data/
Nodes can be assigned to specific GEM IDs based on their GPS location or administrative region location.
assign_node_from_gps(gem_data, nodes)
Assign plant node based on GPS coordinates of the plant. Will cause issues if the nodes tolerance is too low
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gem_data
|
DataFrame
|
GEM data |
required |
nodes
|
GeoDataFrame
|
node geometries (nodes as index). |
required |
Returns: pd.DataFrame: DataFrame with assigned nodes.
Source code in workflow/scripts/build_powerplants.py
clean_gem_data(gem_data, gem_cfg)
Clean the GEM data by - mapping GEM types onto pypsa types - filtering for relevant project statuses - cleaning invalid entries (e.g "not found"->nan)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gem_data
|
DataFrame
|
GEM dataset. |
required |
gem_cfg
|
dict
|
Configuration dictionary, 'global_energy_monitor.yaml' |
required |
Returns: pd.DataFrame: Cleaned GEM data.
Source code in workflow/scripts/build_powerplants.py
group_by_year(df, year_bins, base_year=2020)
Group the DataFrame by year bins.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df
|
DataFrame
|
DataFrame with a 'Start year' column. |
required |
year_bins
|
list
|
List of year bins to group by. |
required |
base_year
|
int
|
cut-off for histirocal period. Default is 2020. |
2020
|
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: DataFrame with a new 'grouping_year' column. |
Source code in workflow/scripts/build_powerplants.py
load_gem_excel(path, sheetname='Units', country_col='Country/area', country_names=['China'])
Load a Global Energy monitor excel file as a dataframe.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
PathLike
|
Path to the Excel file. |
required |
sheetname
|
str
|
Name of the sheet to load. Default is "Units". |
'Units'
|
country_col
|
str
|
Column name for country names. Default is "Country/area". |
'Country/area'
|
country_names
|
list
|
List of country names to filter by. Default is ["China"]. |
['China']
|