Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorb1 committed Jan 24, 2024
2 parents e465305 + 5f9bf67 commit 9e1fc18
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 20 deletions.
6 changes: 5 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ sphinx:
formats:
- pdf

build:
os: ubuntu-22.04
tools:
python: "3.11"

python:
version: 3.8
install:
- requirements: docs/requirements.txt
- {path: ., method: pip}
4 changes: 2 additions & 2 deletions docs/advanced-functionality.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ are identified by being named in files with all capitals (ie. REGION.csv).
Restart the workflow, which will build and solve the model, through the command:

```bash
snakemake -c
snakemake -j6
```

## Custom Nodes
Expand Down Expand Up @@ -134,7 +134,7 @@ geographic_scope:
Then run the workflow as normal from the root directory

```bash
snakemake -c
snakemake -j6
```

## Interactive Dashboard
Expand Down
18 changes: 9 additions & 9 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,18 @@ the configuration file at `config/config.yaml`
**Goal**: Run the workflow with default settings. This will produce a model
of India from 2015 to 2050 with 8 time slices per year, and solve it using CBC.

1. Run the command `snakemake -c`. The time to build and solve the model will
1. Run the command `snakemake -j6`. The time to build and solve the model will
vary depending on your computer, but in general, this example will finish
within minutes .

```bash
(osemosys-global) ~/osemosys_global$ snakemake -c
(osemosys-global) ~/osemosys_global$ snakemake -j6
```

:::{tip}
The `-c` command will instruct Snakemake to use all available computer
cores. If your want to restrict this, input a number after the `-c` to
specify the number of cores. For example, the command `snakemake -c2` will
The `-j6` command will instruct Snakemake to use six cores.
If your want to restrict this, change the number after the `-j` to
specify the number of cores. For example, the command `snakemake -j2` will
run the workflow using 2 cores. See
[snakemake's documentation](https://snakemake.readthedocs.io/en/stable/executing/cli.html#useful-command-line-arguments)
for more information.
Expand Down Expand Up @@ -254,10 +254,10 @@ are inclusive.
emission_penalty: 50
```
8. Run the command `snakemake -c`
8. Run the command `snakemake -j6`
```bash
(osemosys-global) ~/osemosys_global$ snakemake -c
(osemosys-global) ~/osemosys_global$ snakemake -j6
```
:::{tip}
Expand Down Expand Up @@ -438,15 +438,15 @@ The goal of this scenario is to run a World scenario from 2015 to 2050 with
solver: 'cplex'
```

8. Run the command `snakemake -c`
8. Run the command `snakemake -j6`

:::{warning}
This scenario will take multiple hours to run using a commercial solver
(Gurobi or CPLEX) on a high performance computer.
:::

```bash
(osemosys-global) ~/osemosys_global$ snakemake -c
(osemosys-global) ~/osemosys_global$ snakemake -j6
```

8. View system level results in the `results/WORLD/figures` folder
Expand Down
6 changes: 3 additions & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ pytest
world-bank-data
scikit-learn
myst-parser
"otoole>=1.0.0"
otoole>=1.0.0, <1.1.0
scipy
dash
geos
cartopy

# docs
myst-parser
pydata-sphinx-theme==0.8.1
sphinx-book-theme==0.3.3
pydata-sphinx-theme>=0.8.1
sphinx-book-theme>=0.3.3
docutils==0.17.1
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ install_requires =
otoole>=1.0.0,<1.1.0
scipy
dash
pydata-sphinx-theme==0.8.1
sphinx-book-theme==0.3.3
docutils==0.17.1
pydata-sphinx-theme>=0.8.1
sphinx-book-theme>=0.3.3
docutils>=0.17.1

[options.packages.find]
where = workflow/scripts
Expand Down
24 changes: 24 additions & 0 deletions workflow/scripts/osemosys_global/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,28 @@
"TECHNOLOGY":str,
"TIMESLICE":str,
"YEAR":int,
}

COLORS = {
"BIO":"darkgreen",
"CCG":"lightcoral",
"COA":"black",
"COG":"peru",
"CSP":"wheat",
"ELC":"gold",
"GAS":"orange",
"GEO":"darkseagreen",
"HYD":"dodgerblue",
"OCG":"firebrick",
"OIL":"lightgrey",
"OTH":"teal",
"PET":"grey",
"SOL":"gold",
"SPV":"gold",
"URN":"mediumseagreen",
"WAS":"darkkhaki",
"WAV":"navy",
"WOF":"violet",
"WON":"blueviolet",
"INT":"darkgreen",
}
13 changes: 11 additions & 2 deletions workflow/scripts/osemosys_global/visualise.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from osemosys_global.utils import read_csv, filter_transmission_techs
from osemosys_global.visualisation.utils import get_color_codes, get_map, plot_map_trn_line, plot_map_text, load_node_data_demand_center
from osemosys_global.visualisation.data import get_total_capacity_data, get_generation_annual_data, get_generation_ts_data
# from osemosys_global.configuration import ConfigFile, ConfigPaths
import osemosys_global.constants as constants
from configuration import ConfigFile, ConfigPaths


Expand Down Expand Up @@ -76,7 +76,8 @@ def plot_total_capacity(data: Dict[str,pd.DataFrame], save_dir: str, country:str
"""

df = get_total_capacity_data(data, country=country)
plot_colors = get_color_codes()
# plot_colors = get_color_codes()
plot_colors = constants.COLORS

if not country: # System level titles
graph_title = 'Total System Capacity'
Expand Down Expand Up @@ -218,6 +219,10 @@ def plot_transmission_capacity(
# get result data
total_cap_annual = result_data["TotalCapacityAnnual"]
trn = filter_transmission_techs(total_cap_annual)

if trn.empty:
return

trn.VALUE = trn.VALUE.astype('float64')
trn['FROM'], trn['TO'] = trn.TECHNOLOGY.str[3:8], trn.TECHNOLOGY.str[8:]

Expand Down Expand Up @@ -310,6 +315,10 @@ def plot_transmission_flow(
# get result data
production_annual = result_data["ProductionByTechnologyAnnual"]
prd = filter_transmission_techs(production_annual)

if prd.empty:
return

prd.VALUE = prd.VALUE.astype('float64')
prd['FROM'], prd['TO'] = prd.TECHNOLOGY.str[3:8], prd.TECHNOLOGY.str[8:]

Expand Down

0 comments on commit 9e1fc18

Please sign in to comment.