Skip to content

Commit 8fe3b4b

Browse files
authored
Merge pull request #503 from EnergySystemsModellingLab/develop
Update main branch
2 parents 0992038 + c6da41d commit 8fe3b4b

990 files changed

Lines changed: 5945 additions & 37649 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.2.0
2+
current_version = 1.2.1
33
commit = True
44
tag = True
55

.github/workflows/pre-commit_autoupdate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/checkout@v4
1212
- uses: actions/setup-python@v5
1313
- uses: browniebroke/pre-commit-autoupdate-action@main
14-
- uses: peter-evans/create-pull-request@v6
14+
- uses: peter-evans/create-pull-request@v7
1515
with:
1616
token: ${{ secrets.GITHUB_TOKEN }}
1717
branch: update/pre-commit-hooks

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
- id: trailing-whitespace
1010
- id: end-of-file-fixer
1111
- repo: https://github.com/astral-sh/ruff-pre-commit
12-
rev: v0.5.2
12+
rev: v0.6.7
1313
hooks:
1414
- id: ruff-format
1515
types_or: [python, pyi, jupyter]

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ authors:
99
given-names: Adam
1010

1111
title: MUSE_OS
12-
version: v1.2.0
12+
version: v1.2.1
1313
date-released: 2024-08-13

docs/advanced-guide/extending-muse.ipynb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@
9191
"source": [
9292
"from typing import Optional\n",
9393
"\n",
94-
"from muse.outputs.sector import market_quantity, register_output_quantity\n",
9594
"from xarray import DataArray, Dataset\n",
9695
"\n",
96+
"from muse.outputs.sector import market_quantity, register_output_quantity\n",
97+
"\n",
9798
"\n",
9899
"@register_output_quantity\n",
99100
"def consumption_zero(\n",
@@ -156,6 +157,7 @@
156157
"[[sectors.residential.outputs]]\n",
157158
"quantity = \"consumption_zero\"\n",
158159
"sink = \"txt\"\n",
160+
"overwrite = true\n",
159161
"filename = \"{cwd}/{default_output_dir}/{Sector}{Quantity}{year}{suffix}\"\n",
160162
"```\n",
161163
"\n",
@@ -181,9 +183,10 @@
181183
"source": [
182184
"from pathlib import Path\n",
183185
"\n",
184-
"from muse import examples\n",
185186
"from toml import dump, load\n",
186187
"\n",
188+
"from muse import examples\n",
189+
"\n",
187190
"model_path = examples.copy_model(name=\"default_retro\", overwrite=True)\n",
188191
"settings = load(model_path / \"settings.toml\")\n",
189192
"new_output = {\n",
@@ -192,7 +195,7 @@
192195
" \"overwrite\": True,\n",
193196
" \"filename\": \"{cwd}/{default_output_dir}/{Sector}{Quantity}{year}{suffix}\",\n",
194197
"}\n",
195-
"settings[\"sectors\"][\"residential\"][\"outputs\"].append(new_output)\n",
198+
"settings[\"sectors\"][\"residential\"].setdefault(\"outputs\", []).append(new_output)\n",
196199
"dump(settings, (model_path / \"modified_settings.toml\").open(\"w\"))\n",
197200
"settings"
198201
]
@@ -289,6 +292,7 @@
289292
"\n",
290293
"import pandas as pd\n",
291294
"import xarray as xr\n",
295+
"\n",
292296
"from muse.outputs.cache import consolidate_quantity, register_cached_quantity\n",
293297
"\n",
294298
"\n",
@@ -361,15 +365,15 @@
361365
"source": [
362366
"from pathlib import Path\n",
363367
"\n",
364-
"from muse import examples\n",
365368
"from toml import dump, load\n",
366369
"\n",
370+
"from muse import examples\n",
371+
"\n",
367372
"model_path = examples.copy_model(name=\"default_retro\", overwrite=True)\n",
368373
"settings = load(model_path / \"settings.toml\")\n",
369374
"new_output = {\n",
370375
" \"quantity\": \"capacity\",\n",
371376
" \"sink\": \"aggregate\",\n",
372-
" \"index\": False,\n",
373377
" \"filename\": \"{cwd}/{default_output_dir}/Cache{Quantity}.csv\",\n",
374378
"}\n",
375379
"settings[\"outputs_cache\"] = []\n",
@@ -503,9 +507,10 @@
503507
"source": [
504508
"from pathlib import Path\n",
505509
"\n",
506-
"from muse import examples\n",
507510
"from toml import dump, load\n",
508511
"\n",
512+
"from muse import examples\n",
513+
"\n",
509514
"model_path = examples.copy_model(name=\"default_retro\", overwrite=True)\n",
510515
"settings = load(model_path / \"settings.toml\")\n",
511516
"settings[\"sectors\"][\"residential\"][\"outputs\"] = [\n",
@@ -666,7 +671,7 @@
666671
"name": "python",
667672
"nbconvert_exporter": "python",
668673
"pygments_lexer": "ipython3",
669-
"version": "3.12.3"
674+
"version": "3.12.4"
670675
},
671676
"vscode": {
672677
"interpreter": {

docs/advanced-guide/further-extending-muse.ipynb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
"metadata": {},
2121
"outputs": [],
2222
"source": [
23+
"from xarray import DataArray, Dataset\n",
24+
"\n",
2325
"from muse.agents import Agent\n",
2426
"from muse.filters import register_filter\n",
25-
"from xarray import DataArray, Dataset\n",
2627
"\n",
2728
"\n",
2829
"@register_filter\n",
@@ -100,9 +101,10 @@
100101
"source": [
101102
"from typing import Any\n",
102103
"\n",
103-
"from muse.decisions import register_decision\n",
104104
"from xarray import DataArray, Dataset\n",
105105
"\n",
106+
"from muse.decisions import register_decision\n",
107+
"\n",
106108
"\n",
107109
"@register_decision\n",
108110
"def median_objective(objectives: Dataset, parameters: Any, **kwargs) -> DataArray:\n",
@@ -147,7 +149,7 @@
147149
"outputs": [],
148150
"source": [
149151
"logging.getLogger(\"muse\").setLevel(0)\n",
150-
"mca = MCA.factory(\"../tutorial-code/0-new-decision-metric/settings.toml\")\n",
152+
"mca = MCA.factory(\"../tutorial-code/new-decision-metric/settings.toml\")\n",
151153
"mca.run();"
152154
]
153155
},
@@ -167,7 +169,7 @@
167169
"import pandas as pd\n",
168170
"\n",
169171
"mca_capacity = pd.read_csv(\n",
170-
" \"../tutorial-code/0-new-decision-metric/Results/MCACapacity.csv\"\n",
172+
" \"../tutorial-code/new-decision-metric/Results/MCACapacity.csv\"\n",
171173
")\n",
172174
"power_capacity = (\n",
173175
" mca_capacity[mca_capacity.sector == \"power\"]\n",

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
project = "MUSE"
99
copyright = "2024, Imperial College London"
1010
author = "Imperial College London"
11-
release = "1.2.0"
11+
release = "1.2.1"
1212
version = ".".join(release.split(".")[:2])
1313

1414
# -- General configuration ---------------------------------------------------

docs/inputs/agents.rst

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ Objective1
103103

104104
.. _Objective2:
105105

106-
Objective2
106+
Objective2 (optional)
107107
Second objective. See :ref:`Objective1 <Objective1>`.
108108

109109
.. _Objective3:
110110

111-
Objective3:
111+
Objective3 (optional)
112112
Third objective. See :ref:`Objective1 <Objective1>`.
113113

114114
.. _ObjData1:
@@ -117,11 +117,11 @@ ObjData1
117117
A weight associated with the :ref:`first objective <Objective1>`. Whether it is used
118118
will depend in large part on the :ref:`decision method <DecisionMethod>`.
119119

120-
ObjData2
120+
ObjData2 (optional)
121121
A weight associated with the :ref:`second objective <Objective2>`. See :ref:`ObjData1
122122
<ObjData1>`.
123123

124-
ObjData3
124+
ObjData3 (optional)
125125
A weight associated with the :ref:`third objective <Objective3>`. See :ref:`ObjData1
126126
<ObjData1>`.
127127

@@ -132,15 +132,13 @@ Objsort1
132132
"adhoc" and "scipy" solvers this should be set to "True" for minimization and
133133
"False" for maximisation.
134134

135-
Objsort2
136-
Sets whether :ref:`second objective <Objective2>` is maximized or minimized. For both
137-
"adhoc" and "scipy" solvers this should be set to "True" for minimization and
138-
"False" for maximisation.
135+
Objsort2 (optional)
136+
Objsort parameter for :ref:`second objective <Objective2>`. See :ref:`Objsort1
137+
<Objsort1>`.
139138

140-
Objsort3
141-
Sets whether :ref:`third objective <Objective3>` is maximized or minimized. For both
142-
"adhoc" and "scipy" solvers this should be set to "True" for minimization and
143-
"False" for maximisation.
139+
Objsort3 (optional)
140+
Objsort parameter for :ref:`third objective <Objective3>`. See :ref:`Objsort1
141+
<Objsort1>`.
144142

145143
.. py:currentmodule:: muse.filters
146144
@@ -161,7 +159,7 @@ SearchRule
161159

162160
- :py:func:`similar_technology <similar_technology>`: Only allows technologies that
163161
have the same type as current crop of technologies in the agent, as determined by
164-
"tech_type" in :ref:`inputs-technodata`. Aliased to "similar".
162+
"Type" in :ref:`inputs-technodata`. Aliased to "similar".
165163

166164
- :py:func:`same_fuels <same_fuels>`: Only allows technologies that consume the same
167165
fuels as the current crop of technologies in the agent. Aliased to
@@ -219,8 +217,8 @@ DecisionMethod
219217
Quantity
220218
A factor used to determine the demand share of "New" agents.
221219

222-
MaturityThreshold
223-
Parameter for the search rule :py:func:`maturity <muse.filters.maturity>`.
220+
MaturityThreshold (optional)
221+
Required when using the :py:func:`maturity <muse.filters.maturity>` search rule.
224222

225-
SpendLimit
226-
Parameter for the search rule :py:func:`spend_limit <muse.filters.spend_limit>`.
223+
SpendLimit (optional)
224+
Required when using the :py:func:`spend_limit <muse.filters.spend_limit>` search rule.

docs/inputs/commodities.rst

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,36 @@ a whole are defined in a csv file with the following structure.
1616
Agricultural-residues, Energy, agrires, 112, 15.4, PJ
1717

1818
Commodity
19-
represents the extended name of a commodity
19+
represents the extended name of a commodity (e.g. "Heating" or "Electricity").
20+
21+
CommodityName
22+
the internal name used for a commodity inside the model (e.g. "heat" or "elec").
23+
Any references to commodities in other files must use these names.
2024

2125
CommodityType
2226
defines the type of a commodity (i.e. Energy, Service, Material, or Environmental).
2327

24-
The "energy" type includes the energy commodities, such as biomass, electricity, gasoline, and hydrogen,
28+
The "energy" type includes energy commodities, such as biomass, electricity, gasoline, and hydrogen,
2529
which are either extracted, transformed from one to another, or used in the energy system.
2630

2731
The "service" type includes commodities such as space heating or hot water which correspond to selected
28-
poples' needs whose fulfillment requires energy uses.
32+
people's needs, and whose fulfillment requires energy uses.
2933

3034
The "material" type represent non-energy inputs for energy technologies, such as limestone or oxygen.
35+
3136
The "environmental" type refers to non-energy commodities whichare used to quantify an impact on the environment,
3237
such as greenhouse gases or CO2. They can be subjected to different types of environmental fees or taxes.
3338

34-
CommodityName
35-
is the internal name used for a commodity inside the model.
36-
37-
CommodityEmissionFactor_CO2
39+
CommodityEmissionFactor_CO2 (optional)
3840
is CO2 emission per unit of commodity flow.
3941
This commodity property is not directly used in the MUSE core set of equations, but can be further referred to
4042
for any subsequent development of the code.
4143

42-
HeatRate
44+
HeatRate (optional)
4345
represents the lower heating value of an energy commodity
4446
This commodity property is not directly used in the MUSE core set of equations, but can be further referred to
4547
for any subsequent development of the code.
4648

47-
Unit
48-
is the unit used as a basis for all the input data. More specifically the model allows
49-
a totally flexible way of defining the commodities. CommodityName is currently the
50-
only column used internally as it defines the names of commodities and needs to be
51-
used consistently across all the input data files. The remaining columns of the file
52-
are only relevant for the user internal reference for the original sets of
53-
assumptions used.
49+
Unit (optional)
50+
is the unit used to represent quantities of the commodity (e.g "PJ").
51+
This parameter does not need to be included, as it isn't used in the model, but care should be taken to ensure that units are consistent across all input files.

docs/inputs/existing_capacity.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ProcessName
2424
RegionName
2525
represents the region ID and needs to be consistent across all the data inputs.
2626

27-
Unit
27+
Unit (optional)
2828
reports the unit of the technology capacity; it is for the user internal reference only.
2929

3030
2010,..., 2050

0 commit comments

Comments
 (0)