Skip to main content

LCS-Parcels

PyPI Docs CI License: MIT

Lagrangian coherent structure (LCS) diagnostics on top of Parcels: deformation gradient grad F, Cauchy-Green tensor (grad F)^T grad F, its eigen-analysis, and the finite-time Lyapunov exponent (FTLE), following Haller (2015), doi:10.1146/annurev-fluid-010313-141322.

The documentation is at lcs-parcels.readthedocs.io and the source at github.com/geomar-od-lagrange/lcs_parcels.

This package contains no Parcels code. It emits a particle set to release and ingests the advected positions to diagnose. You run Parcels (or anything else) in between.

Install

Python 3.12 or newer:

$ pip install lcs-parcels

For unreleased main:

$ pip install git+https://github.com/geomar-od-lagrange/lcs_parcels.git

To work on the package code instead, or to run the examples, use pixi:

$ pixi install
$ pixi run test                       # run the test suite, including the Parcels-free example
$ pixi run -e examples get-data       # download the CMEMS subset the Cabo Verde examples read (once)
$ pixi run -e examples test-examples  # execute every example against the current API

Quickstart

import numpy as np
from lcs_parcels import NeighborSeedGrid

# 1. Lay out a seed grid and emit a particle set.
seed = NeighborSeedGrid.from_axes(
    lon=np.linspace(-25.0, -20.0, 6),
    lat=np.linspace(15.0, 20.0, 5),
)
lon_0, lat_0 = seed.to_parcels_pset()

# 2. Advect (lon_0, lat_0) from t0 to t1 with Parcels, which is not part of
#    this package, and collect the final positions.

# 3. Ingest the advected positions into a flow map and diagnose it.
flowmap = seed.pset_to_flowmap(
    lon=lon_advected, lat=lat_advected, t0=t0, t1=t1
)
ftle = flowmap.ftle()  # xr.DataArray of the FTLE (1/s) on the (i, j) grid

# 4. Or go straight to the hyperbolic LCS curves, FTLE field included.
lcs = flowmap.hyperbolic_lcs()

Every returned array carries long_name and units, so ftle.plot(x="lon_grid", y="lat_grid") labels itself.

print(flowmap) gives a one-line summary and flowmap.ds gives the dataset itself:

>>> print(flowmap)
<NeighborFlowMap 6x5 grid, lon -25.00..-20.00, lat 15.00..20.00,
                 t0 2020-01-01T00:00:00, T +7.0 days>

Examples

  • get_data downloads the CMEMS subset the Cabo Verde notebooks read. Run once, before them. Needs CMEMS credentials.
  • example_grid_pset exercises the package API on its own, without Parcels.
  • cabo_verde_ftle shows the Parcels v4 wiring and the FTLE from CMEMS currents.
  • cabo_verde_lcs builds repelling and attracting LCS as strain tensor lines.
  • cabo_verde_lcs_evolution evolves an extracted LCS as a material curve.

The Parcels examples need the examples pixi environment (pixi install -e examples) and a CMEMS currents file you save yourself. The examples index has the reading order and the data.

Scope

Rectilinear grids with a monotonic lon_grid axis, away from the poles. The limits, and the accuracy of a separation, are in the API guide and the numerics notes.

License

MIT

Download files

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

Source Distribution

lcs_parcels-2026.8.8.1.tar.gz (112.3 kB view details)

Uploaded Source

Built Distribution

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

lcs_parcels-2026.8.8.1-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file lcs_parcels-2026.8.8.1.tar.gz.

File metadata

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

File hashes

Hashes for lcs_parcels-2026.8.8.1.tar.gz
Algorithm Hash digest
SHA256 137871df114ee7af6a8eadf69be548ec024c547791b8da65d3e001b8a4d3eac1
MD5 68f0d3252863759326716c095a6c4553
BLAKE2b-256 ce717cb8c2dee713b791a1fc7a68027a9bea44c03edf6f8dfb598fb52ea8d4a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for lcs_parcels-2026.8.8.1.tar.gz:

Publisher: publish.yml on geomar-od-lagrange/lcs_parcels

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

File details

Details for the file lcs_parcels-2026.8.8.1-py3-none-any.whl.

File metadata

File hashes

Hashes for lcs_parcels-2026.8.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d3d241207ac8083dbfd98c21869cb2eaed7f8e3ebbffb7dcda1d4065a55ff3ca
MD5 c5d0ffec3650a3a02ca361890f2bc260
BLAKE2b-256 f9cb4672c0a7fe6a2227b97bd6b2459e698a025991dc236b9d4b24ba03edb77b

See more details on using hashes here.

Provenance

The following attestation bundles were made for lcs_parcels-2026.8.8.1-py3-none-any.whl:

Publisher: publish.yml on geomar-od-lagrange/lcs_parcels

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

Release history Release notifications | RSS feed

2026.8.27.1

2 files

This release

2026.8.8.1 This release

2 files

2026.8.6.1

2 files

2026.8.5.1

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