Skip to main content
xeofs logo

Versions

Python Package Index (PyPI) Conda-forge Version

Build & Testing

Build Status Test Coverage

Code Quality

Black Code Style

Documentation

Documentation Status

Citation & Licensing

DOI - Zenodo License

User Engagement

PyPI - Downloads

Overview

xeofs is a Python toolbox designed for methods like Empirical Orthogonal Function (EOF) analysis, also known as Principal Component Analysis (PCA), and related variants. The package stands out due to its capacity to handle multi-dimensional Earth observation data.

Here are the key strengths of xeofs:

  • Multi-dimensional Analysis: Execute labeled EOF analysis with the extensive features of xarray.

  • Scalability: Handle large datasets effectively with dask.

  • Speed: Enjoy quick EOF analysis using scipy’s randomized SVD.

  • Variety of Methods: Perform diverse variants of EOF analysis, including complex and rotated EOF analysis, along with related techniques such as Maximum Covariance Analysis (MCA).

  • Model Validation: Validate models through bootstrapping.

  • Modular Code Structure: Incorporate new EOF variants with ease due to the package’s modular structure.

  • Flexible Data Formats: Accepts a variety of xarray input types (DataArray, Dataset, list of DataArray).

Compared to similar packages like eofs, pyEOF, and xMCA, xeofs is more comprehensive and flexible, providing unique capabilities like handling fully multidimensional dimensions (both samples and features) and a simple interface for bootstrapping. This makes xeofs a powerful one-stop-shop for most of your EOF analysis needs.

Installation

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

conda install -c conda-forge xeofs

or

pip install xeofs

Quickstart

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

Import the package

import xeofs as xe

EOF analysis

model = xe.models.EOF(n_modes=10)
model.fit(data, dim="time")
comps = model.components()  # EOFs (spatial patterns)
scores = model.scores()  # PCs (temporal patterns)

Varimax-rotated EOF analysis

rotator = xe.models.EOFRotator(n_modes=10)
rotator.fit(model)
rot_comps = rotator.components()  # Rotated EOFs (spatial patterns)
rot_scores = rotator.scores()  # Rotated PCs (temporal patterns)

MCA

model = xe.models.MCA(n_modes=10)
model.fit(data1, data2, dim="time")
comps1, comps2 = model.components()  # Singular vectors (spatial patterns)
scores1, scores2 = model.scores()  # Expansion coefficients (temporal patterns)

Varimax-rotated MCA

rotator = xe.models.MCARotator(n_modes=10)
rotator.fit(model)
rot_comps = rotator.components()  # Rotated singular vectors (spatial patterns)
rot_scores = rotator.scores()  # Rotated expansion coefficients (temporal patterns)

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

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 open a Github issue.

License

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

Contact

For questions or support, please open a Github issue.

Credits

I want to acknowledge

  • Andrew Dawson, for his foundational Python package for EOF analysis.

  • Yefee, whose work provided useful references for implementing MCA in xeofs.

  • James Chapman, creator of a Python package for Canonical Correlation Analysis.

  • Diego Bueso, for his open-source ROCK-PCA implementation in Matlab.

  • The developers of NumPy, pandas, and xarray for their indispensable tools for scientific computations in Python.

How to cite?

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

@software{rieger_xeofs_2023,
  title = {xeofs: Multi-dimensional {EOF} analysis and variants in xarray},
  url = {https://github.com/nicrie/xeofs}
  version = {1.x.y},
  author = {Rieger, Niclas},
  date = {2023},
  doi = {10.5281/zenodo.6323011}
}

Release files for xeofs 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xeofs 1.1.0
File Size Uploaded
xeofs-1.1.0.tar.gz 52.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xeofs 1.1.0
File Interpreter ABI Platform
xeofs-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 123.6 kB

Release files / xeofs-1.1.0.tar.gz

Download URL xeofs-1.1.0.tar.gz
Size 52.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ff479fadf5b019bd44a0c9ba2909f6bf19a1f3b1d90ec7f59bce2121d984960c
BLAKE2b-256 checksum
How to use checksums
e540af0cc01b6561399a21a4023ab4b27b98aada1d95b49093ed3c101c5bf7b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/41.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.4 tqdm/4.66.1 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.13

Release files / xeofs-1.1.0-py3-none-any.whl

Download URL xeofs-1.1.0-py3-none-any.whl
Size 70.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
734ef759e9ce1bfa18cb87fedd2b07ff6f6ca94e4b122c6feaf600f0bee190aa
BLAKE2b-256 checksum
How to use checksums
96277df39dc0e4d644b18f759ec115613db167b597ea85e277aabd88f1a3b5f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/41.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.4 tqdm/4.66.1 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.13

Release history Release notifications | RSS feed

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.3

2 release files

2.3.2

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.6

2 release files

2.2.5

2 release files

2.2.4

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

This release

1.1.0 This release

2 release files

1.0.5

2 release files

1.0.3

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.2.0

2 release files

0.1.2

2 release 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