lagrangian-filtering

Temporal filtering of data in a Lagrangian frame of reference.

https://github.com/angus-g/lagrangian-filtering

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.2%) to scientific vocabulary
Last synced: 7 months ago · JSON representation ·

Repository

Temporal filtering of data in a Lagrangian frame of reference.

Basic Info
  • Host: GitHub
  • Owner: angus-g
  • License: mit
  • Language: Python
  • Default Branch: master
  • Size: 239 KB
Statistics
  • Stars: 25
  • Watchers: 4
  • Forks: 12
  • Open Issues: 18
  • Releases: 0
Created over 6 years ago · Last pushed about 2 years ago
Metadata Files
Readme Contributing License Citation

README.md

lagrangian-filtering

Temporal filtering of data in a Lagrangian frame of reference. Visit the documentation, or continue reading below.

Overview

This provides a library and a post-processing analysis tool for the removal of sub-inertial frequencies from data in a Lagrangian frame of reference. This may be useful, for example, for distinguishing stationary internal waves. At a high level, the algorithm looks like:

  1. particle advection using OceanParcels
  2. sampling of data (e.g. velocity, density) along particle tracks
  3. temporal filtering
  4. writing filtered data back to disk

Citing

The description and analysis of the Lagrangian filtering method has been published in JAMES, and can be cited as:

Shakespeare, C. J., Gibson, A. H., Hogg, A. M., Bachman, S. D., Keating, S. R., & Velzeboer, N. (2021). A new open source implementation of Lagrangian filtering: A method to identify internal waves in high-resolution simulations. Journal of Advances in Modeling Earth Systems, 13, e2021MS002616. https://doi.org/10.1029/2021MS002616

Installation

Using Conda

If you use Conda to manage Python packages, you may simply run conda install -c angus-g -c conda-forge lagrangian-filtering to install this package and its required dependencies. You may want to constrain this to its own conda environment instead, with conda create -n filtering -c angus-g -c conda-forge lagrangian-filtering. The environment can be activated with conda activate filtering and deactivated with conda deactivate.

Using pip or developing

If you don't use Conda, or are looking to develop this package, it is easier to get started using Python's pip package manager. Optionally, the package can be installed inside a virtualenv virtual environment, for cleaner separation from your native Python environment. There are very few dependencies, but a custom branch of OceanParcels is necessary to get acceptable performance at the moment, and the GCC compiler with OpenMP support is also required to compile the runtime kernels. During the development phase, I recommend installing this as a "development package", meaning that changes to your local checkout are instantly reflected in your Python environment.

  1. Clone this repository git clone https://github.com/angus-g/lagrangian-filtering
  2. Change to the directory cd lagrangian-filtering
  3. (Optional) Create the virtualenv virtualenv env and activate it source env/bin/activate
  4. Install the development version of the package pip install -e .
  5. Install the dependencies required for parcels pip install -r requirements.txt

Upgrading

With the package installed in development mode, updating is as easy as git pull (or making local changes) in the lagrangian-filtering directory. If dependencies (particularly parcels) need to be updated, run pip install --upgrade --upgrade-strategy eager . to force installation of the new versions.

Usage

For the moment, it's easiest to set up the filtering workflow in a script or a jupyter notebook. An example looks like:

```python import filtering from datetime import timedelta

filenames = { "U": "/data/datawaveU.nc", "V": "/data/datawaveV.nc" } variables = {"U": "U", "V": "V"} dimensions = {"lon": "X", "lat", "Y", "time": "T"}

f = filtering.LagrangeFilter( "waves", filenames, variables, dimensions, samplevariables=["U"], mesh="flat", windowsize=timedelta(days=2).total_seconds() )

f() ```

This uses velocity data from the two specified files. Zonal velocity data from the U variable will be sampled and filtered, with a filtering window for 2 days on either side of each sample (i.e. a 4-day window for filtering).

3D input data

For 3D input data (i.e. with a Z dimension), there are a couple of options. Running the filtering as the example above will load only the first Z slice (likely the surface). For more precise control of the Z dimension, modify the dimensions dictionary, and specify the level to load in the indices dictionary. For example, to load only the 21st Z slice:

```python dimensions = {"lon": "X", "lat": "Y", "time": "T", "depth", "Z"} indices = {"depth": [20]}

f = filtering.LagrangeFilter( ... # other parameters as normal indices=indices, ... # any other keyword parameters ) ```

Beware that specifyng the depth dimension without restricting its indices will load data through full depth, however particles will only be seeded at the top. This would be a huge expense for no gain!

Owner

  • Name: Angus Gibson
  • Login: angus-g
  • Kind: user
  • Company: The Australian National University

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
title: "Lagrangian Filtering"
doi: 10.5281/zenodo.4722045
type: software
date-released: 2021-04-27
url: "https://github.com/angus-g/lagrangian-filtering"
authors:
  - family-names: Gibson
    given-names: Angus H.
    orcid: https://orcid.org/0000-0001-7577-3604
  - family-names: Shakespeare
    given-names: Callum J.
    orcid: https://orcid.org/0000-0002-8109-0751
preferred-citation:
  title: "A New Open Source Implementation of Lagrangian Filtering: A Method to Identify Internal Waves in High-Resolution Simulations"
  doi: 10.1029/2021MS002616
  type: article
  authors:
    - family-names: Shakespeare
      given-names: Callum J.
      orcid: https://orcid.org/0000-0002-8109-0751
    - family-names: Gibson
      given-names: Angus H.
      orcid: https://orcid.org/0000-0001-7577-3604
    - family-names: Hogg
      given-names: Andrew McC.
      orcid: https://orcid.org/0000-0001-5898-7635
    - family-names: Bachman
      given-names: Scott D.
      orcid: https://orcid.org/0000-0002-6479-4300
    - family-names: Keating
      given-names: Shane R.
      orcid: https://orcid.org/0000-0002-6817-925X
    - family-names: Velzeboer
      given-names: Nick
  journal: "Journal of Advances in Modeling Earth Systems"
  year: 2021
  volume: 13

GitHub Events

Total
  • Issue comment event: 3
  • Fork event: 3
Last Year
  • Issue comment event: 3
  • Fork event: 3

Committers

Last synced: almost 2 years ago

All Time
  • Total Commits: 151
  • Total Committers: 1
  • Avg Commits per committer: 151.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 3
  • Committers: 1
  • Avg Commits per committer: 3.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Angus Gibson a****s@a****e 151
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: almost 2 years ago

All Time
  • Total issues: 104
  • Total pull requests: 47
  • Average time to close issues: 5 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 6
  • Total pull request authors: 1
  • Average comments per issue: 0.74
  • Average comments per pull request: 0.53
  • Merged pull requests: 41
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 7
  • Pull requests: 2
  • Average time to close issues: about 4 hours
  • Average time to close pull requests: 2 days
  • Issue authors: 3
  • Pull request authors: 1
  • Average comments per issue: 1.43
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • angus-g (50)
  • ashjbarnes (2)
  • leguillf (1)
  • navidcy (1)
  • blg0116 (1)
  • Zhangxiangyu98 (1)
Pull Request Authors
  • angus-g (26)
Top Labels
Issue Labels
enhancement (24) bug (15) question (4) help wanted (3) documentation (3) testing (2) good first issue (2) invalid (1)
Pull Request Labels
testing (6) incomplete (5) enhancement (4) bug (2) backburner (1)

Dependencies

requirements.txt pypi
  • cgen *
  • progressbar2 *
  • psutil *
  • pymbolic *
setup.py pypi
  • dask *
.github/workflows/conda-build.yml actions
  • actions/checkout v2 composite
  • angus-g/conda-package-publish-action master composite
.github/workflows/tests.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • lgeiger/black-action v1.0.1 composite