Skip to main content

This projects provides as slim Python wrapper to access the 'technology-data' data set / snakemake workflow, maintained by the PyPSA team.

Project description

Energy Modeling Technology Data

This tool provides a slim Python wrapper to access the "technology-data" data set / Snakemake workflow, maintained by the PyPSA team.

🚨 🚨 Please check the license of the technology-data repo, especially regarding the applicable licences of various input (and therefore output) data files. Additional info can be found starting at 74 and 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.

🎓 🎓 This is a first working version, expect a lot of changes, and a lot of missing functionality!

Getting Started

The following example assumes that you are using conda to create your environment, and poetry to manage your dependencies. Other ways should work in a similar fashion.

Create an environment (skip if adding to an existing one; choose whatever Python version you want to use), installing poetry (skip if using a global installation or if you are already using poetry), initializing your pyproject.toml (consider also using poetry new instead of poetry init when starting a project), and then add emtd to your dependencies.

(base) $ conda create -n yourenvname python=3.11 -y
(base) $ conda activate yourenvname

(yourenvname) $ pip install poetry
(yourenvname) $ poetry init
(yourenvname) $ poetry add emtd

Now you can run the following examplatory code:

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"]

Reproducability

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 for available versions, then make sure to initialize using (e.g.):

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.

Configuring the Snakemake workflow

To change parameters in the Snakemake workflow, pass a dict to EMTD:

data = EMTD(target_dir="tmpdir", params={"rate_inflation": 0.03})

This overwrites the defaults set by "technology-data", or adds to it if the respective setting is not specified there. Consult technology-data/config.yaml for the current settings or hints at what can be changed. Also, consult their documentation.

Common Errors

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:

[tool.poetry.dependencies]
python = "^3.9"

Changing that based on the proposed range (here <3.13,>=3.9 from scipy) to:

[tool.poetry.dependencies]
python = ">=3.9,<3.13"

will fix that.


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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emtd-0.3.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

emtd-0.3.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file emtd-0.3.0.tar.gz.

File metadata

  • Download URL: emtd-0.3.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for emtd-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f5eb30240d0b551851e2d441ae18f46e2bbec7a98fc15344192137212f856ba6
MD5 fb398edc8a79398e3bdd83f77f05b4f5
BLAKE2b-256 a533ff823bab987053f625fcf5f0f0351f35f5a6db7ad1b1af1ff0e803e3c19d

See more details on using hashes here.

Provenance

The following attestation bundles were made for emtd-0.3.0.tar.gz:

Publisher: pypi_publish.yml on sstroemer/emtd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file emtd-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: emtd-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for emtd-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33192c96b5ff18d9bf339095582c96fdf4319097562a081357b7229ebbf18aa4
MD5 26a904d20e2027986f5bf85fb0b45680
BLAKE2b-256 db7d7c867844d354ab9d3bb0968a53df701a24ae7d334b340774803a7bc71169

See more details on using hashes here.

Provenance

The following attestation bundles were made for emtd-0.3.0-py3-none-any.whl:

Publisher: pypi_publish.yml on sstroemer/emtd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page