Name | emtd JSON |
Version |
0.3.1
JSON |
| download |
home_page | None |
Summary | This projects provides as slim Python wrapper to access the 'technology-data' data set / snakemake workflow, maintained by the PyPSA team. |
upload_time | 2024-12-22 09:55:16 |
maintainer | None |
docs_url | None |
author | None |
requires_python | <3.13,>=3.11 |
license | MIT |
keywords |
energy modeling
technology data
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Energy Modeling Technology Data
This tool provides a slim Python wrapper to access the
["technology-data"](https://github.com/PyPSA/technology-data) data set /
[Snakemake](https://snakemake.readthedocs.io/en/stable/) workflow, maintained by the [PyPSA](https://github.com/PyPSA)
team.
> 🚨 🚨 Please check the license of the [`technology-data` repo](https://github.com/PyPSA/technology-data), especially
regarding the applicable licences of various input (and therefore output) data files. Additional info can be found
starting at [74](https://github.com/PyPSA/technology-data/issues/74) and
[87](https://github.com/PyPSA/technology-data/pull/87). Be aware that this wrapper can in no way guarantee that the data
being pulled from the repository, or the way that is being processed, or the code retrieved from the repository, or any
related information is in accordance with applicable licenses.
## Getting Started
### In an existing environment
Use the tool of your choice, for example `uv`, to add `emtd` to your environment:
```shell
uv add emtd
```
### In a new environment
The following example assumes that you are using `uv`. Other ways should work in a similar fashion.
First setup a new environment:
```shell
uv venv
```
Then activate it:
**Windows:**
```shell
.venv\Scripts\activate
```
**Linux:**
```shell
source .venv/bin/activate
```
And finally add `emtd` to your environment:
```shell
uv add emtd
```
### Basic usage
Now you can run the following examplatory code:
```python
from emtd import EMTD
# Use `./tmpdir` to store intermediate results.
data = EMTD(target_dir="tmpdir")
# Get all available technologies in 2030.
data.technologies(2030)
# Get all available parameters for the technology "solar" in 2030.
data.parameters(2030, "solar")
# Get the "lifetime" of "solar" in 2030.
res = data.get(2030, "solar", "lifetime")
# Try out:
res["value"]
res["unit"]
res["source"]
```
## Reproducibility
To make sure everyone using your code will get the same results from `emtd`, it is advised to fix the data set to a
specific version. Consult the [release page](https://github.com/PyPSA/technology-data/releases) for available versions,
then make sure to initialize using (e.g.):
```python
data = EMTD(target_dir="tmpdir", version="v0.6.2")
```
Make sure to include the `v` in the version string. Passing `"latest"` will put you on the current latest version of the
technology data repository. Be aware that this can change anytime, and the next time you initialize `emtd`, it will try
to update.
## Logging
To get more information about what is happening, you can change the default logging level, by adding the following code:
```python
import logging
logging.basicConfig(level=logging.INFO)
```
## Configuring the Snakemake workflow
To change parameters in the [Snakemake](https://snakemake.readthedocs.io/en/stable/) workflow, pass a `dict` to `EMTD`:
```python
data = EMTD(target_dir="tmpdir", params={"rate_inflation": 0.03})
```
This overwrites the defaults set by ["technology-data"](https://github.com/PyPSA/technology-data), or adds to it if the
respective setting is not specified there. Consult
[technology-data/config.yaml](https://github.com/PyPSA/technology-data/blob/master/config.yaml) for the current settings
or hints at what can be changed. Also, consult their [documentation](https://technology-data.readthedocs.io/en/latest/).
## Common Errors
```console
The current project's supported Python range (>=3.9,<4.0) is not compatible with some of the required packages Python requirement:
- scipy requires Python <3.13,>=3.9, so it will not be satisfied for Python >=3.13,<4.0
```
This, or similar errors, can occur if the `pyproject.toml` (or similar) specifies a too broad range of Python versions,
like:
```toml
[tool.poetry.dependencies]
python = "^3.9"
```
Changing that based on the proposed range (here `<3.13,>=3.9` from `scipy`) to:
```toml
[tool.poetry.dependencies]
python = ">=3.9,<3.13"
```
will fix that.
---
```console
subprocess.CalledProcessError: Command '['git', '-C', PosixPath('tmpdir'), 'pull']' returned non-zero exit status 1.
```
This error indicates an error during executing `git pull`. If you've previously used a `target_dir = "tmpdir` and
pulled, e.g., `version="v0.6.1"`, and are now using `EMTD(target_dir="tmpdir")` (without version), the pull will fail;
make sure to stick to one version, or use a different `target_dir` for managing different versions.
## Developing `emtd`
This is a rough outline of how to get started with developing `emtd`:
1. Clone this repository: `git clone https://github.com/sstroemer/emtd.git`.
2. Create a new environment: `uv venv`.
3. Activate the environment: `source .venv/bin/activate`.
4. Install the dependencies: `uv sync`.
5. If you are using VSCode, PyCharm, etc., select `.venv/bin/python` as the interpreter.
Depending on how you work with it, consider using `uv pip install -e .`.
### Updating packages
Currently the proposed way is:
```shell
uv lock --upgrade
uv sync
```
Raw data
{
"_id": null,
"home_page": null,
"name": "emtd",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.11",
"maintainer_email": null,
"keywords": "energy modeling, technology data",
"author": null,
"author_email": "sstroemer <stefan.stroemer@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/12/54/37159370a5fdceed6d13812d28cc777454d57901dd84601c8e4a9aa64418/emtd-0.3.1.tar.gz",
"platform": null,
"description": "# Energy Modeling Technology Data\n\nThis tool provides a slim Python wrapper to access the\n[\"technology-data\"](https://github.com/PyPSA/technology-data) data set /\n[Snakemake](https://snakemake.readthedocs.io/en/stable/) workflow, maintained by the [PyPSA](https://github.com/PyPSA)\nteam.\n\n> \ud83d\udea8 \ud83d\udea8 Please check the license of the [`technology-data` repo](https://github.com/PyPSA/technology-data), especially\nregarding the applicable licences of various input (and therefore output) data files. Additional info can be found\nstarting at [74](https://github.com/PyPSA/technology-data/issues/74) and\n[87](https://github.com/PyPSA/technology-data/pull/87). Be aware that this wrapper can in no way guarantee that the data\nbeing pulled from the repository, or the way that is being processed, or the code retrieved from the repository, or any\nrelated information is in accordance with applicable licenses.\n\n## Getting Started\n\n### In an existing environment\n\nUse the tool of your choice, for example `uv`, to add `emtd` to your environment:\n\n```shell\nuv add emtd\n```\n\n### In a new environment\n\nThe following example assumes that you are using `uv`. Other ways should work in a similar fashion.\n\nFirst setup a new environment:\n\n```shell\nuv venv\n```\n\nThen activate it:\n\n**Windows:**\n\n```shell\n.venv\\Scripts\\activate\n```\n\n**Linux:**\n\n```shell\nsource .venv/bin/activate\n```\n\nAnd finally add `emtd` to your environment:\n\n```shell\nuv add emtd\n```\n\n### Basic usage\n\nNow you can run the following examplatory code:\n\n```python\nfrom emtd import EMTD\n\n# Use `./tmpdir` to store intermediate results.\ndata = EMTD(target_dir=\"tmpdir\")\n\n# Get all available technologies in 2030.\ndata.technologies(2030)\n\n# Get all available parameters for the technology \"solar\" in 2030.\ndata.parameters(2030, \"solar\")\n\n# Get the \"lifetime\" of \"solar\" in 2030.\nres = data.get(2030, \"solar\", \"lifetime\")\n\n# Try out:\nres[\"value\"]\nres[\"unit\"]\nres[\"source\"]\n```\n\n## Reproducibility\n\nTo make sure everyone using your code will get the same results from `emtd`, it is advised to fix the data set to a \nspecific version. Consult the [release page](https://github.com/PyPSA/technology-data/releases) for available versions,\nthen make sure to initialize using (e.g.):\n\n```python\ndata = EMTD(target_dir=\"tmpdir\", version=\"v0.6.2\")\n```\n\nMake sure to include the `v` in the version string. Passing `\"latest\"` will put you on the current latest version of the\ntechnology data repository. Be aware that this can change anytime, and the next time you initialize `emtd`, it will try\nto update.\n\n## Logging\n\nTo get more information about what is happening, you can change the default logging level, by adding the following code:\n\n```python\nimport logging\n\nlogging.basicConfig(level=logging.INFO)\n```\n\n## Configuring the Snakemake workflow\n\nTo change parameters in the [Snakemake](https://snakemake.readthedocs.io/en/stable/) workflow, pass a `dict` to `EMTD`:\n\n```python\ndata = EMTD(target_dir=\"tmpdir\", params={\"rate_inflation\": 0.03})\n```\n\nThis overwrites the defaults set by [\"technology-data\"](https://github.com/PyPSA/technology-data), or adds to it if the\nrespective setting is not specified there. Consult\n[technology-data/config.yaml](https://github.com/PyPSA/technology-data/blob/master/config.yaml) for the current settings\nor hints at what can be changed. Also, consult their [documentation](https://technology-data.readthedocs.io/en/latest/).\n\n## Common Errors\n\n```console\nThe current project's supported Python range (>=3.9,<4.0) is not compatible with some of the required packages Python requirement:\n - scipy requires Python <3.13,>=3.9, so it will not be satisfied for Python >=3.13,<4.0\n```\n\nThis, or similar errors, can occur if the `pyproject.toml` (or similar) specifies a too broad range of Python versions,\nlike:\n\n```toml\n[tool.poetry.dependencies]\npython = \"^3.9\"\n```\n\nChanging that based on the proposed range (here `<3.13,>=3.9` from `scipy`) to:\n\n```toml\n[tool.poetry.dependencies]\npython = \">=3.9,<3.13\"\n```\n\nwill fix that.\n\n---\n\n```console\nsubprocess.CalledProcessError: Command '['git', '-C', PosixPath('tmpdir'), 'pull']' returned non-zero exit status 1.\n```\n\nThis error indicates an error during executing `git pull`. If you've previously used a `target_dir = \"tmpdir` and\npulled, e.g., `version=\"v0.6.1\"`, and are now using `EMTD(target_dir=\"tmpdir\")` (without version), the pull will fail;\nmake sure to stick to one version, or use a different `target_dir` for managing different versions.\n\n## Developing `emtd`\n\nThis is a rough outline of how to get started with developing `emtd`:\n\n1. Clone this repository: `git clone https://github.com/sstroemer/emtd.git`.\n2. Create a new environment: `uv venv`.\n3. Activate the environment: `source .venv/bin/activate`.\n4. Install the dependencies: `uv sync`.\n5. If you are using VSCode, PyCharm, etc., select `.venv/bin/python` as the interpreter.\n\nDepending on how you work with it, consider using `uv pip install -e .`.\n\n### Updating packages\n\nCurrently the proposed way is:\n\n```shell\nuv lock --upgrade\nuv sync\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "This projects provides as slim Python wrapper to access the 'technology-data' data set / snakemake workflow, maintained by the PyPSA team.",
"version": "0.3.1",
"project_urls": {
"repository": "https://github.com/sstroemer/emtd"
},
"split_keywords": [
"energy modeling",
" technology data"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e89f6ab4335c4ce6ad71575a946804750f71c912655a242040850c7d098a6850",
"md5": "9bca199a05e4c4cadd329b583ab96c16",
"sha256": "d3ce7380a6dfacddec84103f5bd6595987dc2ec880ac9f511f564c67951d16de"
},
"downloads": -1,
"filename": "emtd-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9bca199a05e4c4cadd329b583ab96c16",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.11",
"size": 7276,
"upload_time": "2024-12-22T09:55:13",
"upload_time_iso_8601": "2024-12-22T09:55:13.717111Z",
"url": "https://files.pythonhosted.org/packages/e8/9f/6ab4335c4ce6ad71575a946804750f71c912655a242040850c7d098a6850/emtd-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "125437159370a5fdceed6d13812d28cc777454d57901dd84601c8e4a9aa64418",
"md5": "b1ed52b69a5f970c4d5978356433a758",
"sha256": "39ad09b8ae1918f863bef1b49a78e61a20d971edf40e53ce8eaef7c097d9b077"
},
"downloads": -1,
"filename": "emtd-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "b1ed52b69a5f970c4d5978356433a758",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.11",
"size": 6950,
"upload_time": "2024-12-22T09:55:16",
"upload_time_iso_8601": "2024-12-22T09:55:16.399521Z",
"url": "https://files.pythonhosted.org/packages/12/54/37159370a5fdceed6d13812d28cc777454d57901dd84601c8e4a9aa64418/emtd-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-22 09:55:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sstroemer",
"github_project": "emtd",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "emtd"
}