onefluxpro
Formerly oneflux_preproc.
Eddy-covariance preprocessing for Python: reads raw high-frequency data, applies the standard corrections, computes covariances and fluxes, runs quality control, exports ONEFlux-compatible output.
Every processing choice (despiking, rotation, lag, spectral correction) is a named entry in a registry: selected in the configuration, swappable, recorded by the run. Comparing two analyses means comparing two lists.
Read PHILOSOPHY.md, the design rules, and ordinator's, which they extend, before contributing; ROADMAP.md says what is planned next.
Engines
A method can run this package's transcription of it or the engine's own code,
selected by name in the configuration (double_rotation@geddysoft). Each
engine is pinned as a submodule, and its methods and bindings are declared in
engines/descriptors/<engine>.json rather than written in Python.
| engine | pinned at | declared without Python | what the count means |
|---|---|---|---|
| EddyPro | 3cabe63 |
n/a | nothing of it is importable, so none of its methods carry a binding; its constants are read from source. |
| fluxmethods | 645f0dd |
32 of 32 | 32 of 32 functions we bind from it are declared in JSON alone; 0 need an adapter. |
| GEddySoft | 79df6b3 |
13 of 19 | 13 of 19 functions we bind from it are declared in JSON alone; 6 need an adapter. |
| miniflux | 6f23394 |
1 of 2 | 1 of 2 functions we bind from it are declared in JSON alone; 1 need an adapter. |
The declared without Python column counts the functions this package binds, not what the engine offers: a method nobody has tried to bind is in neither term. An adapter is not a failure -- every binding is held to the same equivalence test -- it means our role vocabulary did not stretch that far.
Steps in R or Julia
A step does not have to be Python. A method written in R or in Julia is declared the same way, selected the same way, and runs in the same pipeline:
[Corrections]
[[despiking]]
method = mad_perperiod@fluxmethods # Python
[[axis_rotation]]
method = double_rotation@fluxmethods_r # R
[[detrending]]
method = block_average@fluxmethods_julia # Julia
Each language runs in one persistent child process, with every number crossing in memory as raw float64: no file and no process per call, and the run records the file of the language that computed each step. On the FR-Gri sample, the chain above and the same chain in Python alone:
| run | despiking | rotation | detrending | identical to the Python-only run |
|---|---|---|---|---|
| Python only | Python | Python | Python | 135 of 135 variables |
| three languages | Python | R | Julia | 119 of 135, the rest to 1.3e-14 |
| the other way | Python | Julia | R | 119 of 135, the rest to 1.3e-14 |
R and Julia are bit-identical to each other. The 16 variables that differ from
Python do so by one bit of the rotation angle, and the cause is on the Python
side: with math.atan2 in place of numpy.arctan2, all three runs are
identical in all 135 variables.
examples/languages.ipynb walks through it with
its outputs: one method in three files, one pipeline run three times, the
explanation, and one run with a language at each step.
docs/meta/other_languages.md has the set-up and
the measurements. R (Rscript, with jsonlite) and Julia are optional: without
one, its steps refuse at the first call and say what to install.
Install
Python 3.10+. Install the latest release from PyPI:
pip install onefluxpro
Or the development tree from GitHub:
pip install git+https://github.com/pedrohenriquecoimbra/ONEFluxPro
Or from a checkout:
git clone https://github.com/pedrohenriquecoimbra/ONEFluxPro
git -C ONEFluxPro submodule update --init third_party/fluxmethods
pip install -e ONEFluxPro
The second line is not optional. The methods themselves (despiking, rotation,
lag, spectral, density) are kept in
fluxmethods, a
collection of plain functions pinned here as a submodule, and the package runs
those files rather than a copy of them. It is not on PyPI: a wheel carries the
pinned tree inside it, so pip install onefluxpro needs nothing more.
Optional extras:
pip install -e "ONEFluxPro[era5]" # ERA5 reanalysis download (cdsapi)
pip install -e "ONEFluxPro[geddysoft]" # GEddySoft instrument-problem test (diptest, statsmodels)
pip install -e "ONEFluxPro[test]" # the test suite, and `reproduce`'s tables
pip install -e "ONEFluxPro[docs]" # sphinx-build
Run it
From the repository root:
import os
import onefluxpro as o
from configobj import ConfigObj
setup = ConfigObj("examples/FR-Gri_20220514/config_L0.txt")
setup["Options"]["datetimerange"] = "202205130000-202205130030"
os.chdir("data") # the config's input paths resolve here
data = o.standard_run(setup) # -> xarray.Dataset
print(data[["ustar", "wind_dir", "FC"]])
standard_run returns the dataset and writes nothing. To also write NetCDF,
ONEFlux CSV and provenance manifest, still from data/:
o.main("../examples/FR-Gri_20220514/config_L0.txt", dst="output/")
Config input paths are relative to the working directory; the example reads
sample/FR-Gri_20220514/FLUX, which lives under data/. On the command line pass
--workdir; -o resolves there too.
Command line and web UI
The package installs onefluxpro. list, describe and validate read
the live registry, so a registered method appears at once:
onefluxpro tutorial # getting-started walkthrough
onefluxpro list # registered methods (--all adds internal and deprecated ones)
onefluxpro describe despiking mad_perperiod@fluxmethods # scope, references, signature, docs
onefluxpro engines # processing engines, and which are runnable here
onefluxpro import --engine eddypro \
--setup FR-Gri.eddypro --metadata FR-Gri.metadata my_config_L0.txt # a foreign setup, as a config of ours
onefluxpro validate -c examples/FR-Gri_20220514/config_L0.txt
onefluxpro install-plugins -c examples/FR-Gri_20220514/config_L0.txt # pip-install the plugins a config declares
onefluxpro run -c examples/FR-Gri_20220514/config_L0.txt \
--from 202205130000 --to 202205130030 -o output/ --workdir data
onefluxpro gui # http://localhost:8765/
run also takes --set KEY=VALUE (a dotted path into the config, repeatable,
for this run only — every override is recorded in the manifest),
--diagnostic (keep the high-frequency series so before/after diagnostics
exist; use a short window; without it the config's Options.keep_raw decides) and --permissive (a refusing step is skipped and
the waiver recorded, rather than stopping the run). Two more subcommands serve
narrower needs: reproduce re-runs the published engine comparisons and
rebuilds their tables, and engine-spec emits this package's engine-manifest
descriptor (--cwl for a CWL CommandLineTool instead).
The web UI renders the catalogue and the run form from the same registry. Runs are
cancellable child processes with a live log; results offer a NetCDF download, a
diagnostics gallery and a history that reopens past runs. An engine picker
selects which engine runs — this package by default, EddyPro-RP and GEddySoft
when their programs are there, the same choice run --engine offers on the
command line — and the Setup editor opens a foreign configuration (EddyPro
.eddypro + .metadata, GEddySoft .ini) as its own sections, writing back
only the keys that changed. Any run with an output directory writes a
provenance manifest (code and library versions, config hash, inputs, seeds,
warnings) beside its NetCDF.
scripts/gui.cmd (Windows) and scripts/gui.sh (Unix) start the UI from
./.conda.
Where things are
| directory | what it holds |
|---|---|
src/ |
the onefluxpro package: the kinds, the facades, the readers and the record. Its kernel, ordinator, is a package and a repository of its own, and its methods are third_party/fluxmethods |
examples/ |
one folder per site: the configurations the published comparisons run, and the scripts that derive them |
data/ |
the data root: sample/<site>/ and run outputs. Git-ignored, distributed separately, and the directory you mount at /data |
third_party/ |
git submodules (git submodule update --init): fluxmethods, which holds this package's methods and is required, and the engine sources the comparisons read and the bridged methods call; third_party/README.md says what each is, where it is pinned and under which licence |
tests/ |
the suite, including the comparisons that carry the published assertions |
docs/ |
the Sphinx sources: user_guide/ for readers, meta/ for implementation detail |
scripts/ |
launchers and one-off helpers |
Documentation
Start with the pipeline: a run from files to fluxes, in one page; then configuration and the interfaces. Docker, the VOC setup and reproducing the comparisons cover the rest.
Development
One self-contained conda env at ./.conda covers development, the tests and the UI:
conda create --prefix ./.conda python=3.11 pip -y
./.conda/bin/python -m pip install -e ".[test]" # Windows: .\.conda\python
conda activate ./.conda
pytest # run the test suite
onefluxpro gui # launch the web UI
The docs extra (.[test,docs]) enables sphinx-build -b html docs public.
The end-to-end regression test runs on the FR-Gri sample when present and
skips otherwise, as do the engine comparisons.
Or a plain virtualenv:
python -m venv .venv && .venv/bin/pip install -e ".[test]" (Windows: .venv\Scripts\pip).
Docker
One image carries the pipeline, the web UI and the reproduction of the published comparisons. It starts the UI by default:
docker pull ghcr.io/pedrohenriquecoimbra/onefluxpro:latest
docker run --rm -p 127.0.0.1:8765:8765 -v /path/to/data:/data ghcr.io/pedrohenriquecoimbra/onefluxpro:latest
Mount the directory holding sample/ at /data;
docs/user_guide/docker.md covers the data-volume
contract, batch runs and reproduce.
License
EUPL-1.2, see LICENCE.
Metadata
Release files for onefluxpro 0.13.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| onefluxpro-0.13.0.tar.gz | 1.1 MB | Without provenance | Details for onefluxpro-0.13.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| onefluxpro-0.13.0-py3-none-any.whl | Python 3 | none | any | Details for onefluxpro-0.13.0-py3-none-any.whl |
Total release size: 1.7 MB
Release files / onefluxpro-0.13.0.tar.gz
| Download URL | onefluxpro-0.13.0.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25e86efa42e24ea907f6f27a8001991bfbbf403ad57fc66a8f5a4adea9821372
|
|
BLAKE2b-256 checksum How to use checksums |
e12801337b70c6a54198b2eede5afc60b69f27bedbaeb906fce3ca06d8d4213b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Release files / onefluxpro-0.13.0-py3-none-any.whl
| Download URL | onefluxpro-0.13.0-py3-none-any.whl |
|---|---|
| Size | 617.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce95d14296c6bed2c3bb59c3ab803f69dff6001ecea00431b69307347d2751ec
|
|
BLAKE2b-256 checksum How to use checksums |
56fec13acdf96ee164c2f9b2eb0e09000015b94255368c7ef2b8a020b69c990c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Security for onefluxpro 0.13.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.