xeofs

xeofs: Comprehensive EOF analysis in Python with xarray - Published in JOSS (2024)

https://github.com/xarray-contrib/xeofs

Science Score: 67.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 4 DOI reference(s) in README
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.8%) to scientific vocabulary

Keywords

climate-science dask dimensionality-reduction eof-analysis pattern-recognition pca xarray

Keywords from Contributors

electronic-healthcare-data irregular-time-series

Scientific Fields

Mathematics Computer Science - 84% confidence
Artificial Intelligence and Machine Learning Computer Science - 62% confidence
Engineering Computer Science - 60% confidence
Last synced: 6 months ago · JSON representation ·

Repository

Comprehensive EOF analysis in Python with xarray: A versatile, multidimensional, and scalable tool for advanced climate data analysis

Basic Info
Statistics
  • Stars: 122
  • Watchers: 6
  • Forks: 23
  • Open Issues: 18
  • Releases: 45
Topics
climate-science dask dimensionality-reduction eof-analysis pattern-recognition pca xarray
Created about 4 years ago · Last pushed about 1 year ago
Metadata Files
Readme License Code of conduct Citation

README.md

xeofs logo

| Versions | [![PyPI](https://img.shields.io/pypi/v/xeofs)](https://pypi.org/project/xeofs/) [![Conda](https://img.shields.io/conda/vn/conda-forge/xeofs)](https://anaconda.org/conda-forge/xeofs) | |----------------------------|:---------------------------------------------------------------------------------------------:| | Build & Testing | [![Build](https://img.shields.io/github/actions/workflow/status/xarray-contrib/xeofs/ci.yml?branch=main)](https://github.com/xarray-contrib/xeofs/actions/workflows/ci.yml) [![codecov](https://codecov.io/github/nicrie/xeofs/branch/main/graph/badge.svg?token=8040ZDH6U7)](https://codecov.io/github/nicrie/xeofs) | | Code Quality | ![Black](https://img.shields.io/badge/code%20style-black-000000.svg) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v0.json)](https://github.com/charliermarsh/ruff) | | Documentation | [![Docs](https://readthedocs.org/projects/xeofs/badge/?version=latest)](https://xeofs.readthedocs.io/en/latest/index.html) | | Citation | [![JOSS](https://joss.theoj.org/papers/4f50349ee1777b8a61761183047b1180/status.svg)](https://joss.theoj.org/papers/4f50349ee1777b8a61761183047b1180) [![Zenodo](https://zenodo.org/badge/DOI/10.5281/zenodo.6323012.svg)](https://zenodo.org/doi/10.5281/zenodo.6323011) | Licensing | [![License](https://img.shields.io/pypi/l/xeofs)](https://github.com/xarray-contrib/xeofs/blob/main/LICENSE) | | User Engagement | ![Downloads](https://img.shields.io/pypi/dw/xeofs) |

Overview

xeofs is a specialized Python package designed for dimensionality reduction in climate science, aimed at extracting meaningful patterns from large datasets. It provides eigenmethods such as Principal Component Analysis (EOF analysis) and several related variants. Seamlessly integrated with xarray and Dask, xeofs enables efficient handling and scalable computation of large, multi-dimensional datasets.

  • Multi-Dimensional: Designed for xarray objects, it applies dimensionality reduction to multi-dimensional data while maintaining data labels.
  • Dask-Integrated: Supports large datasets via Dask xarray objects
  • Extensive Methods: Offers various dimensionality reduction techniques
  • Adaptable Output: Provides output corresponding to the type of input, whether single or list of xr.DataArray or xr.Dataset
  • Missing Values: Handles NaN values within the data
  • Bootstrapping: Comes with a user-friendly interface for model evaluation using bootstrapping
  • Efficient: Ensures computational efficiency, particularly with large datasets through randomized SVD
  • Modular: Allows users to implement and incorporate new dimensionality reduction methods

Installation

To install the package, use either of the following commands:

bash conda install -c conda-forge xeofs

or

bash pip install xeofs

Quickstart

In order to get started with xeofs, follow these simple steps:

Import the package

```python

import xarray as xr # for example data only import xeofs as xe

```

Load example data

```python

t2m = xr.tutorial.opendataset("airtemperature") t2mwest = t2m.isel(lon=slice(None, 20)) t2meast = t2m.isel(lon=slice(21, None))

```

EOF analysis Initiate and fit the EOF/PCA model to the data

```python

eof = xe.single.EOF(n_modes=10) eof.fit(t2m, dim="time") # doctest: +ELLIPSIS

``` Now, you can access the model's EOF components and PC scores:

```py

comps = eof.components() # EOFs (spatial patterns) scores = eof.scores() # PCs (temporal patterns)

```

Varimax-rotated EOF analysis Initiate and fit an EOFRotator class to the model to obtain a varimax-rotated EOF analysis

```python

rotator = xe.single.EOFRotator(nmodes=3) rotator.fit(eof) # doctest: +ELLIPSIS <xeofs.single.eofrotator.EOFRotator object at ...>

rotcomps = rotator.components() # Rotated EOFs (spatial patterns) rotscores = rotator.scores() # Rotated PCs (temporal patterns)

```

Maximum Covariance Analysis (MCA)

```python

mca = xe.cross.MCA(nmodes=10) mca.fit(t2mwest, t2m_east, dim="time") # doctest: +ELLIPSIS

comps1, comps2 = mca.components() # Singular vectors (spatial patterns) scores1, scores2 = mca.scores() # Expansion coefficients (temporal patterns)

```

Varimax-rotated MCA

```python

rotator = xe.cross.MCARotator(nmodes=10) rotator.fit(mca) # doctest: +ELLIPSIS <xeofs.cross.mcarotator.MCARotator object at ...>

rotcomps = rotator.components() # Rotated singular vectors (spatial patterns) rotscores = rotator.scores() # Rotated expansion coefficients (temporal patterns)

```

To further explore the capabilities of xeofs, check out the available documentation and examples. For a full list of currently available methods, see the Reference API.

Documentation

For a more comprehensive overview and usage examples, visit the documentation.

Contributing

Contributions are highly welcomed and appreciated. If you're interested in improving xeofs or fixing issues, please read our Contributing Guide.

License

This project is licensed under the terms of the MIT license.

Contact

For questions or support, please open a Github issue.

Credits

  • Randomized PCA: scikit-learn
  • EOF analysis: Python package eofs by Andrew Dawson
  • MCA: Python package xMCA by Yefee
  • CCA: Python package CCA-Zoo by James Chapman
  • ROCK-PCA: Matlab implementation by Diego Bueso
  • Sparse PCA: Based on Ristretto library by Benjamin Erichson

How to cite?

When using xeofs, kindly remember to cite the original references of the methods employed in your work. Additionally, if xeofs is proving useful in your research, we'd appreciate if you could acknowledge its use with the following citation:

bibtex @article{rieger_xeofs_2024, author = {Rieger, Niclas and Levang, Samuel J.}, doi = {10.21105/joss.06060}, journal = {Journal of Open Source Software}, month = jan, number = {93}, pages = {6060}, title = {{xeofs: Comprehensive EOF analysis in Python with xarray}}, url = {https://joss.theoj.org/papers/10.21105/joss.06060}, volume = {9}, year = {2024} }

Contributors

Contributors

Owner

  • Name: xarray-contrib
  • Login: xarray-contrib
  • Kind: organization

xarray compatible projects

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Rieger"
  given-names: "Niclas"
  orcid: "https://orcid.org/0000-0003-3357-1742"
- family-names: "Levang"
  given-names: "Samuel J."
title: "xeofs"
abstract: "Comprehensive EOF analysis in Python with xarray."
license: MIT
doi: 10.5281/zenodo.6323011
url: "https://xeofs.readthedocs.io/en/latest/"
repository-code: "https://github.com/xarray-contrib/xeofs"
preferred-citation:
  authors:
  - family-names: "Rieger"
    given-names: "Niclas"
    orcid: "https://orcid.org/0000-0003-3357-1742"
  - family-names: "Levang"
    given-names: "Samuel J."
  date-published: "2024-01-02"
  doi: 10.21105/joss.06060
  issn: 2475-9066
  issue: 93
  journal: "Journal of Open Source Software"
  publisher: 
    name: "Open Journals"
  start: 6060
  title: "xeofs: Comprehensive EOF analysis in Python with xarray"
  type: article
  url: "https://joss.theoj.org/papers/10.21105/joss.06060"
  volume: 9

GitHub Events

Total
  • Issues event: 16
  • Watch event: 17
  • Delete event: 2
  • Issue comment event: 21
  • Push event: 5
  • Pull request event: 3
  • Pull request review event: 1
  • Pull request review comment event: 1
  • Fork event: 2
  • Create event: 2
Last Year
  • Issues event: 16
  • Watch event: 17
  • Delete event: 2
  • Issue comment event: 21
  • Push event: 5
  • Pull request event: 3
  • Pull request review event: 1
  • Pull request review comment event: 1
  • Fork event: 2
  • Create event: 2

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 560
  • Total Committers: 10
  • Avg Commits per committer: 56.0
  • Development Distribution Score (DDS): 0.152
Past Year
  • Commits: 63
  • Committers: 5
  • Avg Commits per committer: 12.6
  • Development Distribution Score (DDS): 0.333
Top Committers
Name Email Commits
Niclas Rieger n****r@g****m 475
github-actions g****s@g****m 30
Sam Levang 3****g 24
github-actions[bot] g****] 11
github-actions a****n@g****m 8
semantic-release s****e 8
arfriedman a****d@g****m 1
Mattia Almansi m****i@b****u 1
Damien Irving i****n@g****m 1
Aaron Spring a****g 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 57
  • Total pull requests: 72
  • Average time to close issues: 14 days
  • Average time to close pull requests: about 11 hours
  • Total issue authors: 21
  • Total pull request authors: 3
  • Average comments per issue: 1.72
  • Average comments per pull request: 0.61
  • Merged pull requests: 71
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 23
  • Pull requests: 26
  • Average time to close issues: 5 days
  • Average time to close pull requests: about 9 hours
  • Issue authors: 10
  • Pull request authors: 3
  • Average comments per issue: 1.09
  • Average comments per pull request: 0.46
  • Merged pull requests: 26
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • nicrie (32)
  • vdevauxchupin (3)
  • n0rdp0l (2)
  • arfriedman (2)
  • agirnow (2)
  • SHEN-Cheng (2)
  • mschulzie (2)
  • jiwon-j (2)
  • thelightonmyway (1)
  • roxyboy (1)
  • navidcy (1)
  • shenyulu (1)
  • LKPatel1 (1)
  • kafitzgerald (1)
  • singledoggy (1)
Pull Request Authors
  • nicrie (112)
  • slevang (11)
  • arfriedman (2)
Top Labels
Issue Labels
bug (22) documentation (7) new feature (5) design (3) enhancement (2) usage (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 2,026 last-month
  • Total dependent packages: 2
    (may contain duplicates)
  • Total dependent repositories: 2
    (may contain duplicates)
  • Total versions: 83
  • Total maintainers: 1
proxy.golang.org: github.com/xarray-contrib/xeofs
  • Versions: 45
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
pypi.org: xeofs

Comprehensive EOF analysis in Python with xarray: A versatile, multidimensional, and scalable tool for advanced climate data analysis

  • Versions: 38
  • Dependent Packages: 2
  • Dependent Repositories: 2
  • Downloads: 2,026 Last month
Rankings
Dependent packages count: 7.3%
Downloads: 8.2%
Stargazers count: 8.9%
Average: 9.5%
Forks count: 11.5%
Dependent repos count: 11.8%
Maintainers (1)
Last synced: about 1 year ago

Dependencies

poetry.lock pypi
  • atomicwrites 1.4.0 develop
  • attrs 21.4.0 develop
  • cftime 1.5.2 develop
  • coverage 6.3.1 develop
  • flake8 4.0.1 develop
  • iniconfig 1.1.1 develop
  • mccabe 0.6.1 develop
  • netcdf4 1.5.8 develop
  • pluggy 1.0.0 develop
  • py 1.11.0 develop
  • pycodestyle 2.8.0 develop
  • pyflakes 2.4.0 develop
  • pytest 7.0.1 develop
  • tomli 2.0.1 develop
  • appdirs 1.4.4
  • certifi 2021.10.8
  • charset-normalizer 2.0.12
  • colorama 0.4.4
  • idna 3.3
  • joblib 1.1.0
  • numpy 1.22.2
  • packaging 21.3
  • pandas 1.4.1
  • pooch 1.6.0
  • pyparsing 3.0.7
  • python-dateutil 2.8.2
  • pytz 2021.3
  • requests 2.27.1
  • scikit-learn 1.0.2
  • scipy 1.6.1
  • six 1.16.0
  • threadpoolctl 3.1.0
  • tqdm 4.64.0
  • urllib3 1.26.8
  • xarray 0.21.1
pyproject.toml pypi
  • coverage ^6.3.1 develop
  • flake8 ^4.0.1 develop
  • netCDF4 ^1.5.7 develop
  • pytest ^7.0.1 develop
  • numpy ^1.19.2
  • pandas ^1.4.1
  • pooch ^1.6.0
  • python ^3.8
  • scikit-learn ^1.0.2
  • tqdm ^4.64.0
  • xarray ^0.21.1
.github/workflows/black_formatting.yml actions
  • actions/checkout v3 composite
  • psf/black stable composite
.github/workflows/changelog.yml actions
  • BobAnkh/auto-generate-changelog v1.2.5 composite
  • actions/checkout v2 composite
.github/workflows/ci.yml actions
  • abatilo/actions-poetry v2.1.0 composite
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • codecov/codecov-action v3 composite
.github/workflows/pull-request-linting.yml actions
  • amannn/action-semantic-pull-request v5 composite
.github/workflows/release_package.yml actions
  • actions/checkout v3 composite
  • pypa/gh-action-pypi-publish release/v1 composite
  • python-semantic-release/python-semantic-release master composite
  • python-semantic-release/upload-to-gh-release main composite
docs/environment.yml pypi
  • xeofs *