Skip to main content

A Python library for pre-processing FLEXPART inputs

Project description

preFLEXPART

PyPI version Licence

WARNING:

This project is in BETA and under active development. Interfaces and functionality are subject to change.

preFLEXPART is a Python toolkit to retrieve and preprocess ECMWF IFS fields for the Lagrangian particle dispersion model FLEXPART.

It uses ECMWF’s earthkit-data library to load meteorological GRIB data into familiar xarray/numpy arrays for computation, preserves GRIB metadata, and can write the results back to GRIB2.

Compatibility

Target model: FLEXPART V10

Install the latest release from PyPI

# pip
pip install preflexpart

# or poetry
poetry add preflexpart

At a glance

  1. Retrieve IFS forecasts

  2. Preprocess for FLEXPART V10

    • De-accumulates precipitation, radiation, and fluxes
    • Converts etadotomega (Pa s⁻¹)
  3. Write GRIB2

    • Preserves/overrides GRIB metadata as needed
    • Ensures all fields are written as GRIB2

Documentation

See the docs/ folder for detailed information:

Changelog

See CHANGELOG.md for version history.

Running Tests

To run the full test suite:

git clone https://gitlab.phaidra.org/flexpart/preflexpart.git
cd preflexpart
poetry install --with dev
poetry run pytest

Feedback

Found a bug or have feedback? Please open an issue.

Roadmap / TODO

  • Publish a hosted documentation site (e.g., Read the Docs or GitHub Pages)
  • Add Copernicus Data Store (CDS) as a data source
  • Find suitable package name (flexprep?)

Testing the preFLEXPART Package

This guide explains how to test the preFLEXPART pipeline using example scripts included in the repository. Each example demonstrates a full workflow: loading, preprocessing, and writing FLEXPART-ready GRIB2 files.

1️. Install the package

Option A — From PyPI

pip install preflexpart==0.1.3-rc4

2️. Get the example scripts

Clone the repository to access the example workflows.

git clone https://gitlab.phaidra.org/flexpart/preflexpart.git
cd preflexpart

3. Run an example pipeline

Each example runs the preFLEXPART pipeline end-to-end.

Data source Command Notes
🧪 Bundled test data python examples/run_pipeline_local.py tests/data/test_sources_raw_ifs.tar.gz Works offline using a small bundled dataset
💾 Local GRIB files python examples/run_pipeline_local.py /path/to/grib_dir Use your own GRIB directory
☁️ ECMWF MARS archive python examples/run_pipeline_mars.py --date 2025-09-29 --time 12 --step "1/to/2/by/1" --max-level 137 Requires ECMWF MARS credentials (.ecmwfapirc)

3️. Check the outputs

After running a pipeline, the processed GRIB2 files are written to ./out_grib2/.

Each file corresponds to one forecast step (e.g. dispf2025072912).

Found a bug or have feedback? Please open an issue or contact nina.burgdorfer@meteoswiss.ch

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

preflexpart-0.1.3rc4.tar.gz (28.0 kB view details)

Uploaded Source

Built Distribution

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

preflexpart-0.1.3rc4-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file preflexpart-0.1.3rc4.tar.gz.

File metadata

  • Download URL: preflexpart-0.1.3rc4.tar.gz
  • Upload date:
  • Size: 28.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.1 CPython/3.11.7 Linux/6.8.0-85-generic

File hashes

Hashes for preflexpart-0.1.3rc4.tar.gz
Algorithm Hash digest
SHA256 d578305e780bf5266ac22bf2925f8754f6b5a198653e6359daa6df6deb1a6b93
MD5 826e812d09fce12c314c30305ed49b8d
BLAKE2b-256 98d25e7719591d2f205713dc3810b05489c91631f31e31f38a7bec709617640c

See more details on using hashes here.

File details

Details for the file preflexpart-0.1.3rc4-py3-none-any.whl.

File metadata

  • Download URL: preflexpart-0.1.3rc4-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.1 CPython/3.11.7 Linux/6.8.0-85-generic

File hashes

Hashes for preflexpart-0.1.3rc4-py3-none-any.whl
Algorithm Hash digest
SHA256 4482a18707ab8facabcbbe34aeff4979bfe55d724974f1dbb921f98bd0f98d27
MD5 d9094c3b1e33f237674240d7c5b287f7
BLAKE2b-256 475357b7dacf9e815941c6892c2faf49722fb5b9942527ec699870d759854ab1

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