Skip to main content

Biwipy: cycling performance simulation with GRIB wind data

Project description

biwipy

Documentation

biwipy is a Python library for cycling performance simulation and route analysis with wind-aware physics.

It combines GPX processing, GRIB weather interpolation, and cyclist physics to replay rides or simulate future scenarios.

The devlopement of biwipy was largely assisted by AI based on an previous conventionally designed wind model.

Features

  • Physics-based speed and power simulation (CdA, Cr, slope, mass, wind)
  • Route preprocessing and segment analysis from GPX files
  • WindScore and scenario comparison utilities
  • GRIB weather integration (GFS/IFS workflows)
  • Interactive map visualization for route and wind exploration

Project layout

biwipy/
├── biwipy/
│   ├── core/
│   ├── analysis/
│   ├── weather/
│   └── visualization/
├── docs/
├── pyproject.toml
└── README.md

Installation

From PyPI

pip install biwipy

pygrib is a required dependency of biwipy.

Windows Installation (Required: conda-forge)

On Windows, you must install pygrib via conda-forge before using pip. This is because pygrib requires the ECCODES C library which conda provides automatically.

Step-by-step (Windows with Conda):

# 1. Create conda environment
conda create -n biwipy-env python=3.13
conda activate biwipy-env

# 2. Install pygrib from conda-forge (BEFORE pip)
conda install -c conda-forge pygrib

# 3. Install biwipy via pip
pip install biwipy

For development (with tests/linting):

conda activate biwipy-env
pip install -e ".[dev]"

If you encounter boot.def errors, set this environment variable:

conda env config vars set ECCODES_DEFINITION_PATH=$env:CONDA_PREFIX\Library\share\eccodes\definitions
conda deactivate
conda activate biwipy-env

From source

pip install .

Quick start

from datetime import timedelta, datetime, timezone
from zoneinfo import ZoneInfo
import os

from biwipy.core import Simulator
from biwipy.core.cyclist_params import CyclistBehavior
from biwipy.weather import WeatherProvider
from biwipy.weather.grib_finder import build_grib_list
from biwipy.analysis import RouteAnalyzer

# Load and process GPX file
analyzer = RouteAnalyzer()
gpx_result = analyzer.process_gpx("my_ride.gpx")

# Set ride start time and max duration example : (now + 24h)  4h  
start_ride = datetime.now(timezone.utc) + timedelta(hours=24)
duration_hours = 4

# Load weather data (GRIB files from current directory or will auto-download)
gribs_list = build_grib_list(".", start_ride, 1, duration_hours)
weather = WeatherProvider(gribs_list)

# Create cyclist profile and simulator
behavior = CyclistBehavior(uphill='realistic', downhill='realistic', corner='realistic')
sim = Simulator(weather.grib, behavior=behavior, CdA=0.50, Cr=0.005, m=85.0)

# Simulate the ride (v0 in m/s: 30 km/h = 30/3.6 m/s)
result = sim.simulate_future(gpx_result.segments, start_ride, v0=30/3.6)

# Display results
print(f"Average speed: {result.speed.avg:.2f} km/h")
print(f"Average power: {result.power.avg:.2f} W")
print(f"Windscore: {result.wind_score.grade}")

Documentation

Online documentation: https://jacme31.github.io/biwipy/

Build docs from repository root:

cd docs
make html

On Windows (PowerShell):

./build_docs.ps1

With options:

./build_docs.ps1 -Clean              # Clean and rebuild
./build_docs.ps1 -Open               # Build and open in browser
./build_docs.ps1 -Clean -Open        # Clean, rebuild, and open

Main docs entry point is generated at docs/build/html/index.html.

Development

Install development extras:

pip install -e ".[dev]"

To also build the documentation locally:

pip install -e ".[dev,docs]"

Build package artifacts:

python -m build
python -m twine check dist/*

License

This project is released under the MIT License. See LICENSE.

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

biwipy-0.11.0.tar.gz (138.9 kB view details)

Uploaded Source

Built Distribution

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

biwipy-0.11.0-py3-none-any.whl (131.6 kB view details)

Uploaded Python 3

File details

Details for the file biwipy-0.11.0.tar.gz.

File metadata

  • Download URL: biwipy-0.11.0.tar.gz
  • Upload date:
  • Size: 138.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for biwipy-0.11.0.tar.gz
Algorithm Hash digest
SHA256 369d0c43e1c86c74d922d114d56b92223876a54070f603faf5792166e6349418
MD5 8c528e09cf760df3d109bda5dc54874b
BLAKE2b-256 06bc4111d1545ad8c2269c20ea86e451f274a77099145e8c89a44202ca83dc7f

See more details on using hashes here.

File details

Details for the file biwipy-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: biwipy-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 131.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for biwipy-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed902c4a3e23e816eef50acbd62e2a5ca4824e73bf47bd324cc9e0f9ef2c22bb
MD5 43d5ae09b3bc9c26041fae540f9bb031
BLAKE2b-256 886d9553eeeb5d2adf55ba90aad86fe89b5888c477bf81d8b6ba7859671c41d9

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