Skip to main content

r2x-sienna

Sienna PSY parser/exporter plugin for the r2x-core plugin framework.

CI Actions Quality Python PyPI License

[!WARNING] This project is currently optimized for internal R2X workflows. You are welcome to use it, but APIs and behavior may continue to evolve as r2x-core evolves.

r2x-sienna integrates Sienna-style PSY data with r2x-core and infrasys. It provides parser and exporter plugins, plus version-upgrade utilities for input JSON, so Sienna data can be loaded into System objects and written back out in PSY-compatible form.

Quickstart · Installation · What It Provides · Usage with r2x-core · Development · License

Quickstart

Install:

pip install r2x-sienna

Parse a Sienna JSON system into an infrasys.System, then export it back to PSY JSON:

from pathlib import Path

from r2x_core import DataStore, PluginContext
from r2x_sienna import (
    SiennaConfig,
    SiennaExporter,
    SiennaExporterConfig,
    SiennaParser,
)

data_path = Path("tests/data/case5_pjm_rt/c_sys5_pjm_rt.json")
out_path = Path("output/system.json")

# Parse
parse_cfg = SiennaConfig(
    model_year=2029,
    system_name="PJM-5",
    json_path=str(data_path),
)
parse_ctx = PluginContext(config=parse_cfg, store=DataStore(path=data_path.parent))
parsed_system = SiennaParser.from_context(parse_ctx).run().system

# Export
export_cfg = SiennaExporterConfig(output_path=str(out_path))
export_ctx = PluginContext(config=export_cfg, system=parsed_system, store=DataStore(path=out_path.parent))
SiennaExporter.from_context(export_ctx).run()

Installation

From PyPI

Python requirement: >=3.11, <3.14.

pip install r2x-sienna

Using uv:

uv add r2x-sienna

From Source

git clone https://github.com/NatLabRockies/r2x-sienna.git
cd r2x-sienna
uv sync --all-groups

What It Provides

  • SiennaParser: reads Sienna PSY JSON and related time series metadata into infrasys.System.
  • SiennaExporter: writes infrasys.System back to Sienna-compatible PSY JSON, including supplemental attributes and optional HDF5 time series export.
  • SiennaUpgrader and run_sienna_upgrades(...): version-detection and upgrade pipeline for legacy JSON data before parsing.
  • Plugin entry points for r2x-core under the r2x_plugin group:
    • sienna-parser = r2x_sienna:SiennaParser
    • sienna-exporter = r2x_sienna:SiennaExporter

Usage with r2x-core

r2x-sienna follows the r2x-core plugin lifecycle.

  • Build parser/exporter instances with PluginContext.
  • Run plugin hooks through .run().
  • Access parser/exporter configs through SiennaConfig and SiennaExporterConfig.

The parser on_upgrade() hook automatically runs Sienna data upgrades when json_path is provided, then proceeds with deserialization into a System.

Development

Install dev dependencies:

uv sync --all-groups

Run the same checks used in CI:

uv run prek run --all-files --hook-stage pre-push

Targeted commands:

uv run pytest -q -m "not slow" --maxfail=1 --disable-warnings
uv run ty check ./src/r2x_sienna/

License

BSD 3-Clause. See LICENSE.txt.

Download files

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

Source Distribution

r2x_sienna-0.4.2.tar.gz (59.2 kB view details)

Uploaded Source

Built Distribution

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

r2x_sienna-0.4.2-py3-none-any.whl (68.6 kB view details)

Uploaded Python 3

File details

Details for the file r2x_sienna-0.4.2.tar.gz.

File metadata

  • Download URL: r2x_sienna-0.4.2.tar.gz
  • Upload date:
  • Size: 59.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for r2x_sienna-0.4.2.tar.gz
Algorithm Hash digest
SHA256 edf3c69180d165fdf97f0129ae6f8166dcb7e40b3ee6585e6bff3d272af4b582
MD5 254a451881597f197de61f3949cf4e7c
BLAKE2b-256 f667ee27fc295a130eaa40d403246c46f34581cd9fc064d10505d781fb6c6122

See more details on using hashes here.

Provenance

The following attestation bundles were made for r2x_sienna-0.4.2.tar.gz:

Publisher: release.yaml on NatLabRockies/r2x-sienna

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

File details

Details for the file r2x_sienna-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: r2x_sienna-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 68.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for r2x_sienna-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 acbce041f9bd47a11fdfb3de7565070d96bdda004fd9364c8af691560d99750b
MD5 0fa97fd066f9c6c8ef2d5598f82ce3f7
BLAKE2b-256 d950af7baf27d076626d8b7dc88f68c2b99e6a9de3a688e067b65fcdca89a61b

See more details on using hashes here.

Provenance

The following attestation bundles were made for r2x_sienna-0.4.2-py3-none-any.whl:

Publisher: release.yaml on NatLabRockies/r2x-sienna

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

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

0.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page