Skip to content

Commit

Permalink
Merge pull request #44 from yerbol-akhmetov/maintenance_fix
Browse files Browse the repository at this point in the history
Maintenance fix
  • Loading branch information
yerbol-akhmetov authored Aug 11, 2024
2 parents 77c2f27 + afed1f3 commit 363a18b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 10 deletions.
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ Used for [2024 study](https://www.agora-energiewende.org/publications/modernisin
[![License: AGPL v3](https://img.shields.io/badge/License-AGPLv3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
[![REUSE status](https://api.reuse.software/badge/github.com/pypsa-meets-earth/pypsa-kz-data)](https://api.reuse.software/info/github.com/pypsa-meets-earth/pypsa-kz-data)

# pypsa-kz-data
# PyPSA-KZ-Data

<img src="https://github.com/user-attachments/assets/cced2eb3-7d14-4f21-ae1a-2e0ca9174ea6" alt="Kazakhstan Generation Capacities">

Extra data for the Kazakhstan model that will be used as input for PyPSA-Earth.
Repo design oriented on: https://github.com/pypsa-meets-earth/pypsa-zm-data

Expand All @@ -42,7 +45,7 @@ Monthly electricity demand data with monthly aggregation provided by Kazakhstan

## Setting up the general repositories

The provided workflow builds on [PyPSA-Earth](https://github.com/pypsa-meets-earth/pypsa-earth). Therefore, first, the PyPSA-Earth repository must be forked and the fork should then be cloned. A fork can be created by navigating to the [PyPSA-Earth](https://github.com/pypsa-meets-earth/pypsa-earth) website. By clicking on the fork-symbol in the upper right corner, a fork is created and linked to the specific user.
The provided workflow builds on [PyPSA-Earth](https://github.com/pypsa-meets-earth/pypsa-earth). Therefore, first, the PyPSA-Earth repository must be forked and the fork should then be cloned. A fork can be created by navigating to the [PyPSA-Earth](https://github.com/pypsa-meets-earth/pypsa-earth) website. By clicking on the fork-symbol in the upper right corner, a fork is created and linked to the specific user. While making a fork, unclick `Copy the main branch only` option to fork all branches and tags of `pypsa-earth` repository.

Next, we also need to fork the [pypsa-kz-data](https://github.com/pypsa-meets-earth/pypsa-kz-data) repository. A fork can be created by navigating to the [pypsa-kz-data](https://github.com/pypsa-meets-earth/pypsa-kz-data) website and clicking the fork symbol in the upper right corner.

Expand All @@ -56,7 +59,11 @@ After that, one must change to the freshly created pypsa-earth repository.
```bash
cd pypsa-earth/
```
and repeat the cloning, this time for the pypsa-kz-data repository.
Switch to the stable `v0.4.0` version of `pypsa-earth` that is compatible with `pypsa-kz-data` repository:
```bash
git checkout tags/v0.4.0
```
Repeat the cloning, this time for the pypsa-kz-data repository.
```bash
git clone https://github.com/<user-name>/pypsa-kz-data
```
Expand All @@ -72,7 +79,7 @@ conda activate pypsa-earth

To adapt the overall workflow for kz, only two further changes are necessary.

Firstly, open the Snakefile (in `pypsa-earth/`) and navigate to line [1057-1058](https://github.com/pypsa-meets-earth/pypsa-earth/blob/main/Snakefile#L1057-L1058), which should read
Firstly, open the Snakefile (in `pypsa-earth/`) and navigate to line [1071-1072](https://github.com/pypsa-meets-earth/pypsa-earth/blob/main/Snakefile#L1057-L1058), which should read
```bash
os.system("snakemake -j all solve_all_networks --rerun-incomplete")
os.system("snakemake -j1 make_statistics --force")
Expand All @@ -92,7 +99,7 @@ In case you already have a custom config file, make sure to replace it as well,
```bash
cp pypsa-kz-data/config.kz_default.yaml config.yaml
```

**Note!** Run two aforementioned commands in `pypsa-earth` directory.
You are now all set to run all scenarios!

## Running KZ scenarios
Expand Down Expand Up @@ -132,6 +139,8 @@ snakemake -j 1 retrieve_databundle_light

- The rule `retrieve_databundle_light` always executes with an error. To avoid this, try setting `enable: build_cutout: False` to `True`.

- Hydrobasins data might not be accessible in some regions (e.g. in Kazakhstan). It is recommended to retrieve the databundle using VPN.

# Comes in handy
After all cutouts were generated (i.e. the three files `asia-<year>-era5.nc` exist in the folder `pypsa-earth/cutouts/`, where `<year>` is 2011, 2013, and 2018, navigate to `pypsa-earth/pypsa-kz-data`, open the default config file, navigate to line 36, which should read `build_cutout: True`, and set it to `build_cutout: false`. This will save you a lot of time when (re-)runnig scenarios. But remember to set it back to `true` in case one of the cutouts was deleted!

Expand Down
28 changes: 23 additions & 5 deletions config.kz_default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: AGPL-3.0-or-later

version: 1.0.0
version: 0.4.0
tutorial: false

logging:
Expand Down Expand Up @@ -101,6 +101,12 @@ clean_osm_data_options: # osm = OpenStreetMap
tag_substation: "transmission" # Filters only substations with 'transmission' tag, ('distribution' also available)
add_line_endings: true # When "True", then line endings are added to the dataset of the substations
generator_name_method: OSM # Methodology to specify the name to the generator. Options: OSM (name as by OSM dataset), closest_city (name by the closest city)
use_custom_lines: "OSM_only" # Use OSM (OSM_only), customized (custom_only), or both data sets (add_custom)
path_custom_lines: false # If exists, provide the specific absolute path of the custom file e.g. (...\data\custom_lines.geojson)
use_custom_substations: "OSM_only" # Use OSM (OSM_only), customized (custom_only), or both data sets (add_custom)
path_custom_substations: false # If exists, provide the specific absolute path of the custom file e.g. (...\data\custom_substations.geojson)
use_custom_cables: "OSM_only" # Use OSM (OSM_only), customized (custom_only), or both data sets (add_custom)
path_custom_cables: false # If exists, provide the specific absolute path of the custom file e.g. (...\data\custom_cables.geojson)

build_osm_network: # Options of the build_osm_network script; osm = OpenStreetMap
group_close_buses: true # When "True", close buses are merged and guarantee the voltage matching among line endings
Expand Down Expand Up @@ -128,6 +134,8 @@ electricity:
co2base: 3.17e+8 # Kazakhstan default for 1990
agg_p_nom_limits: data/agg_p_nom_minmax.csv
hvdc_as_lines: false # should HVDC lines be modeled as `Line` or as `Link` component?
automatic_emission: false
automatic_emission_base_year: 1990 # 1990 is taken as default. Any year from 1970 to 2018 can be selected.
BAU_maxcapacities:
solar: 1e9 # essentially no limit
onwind: 1e9 # essentially no limit
Expand Down Expand Up @@ -170,11 +178,12 @@ electricity:
PV: [solar]

lines:
types:
ac_types:
220.: "490-AL1/64-ST1A 220.0" #"Al/St 240/40 2-bundle 220.0"
110.: "243-AL1/39-ST1A 110.0" #"Al/St 240/40 3-bundle 300.0"
500.: "Al/St 240/40 4-bundle 380.0" #"Al/St 560/50 4-bundle 750.0" #
dc_type: "HVDC XLPE 1000"
dc_types:
500.: "HVDC XLPE 1000"
s_max_pu: 0.7
s_nom_max: .inf
length_factor: 1.25
Expand Down Expand Up @@ -297,9 +306,10 @@ renewable:
extendable: true
hydro:
cutout: asia-2013-era5
hydrobasins_level: 6
resource:
method: hydro
hydrobasins: data/hydrobasins/hybas_world_lev06_v1c.shp
hydrobasins: data/hydrobasins/hybas_world.shp
flowspeed: 1.0 # m/s
# weight_with_height: false
# show_progress: true
Expand Down Expand Up @@ -440,13 +450,21 @@ plotting:
"electricity": "#f9d002"
"lines": "#70af1d"
"transmission lines": "#70af1d"
"AC": "#70af1d"
"AC-AC": "#70af1d"
"AC line": "#70af1d"
"links": "#8a1caf"
"HVDC links": "#8a1caf"
"DC": "#8a1caf"
"DC-DC": "#8a1caf"
"DC link": "#8a1caf"
"load": "#FF0000"
"load": "#ff0000"
"load shedding": "#ff0000"
"battery discharger": slategray
"battery charger": slategray
"h2 fuel cell": '#c251ae'
"h2 electrolysis": '#ff29d9'
"csp": "#fdd404"
nice_names:
OCGT: "Open-Cycle Gas"
CCGT: "Combined-Cycle Gas"
Expand Down

0 comments on commit 363a18b

Please sign in to comment.