Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 7, 2025
1 parent 16b2911 commit 0c971f5
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 21 deletions.
2 changes: 1 addition & 1 deletion docs/source/api.mfa_system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ MFA System

.. autofunction:: sodym.make_empty_flows

.. autofunction:: sodym.make_empty_stocks
.. autofunction:: sodym.make_empty_stocks
1 change: 0 additions & 1 deletion docs/source/api.top_level_functions.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Top level functions
------------------------------

2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
html_theme = "sphinx_rtd_theme"
# html_static_path = ['_static']
html_theme_options = {
'collapse_navigation': False,
"collapse_navigation": False,
}
2 changes: 1 addition & 1 deletion docs/source/example1.nblink
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"path": "../../examples/example1.ipynb",
"extra-media": ["../../examples/pictures"]
}
}
2 changes: 1 addition & 1 deletion docs/source/example2.nblink
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"path": "../../examples/example2.ipynb",
"extra-media": ["../../examples/pictures"]
}
}
2 changes: 1 addition & 1 deletion docs/source/example3.nblink
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"path": "../../examples/example3.ipynb",
"extra-media": ["../../examples/pictures"]
}
}
2 changes: 1 addition & 1 deletion docs/source/example5.nblink
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"path": "../../examples/example5.ipynb",
"extra-media": ["../../examples/pictures"]
}
}
2 changes: 1 addition & 1 deletion docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ For a complete guide on how to use different parts of the library, refer to the
The examples are available as Jupyter notebooks in the `examples` folder of the sodym repository.
You can modify and run them interactively in a Jupyter notebook environment.

All examples were created by Stefan Pauliuk for ODYM and adapted for sodym here.
All examples were created by Stefan Pauliuk for ODYM and adapted for sodym here.
2 changes: 1 addition & 1 deletion docs/source/getting_started.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

.. include:: ../../README.md
:parser: myst_parser.sphinx_
:end-before: <!-- stop parsing here on readthedocs -->
:end-before: <!-- stop parsing here on readthedocs -->
2 changes: 1 addition & 1 deletion examples/example1.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.16.4
# jupytext_version: 1.16.6
# kernelspec:
# display_name: .venv
# language: python
Expand Down
2 changes: 1 addition & 1 deletion examples/example2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.16.4
# jupytext_version: 1.16.6
# kernelspec:
# display_name: .venv
# language: python
Expand Down
2 changes: 1 addition & 1 deletion examples/example3.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.16.4
# jupytext_version: 1.16.6
# kernelspec:
# display_name: .venv
# language: python
Expand Down
15 changes: 10 additions & 5 deletions examples/example5.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,19 @@
"\n",
" def read_dimension(self, dimension_definition: DimensionDefinition) -> Dimension:\n",
" if (dim_name := dimension_definition.name) == \"region\":\n",
" data = pd.read_excel(join(self.data_directory, \"example5_vehicle_lifetime.xlsx\"), \"Data\")\n",
" other_data = pd.read_excel(join(self.data_directory, \"example5_vehicle_stock.xlsx\"), \"Data\")\n",
" data = pd.read_excel(\n",
" join(self.data_directory, \"example5_vehicle_lifetime.xlsx\"), \"Data\"\n",
" )\n",
" other_data = pd.read_excel(\n",
" join(self.data_directory, \"example5_vehicle_stock.xlsx\"), \"Data\"\n",
" )\n",
" data = (set(data[dim_name].unique())).intersection(set(other_data[dim_name].unique()))\n",
" data = list(data)\n",
" data.sort()\n",
" elif (dim_name := dimension_definition.name) in [\"waste\", \"material\"]:\n",
" data = pd.read_excel(join(self.data_directory, \"example5_eol_recovery_rate.xlsx\"), \"Data\")\n",
" data = pd.read_excel(\n",
" join(self.data_directory, \"example5_eol_recovery_rate.xlsx\"), \"Data\"\n",
" )\n",
" data.columns = [x.lower() for x in data.columns]\n",
" data = list(data[dim_name].unique())\n",
" data.sort()\n",
Expand All @@ -262,8 +268,7 @@
"\n",
" def read_parameter_values(self, parameter_name: str, dims: DimensionSet) -> Parameter:\n",
" data = pd.read_excel(\n",
" join(self.data_directory, f\"example5_{parameter_name.replace(' ', '_')}.xlsx\"),\n",
" \"Data\",\n",
" join(self.data_directory, f\"example5_{parameter_name.replace(\" \", \"_\")}.xlsx\"), \"Data\"\n",
" )\n",
" data = data.fillna(0)\n",
" if \"r\" in dims.letters: # remove unwanted regions\n",
Expand Down
14 changes: 10 additions & 4 deletions examples/example5.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.16.4
# jupytext_version: 1.16.6
# kernelspec:
# display_name: .venv
# language: python
Expand Down Expand Up @@ -192,13 +192,19 @@ def years(self):

def read_dimension(self, dimension_definition: DimensionDefinition) -> Dimension:
if (dim_name := dimension_definition.name) == "region":
data = pd.read_excel(join(self.data_directory, "example5_vehicle_lifetime.xlsx"), "Data")
other_data = pd.read_excel(join(self.data_directory, "example5_vehicle_stock.xlsx"), "Data")
data = pd.read_excel(
join(self.data_directory, "example5_vehicle_lifetime.xlsx"), "Data"
)
other_data = pd.read_excel(
join(self.data_directory, "example5_vehicle_stock.xlsx"), "Data"
)
data = (set(data[dim_name].unique())).intersection(set(other_data[dim_name].unique()))
data = list(data)
data.sort()
elif (dim_name := dimension_definition.name) in ["waste", "material"]:
data = pd.read_excel(join(self.data_directory, "example5_eol_recovery_rate.xlsx"), "Data")
data = pd.read_excel(
join(self.data_directory, "example5_eol_recovery_rate.xlsx"), "Data"
)
data.columns = [x.lower() for x in data.columns]
data = list(data[dim_name].unique())
data.sort()
Expand Down

0 comments on commit 0c971f5

Please sign in to comment.