drifterOI
Python code for 3D (space + time) optimal interpolation of sparse Lagrangian drifter velocities, using Gauss-Markov / Gaussian Process regression. Splits observed velocities into:
- a seasonal component: a smooth annual harmonic cycle per location,
fit as a separable spatial-Matern x per-harmonic Gauss-Markov model
(
drifterOI.seasonal_gp, solved efficiently viadatide.MultiscaleGP's block-diagonal decomposition rather than a dense joint solve), and - an eddy/synoptic residual: fit as a Vecchia-approximated Gaussian
Process over the seasonal-corrected residuals
(via
gpvecchia), to scale to the full drifter dataset without a dense covariance solve.
This is the companion code for the accompanying manuscript, submitted to Ocean Science: [preprint link]. See Citation below.
Installation
Local development install (no PyPI release yet):
git clone https://github.com/williamedge/drifterOI.git
cd drifterOI
pip install -e .
Requires Python >= 3.10 (set by the gpvecchia dependency's floor). Besides
the usual scientific Python stack, this pulls in three sibling packages from
the same research group: gpvecchia
(Vecchia-approximated GPs), datide
(Gauss-Markov / data assimilation routines), and
gptide (GP kernels, MLE/MCMC
fitting).
Quickstart
A minimal example of the separable seasonal Gauss-Markov model on synthetic
data -- the same model seasonal_gp.init_gm_scales builds for the real
pipeline, without needing the drifter dataset:
import numpy as np
from datide import MultiscaleGP
import drifterOI.seasonal_gp as sgp
from drifterOI.cov import matern32_covfunc
rng = np.random.default_rng(0)
n_obs = 200
X = np.column_stack([
rng.uniform(-100, 100, n_obs), # easting (km)
rng.uniform(-100, 100, n_obs), # northing (km)
np.sort(rng.uniform(0, 200, n_obs)), # time (days)
])
Y = rng.normal(size=n_obs) # observed velocity component
# [sigma, lx, ly, lt]: spatial Matern prior for the seasonal coefficients
B_params = [1.0, 50.0, 50.0, 5.0]
R = np.eye(n_obs) * 0.05 # observation noise covariance
H_list, scales, design = sgp.init_gm_scales(X, matern32_covfunc, B_params, mean=True)
model = MultiscaleGP(H_list, scales, R)
param_stack = model.conditional_mean(Y) # (n_params, n_obs) harmonic coefficients
seasonal_fit = sgp.apply_harmonic_design(design, param_stack)
eddy_residual = Y - seasonal_fit
Pipeline
The scripts/ directory holds the full analysis pipeline behind the
manuscript, in stages (each stage reads the previous stage's saved output):
| Stage | Purpose |
|---|---|
L0_processing/ |
Raw drifter/bathymetry inspection and pre-processing notebooks |
L1_inference/ |
Fit the seasonal + eddy Gauss-Markov/Vecchia-GP model to drifter observations (MLE + MCMC) |
L2_predict_seasonal/ |
Predict the seasonal field on a spatial grid or at a fixed point, from the L1 fit |
L3_predict_eddy/ |
Predict the eddy/synoptic field and derive stream function / velocity potential |
L4_plot_results/ |
Manuscript figures and comparisons against reference (e.g. BLUElink) products |
Example data (data/) is included in the repository so the L1-L2
scripts can be run directly (BODY_drifters_6_hours.nc drifter
observations, SUNTANS_bathy_unstructured.nc bathymetry for plotting).
data/, scripts/, and tests/ aren't part of the installable package
(pip install drifterOI won't fetch them) -- clone the repo if you want
the example data or to run the pipeline scripts yourself.
Citation
If you use this code, please cite it as described in
CITATION.cff. Once published, the accompanying Ocean
Science manuscript will be the preferred citation -- see
[preprint link] in the meantime.
License
BSD-3-Clause -- see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file drifteroi-0.1.0.tar.gz.
File metadata
- Download URL: drifteroi-0.1.0.tar.gz
- Upload date:
- Size: 30.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
232624fd8b7d0b44534875793c52621c3eb0f9b69d223f06916d2720cc170ce8
|
|
| MD5 |
8597bd00fc4418ae7459dfe17cca550f
|
|
| BLAKE2b-256 |
fc8100175a75f013aef6a16e1627252c4d95dcbf5fec85c3985e565481b27a77
|
Provenance
The following attestation bundles were made for drifteroi-0.1.0.tar.gz:
Publisher:
publish.yml on williamedge/drifterOI-public
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
drifteroi-0.1.0.tar.gz -
Subject digest:
232624fd8b7d0b44534875793c52621c3eb0f9b69d223f06916d2720cc170ce8 - Sigstore transparency entry: 2497180391
- Sigstore integration time:
-
Permalink:
williamedge/drifterOI-public@b2f9bc298ebab83549de32ca5e78a4b39744ac42 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/williamedge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b2f9bc298ebab83549de32ca5e78a4b39744ac42 -
Trigger Event:
release
-
Statement type:
File details
Details for the file drifteroi-0.1.0-py3-none-any.whl.
File metadata
- Download URL: drifteroi-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45d9e3c11936ff29d14be223183e7db8bd7cd9afe22b172c2e6eaf6a1ecd62b7
|
|
| MD5 |
15b4c806766e8eb968d320c9107d6493
|
|
| BLAKE2b-256 |
f214d0221b521b54a3652c11cfcfdd9bb901980cb18979bf89415f195c019658
|
Provenance
The following attestation bundles were made for drifteroi-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on williamedge/drifterOI-public
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
drifteroi-0.1.0-py3-none-any.whl -
Subject digest:
45d9e3c11936ff29d14be223183e7db8bd7cd9afe22b172c2e6eaf6a1ecd62b7 - Sigstore transparency entry: 2497180456
- Sigstore integration time:
-
Permalink:
williamedge/drifterOI-public@b2f9bc298ebab83549de32ca5e78a4b39744ac42 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/williamedge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b2f9bc298ebab83549de32ca5e78a4b39744ac42 -
Trigger Event:
release
-
Statement type: