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.10.1.tar.gz (134.0 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.10.1-py3-none-any.whl (125.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for biwipy-0.10.1.tar.gz
Algorithm Hash digest
SHA256 0881fb850a4e0291f832950c1af92fb99716e4e2c5f3f96674095a3cf1cebb63
MD5 90847217a0b4c3be45b68ccf5d3ebd0e
BLAKE2b-256 1401d86d5975f4dd41822c859287bfe03a2a8be2f6cfd441940fc4f0d2a6eb5d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for biwipy-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 719a8d6dedab1c5571c40d1378155b094f10c26e7cf50670cbc743239d6f3297
MD5 0321e1e23289e3f0a9953dc4d80daf7f
BLAKE2b-256 765f53a59868bc8d8815a6cf2720a36975c25207a1081bfc90842317f014f117

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