Skip to main content

Interactive dashboard for visualizing and analyzing PyPSA energy system networks

Project description

PyPSA Explorer

PyPI version License: MIT Python 3.12+ Code style: black

Interactive dashboard for visualizing and analyzing PyPSA energy system networks. Built with Dash and Plotly, PyPSA Explorer provides a comprehensive web interface for exploring energy system models with powerful filtering and visualization capabilities.

Features

๐Ÿ“Š Interactive Visualizations

  • Energy Balance Analysis: Timeseries and aggregated views of energy flows
  • Capacity Planning: Visualize optimal capacity distribution by carrier and region
  • Economic Analysis: CAPEX and OPEX breakdowns across the system
  • Network Maps: Interactive geographical visualization of network topology
  • Multi-Network Support: Load and compare multiple networks seamlessly

๐ŸŽฏ Advanced Filtering

  • Filter by energy carrier (sector)
  • Filter by country/region
  • Dynamic updates across all visualizations
  • Tab-specific filter behavior

๐Ÿš€ Production Ready

  • Well-structured, modular codebase
  • Comprehensive type hints
  • Extensive test coverage
  • CI/CD pipeline integration
  • Professional documentation

Installation

From PyPI (Recommended)

pip install pypsa-explorer

From Source

git clone https://github.com/openenergytransition/pypsa-explorer.git
cd pypsa-explorer
pip install -e .

Development Installation

git clone https://github.com/openenergytransition/pypsa-explorer.git
cd pypsa-explorer
pip install -e ".[dev]"
pre-commit install

Quick Start

Command Line Interface

Launch the landing page and drag-and-drop networks or load the bundled example:

pypsa-explorer

Run with your own network:

pypsa-explorer /path/to/network.nc

Run with multiple networks:

pypsa-explorer /path/to/network1.nc:Label1 /path/to/network2.nc:Label2

Custom host and port:

pypsa-explorer --host 0.0.0.0 --port 8080

Production mode (no debug):

pypsa-explorer --no-debug

Python API

from pypsa_explorer import run_dashboard

# Run with default network
run_dashboard()

# Run with custom network
run_dashboard("/path/to/network.nc")

# Run with multiple networks
networks = {
    "Scenario A": "/path/to/network1.nc",
    "Scenario B": "/path/to/network2.nc",
}
run_dashboard(networks, debug=True, host="0.0.0.0", port=8050)

# Run with Network objects
import pypsa
n1 = pypsa.Network("network1.nc")
n2 = pypsa.Network("network2.nc")

run_dashboard({"Network 1": n1, "Network 2": n2})

Programmatic App Creation

from pypsa_explorer import create_app

# Create app instance
app = create_app(networks_input="/path/to/network.nc", title="My Dashboard")

# Run with custom server
app.run(debug=True, host="0.0.0.0", port=8050)

Project Structure

pypsa-explorer/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ pypsa_explorer/
โ”‚       โ”œโ”€โ”€ __init__.py           # Package initialization
โ”‚       โ”œโ”€โ”€ app.py                # Main application factory
โ”‚       โ”œโ”€โ”€ cli.py                # Command-line interface
โ”‚       โ”œโ”€โ”€ config.py             # Configuration and theming
โ”‚       โ”œโ”€โ”€ callbacks/            # Dash callbacks
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ”œโ”€โ”€ filters.py        # Filter callbacks
โ”‚       โ”‚   โ”œโ”€โ”€ navigation.py     # Navigation callbacks
โ”‚       โ”‚   โ”œโ”€โ”€ network.py        # Network callbacks
โ”‚       โ”‚   โ””โ”€โ”€ visualizations.py # Visualization callbacks
โ”‚       โ”œโ”€โ”€ layouts/              # UI layouts
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚       โ”‚   โ”œโ”€โ”€ components.py     # Reusable components
โ”‚       โ”‚   โ”œโ”€โ”€ dashboard.py      # Main dashboard layout
โ”‚       โ”‚   โ”œโ”€โ”€ tabs.py           # Tab definitions
โ”‚       โ”‚   โ””โ”€โ”€ welcome.py        # Welcome page
โ”‚       โ””โ”€โ”€ utils/                # Utility functions
โ”‚           โ”œโ”€โ”€ __init__.py
โ”‚           โ”œโ”€โ”€ helpers.py        # Helper functions
โ”‚           โ””โ”€โ”€ network_loader.py # Network loading utilities
โ”œโ”€โ”€ tests/                        # Test suite
โ”œโ”€โ”€ docs/                         # Documentation
โ”œโ”€โ”€ examples/                     # Example notebooks and scripts
โ”œโ”€โ”€ pyproject.toml               # Project configuration
โ”œโ”€โ”€ README.md                    # This file
โ”œโ”€โ”€ LICENSE                      # MIT License
โ””โ”€โ”€ CHANGELOG.md                 # Version history

Development

Setup Development Environment

# Clone repository
git clone https://github.com/openenergytransition/pypsa-explorer.git
cd pypsa-explorer

# Install with dev dependencies
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=pypsa_explorer --cov-report=html

# Run specific test file
pytest tests/test_app.py

Code Quality

# Format code
black src/ tests/
ruff format src/ tests/

# Lint code
ruff check src/ tests/ --fix

# Type checking
mypy src/

Building Documentation

cd docs
make html

Configuration

Custom Styling

The dashboard theme can be customized by modifying src/pypsa_explorer/config.py:

COLORS = {
    "primary": "#2c3e50",
    "secondary": "#3498db",
    "accent": "#2ecc71",
    # ... more colors
}

Default Settings

  • Port: 8050
  • Host: 127.0.0.1 (localhost)
  • Debug Mode: True (disable with --no-debug)
  • Default Carriers: AC, Hydrogen Storage, Low Voltage

Requirements

  • Python >= 3.12
  • PyPSA (from GitHub master)
  • Dash >= 2.14
  • Plotly >= 5.0
  • Folium >= 0.14
  • dash-bootstrap-components >= 1.5

See pyproject.toml for complete dependency list.

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests and linting (pytest && ruff check)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Please ensure:

  • All tests pass
  • Code is properly formatted (black/ruff)
  • Type hints are included
  • Documentation is updated

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use PyPSA Explorer in your research, please cite:

@software{pypsa_explorer,
  title = {PyPSA Explorer: Interactive Dashboard for Energy System Analysis},
  author = {Open Energy Transition},
  year = {2024},
  url = {https://github.com/openenergytransition/pypsa-explorer}
}

Acknowledgments

Support

Roadmap

  • Export functionality (PNG, PDF, data export)
  • Advanced comparison mode for multiple networks
  • Custom calculation and plotting plugins
  • Real-time data streaming support
  • Collaborative features and sharing
  • Integration with cloud storage (S3, GCS)

Related Projects

  • PyPSA - The core power system analysis framework
  • PyPSA-Eur - Open energy system model for Europe
  • PyPSA-Earth - Global energy system model

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

pypsa_explorer-0.1.1.tar.gz (56.6 kB view details)

Uploaded Source

Built Distribution

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

pypsa_explorer-0.1.1-py3-none-any.whl (47.0 kB view details)

Uploaded Python 3

File details

Details for the file pypsa_explorer-0.1.1.tar.gz.

File metadata

  • Download URL: pypsa_explorer-0.1.1.tar.gz
  • Upload date:
  • Size: 56.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for pypsa_explorer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 333926e641b34a5d0cee614474762d054b23c07dc2faa5166e69fa2360d191a0
MD5 b5cc4c5cd05ea49eecdaa4f439bc5b5c
BLAKE2b-256 94177d534c99739a40046d79c4bedc5cac6e8ceee6a928af7cac341ca734779f

See more details on using hashes here.

File details

Details for the file pypsa_explorer-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pypsa_explorer-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 47.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for pypsa_explorer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cdc3a8522465055d3ef9f9ccde45bacdeb62fdeba8d1771dc8407611c36e72da
MD5 3b0b84042e96b7fdd55eb44693edb84f
BLAKE2b-256 7fdf5af613351757638991437acd8e715a54f97a0fb4d9820d571f12d0dc5365

See more details on using hashes here.

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