spharmgrid 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spharmgrid-0.1.0/.gitignore +215 -0
- spharmgrid-0.1.0/.readthedocs.yaml +16 -0
- spharmgrid-0.1.0/.zenodo.json +30 -0
- spharmgrid-0.1.0/CITATION.cff +27 -0
- spharmgrid-0.1.0/LICENSE +28 -0
- spharmgrid-0.1.0/PKG-INFO +110 -0
- spharmgrid-0.1.0/README.md +78 -0
- spharmgrid-0.1.0/docs/_static/dark.css +115 -0
- spharmgrid-0.1.0/docs/api.md +98 -0
- spharmgrid-0.1.0/docs/cf.md +63 -0
- spharmgrid-0.1.0/docs/cli.md +56 -0
- spharmgrid-0.1.0/docs/comparison.md +34 -0
- spharmgrid-0.1.0/docs/conf.py +25 -0
- spharmgrid-0.1.0/docs/filtering.md +43 -0
- spharmgrid-0.1.0/docs/grids.md +41 -0
- spharmgrid-0.1.0/docs/index.md +57 -0
- spharmgrid-0.1.0/docs/kinematics.md +81 -0
- spharmgrid-0.1.0/docs/operators.md +80 -0
- spharmgrid-0.1.0/docs/quickstart.md +42 -0
- spharmgrid-0.1.0/docs/references.md +9 -0
- spharmgrid-0.1.0/docs/regridding.md +44 -0
- spharmgrid-0.1.0/pyproject.toml +99 -0
- spharmgrid-0.1.0/src/spharmgrid/__init__.py +63 -0
- spharmgrid-0.1.0/src/spharmgrid/_ducc.py +202 -0
- spharmgrid-0.1.0/src/spharmgrid/_vector.py +248 -0
- spharmgrid-0.1.0/src/spharmgrid/_xarray.py +232 -0
- spharmgrid-0.1.0/src/spharmgrid/accessors.py +811 -0
- spharmgrid-0.1.0/src/spharmgrid/cli.py +348 -0
- spharmgrid-0.1.0/src/spharmgrid/grids.py +453 -0
- spharmgrid-0.1.0/src/spharmgrid/kinematics.py +843 -0
- spharmgrid-0.1.0/src/spharmgrid/metadata.py +248 -0
- spharmgrid-0.1.0/src/spharmgrid/operators.py +286 -0
- spharmgrid-0.1.0/src/spharmgrid/regrid.py +156 -0
- spharmgrid-0.1.0/src/spharmgrid/spectral.py +242 -0
- spharmgrid-0.1.0/tests/__init__.py +1 -0
- spharmgrid-0.1.0/tests/conftest.py +96 -0
- spharmgrid-0.1.0/tests/optional/test_cf_xarray.py +34 -0
- spharmgrid-0.1.0/tests/optional/test_cli_file_backends.py +140 -0
- spharmgrid-0.1.0/tests/optional/test_file_backends.py +31 -0
- spharmgrid-0.1.0/tests/parity/test_pyspharm.py +499 -0
- spharmgrid-0.1.0/tests/unit/test_cli.py +62 -0
- spharmgrid-0.1.0/tests/unit/test_grids.py +123 -0
- spharmgrid-0.1.0/tests/unit/test_kinematics.py +462 -0
- spharmgrid-0.1.0/tests/unit/test_spectral.py +319 -0
- spharmgrid-0.1.0/tests/unit/test_xarray.py +213 -0
- spharmgrid-0.1.0/uv.lock +1521 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Keep the lockfile in version control for reproducible development and docs builds.
|
|
99
|
+
|
|
100
|
+
# poetry
|
|
101
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
102
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
103
|
+
# commonly ignored for libraries.
|
|
104
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
105
|
+
# poetry.lock
|
|
106
|
+
# poetry.toml
|
|
107
|
+
|
|
108
|
+
# pdm
|
|
109
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
110
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
111
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
112
|
+
# pdm.lock
|
|
113
|
+
# pdm.toml
|
|
114
|
+
.pdm-python
|
|
115
|
+
.pdm-build/
|
|
116
|
+
|
|
117
|
+
# pixi
|
|
118
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
119
|
+
# pixi.lock
|
|
120
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
121
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
122
|
+
.pixi
|
|
123
|
+
|
|
124
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
125
|
+
__pypackages__/
|
|
126
|
+
|
|
127
|
+
# Celery stuff
|
|
128
|
+
celerybeat-schedule
|
|
129
|
+
celerybeat.pid
|
|
130
|
+
|
|
131
|
+
# Redis
|
|
132
|
+
*.rdb
|
|
133
|
+
*.aof
|
|
134
|
+
*.pid
|
|
135
|
+
|
|
136
|
+
# RabbitMQ
|
|
137
|
+
mnesia/
|
|
138
|
+
rabbitmq/
|
|
139
|
+
rabbitmq-data/
|
|
140
|
+
|
|
141
|
+
# ActiveMQ
|
|
142
|
+
activemq-data/
|
|
143
|
+
|
|
144
|
+
# SageMath parsed files
|
|
145
|
+
*.sage.py
|
|
146
|
+
|
|
147
|
+
# Environments
|
|
148
|
+
.env
|
|
149
|
+
.envrc
|
|
150
|
+
.venv
|
|
151
|
+
env/
|
|
152
|
+
venv/
|
|
153
|
+
ENV/
|
|
154
|
+
env.bak/
|
|
155
|
+
venv.bak/
|
|
156
|
+
|
|
157
|
+
# Spyder project settings
|
|
158
|
+
.spyderproject
|
|
159
|
+
.spyproject
|
|
160
|
+
|
|
161
|
+
# Rope project settings
|
|
162
|
+
.ropeproject
|
|
163
|
+
|
|
164
|
+
# mkdocs documentation
|
|
165
|
+
/site
|
|
166
|
+
|
|
167
|
+
# mypy
|
|
168
|
+
.mypy_cache/
|
|
169
|
+
.dmypy.json
|
|
170
|
+
dmypy.json
|
|
171
|
+
|
|
172
|
+
# Pyre type checker
|
|
173
|
+
.pyre/
|
|
174
|
+
|
|
175
|
+
# pytype static type analyzer
|
|
176
|
+
.pytype/
|
|
177
|
+
|
|
178
|
+
# Cython debug symbols
|
|
179
|
+
cython_debug/
|
|
180
|
+
|
|
181
|
+
# PyCharm
|
|
182
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
183
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
184
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
185
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
186
|
+
# .idea/
|
|
187
|
+
|
|
188
|
+
# Abstra
|
|
189
|
+
# Abstra is an AI-powered process automation framework.
|
|
190
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
191
|
+
# Learn more at https://abstra.io/docs
|
|
192
|
+
.abstra/
|
|
193
|
+
|
|
194
|
+
# Visual Studio Code
|
|
195
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
196
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
197
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
198
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
199
|
+
# .vscode/
|
|
200
|
+
# Temporary file for partial code execution
|
|
201
|
+
tempCodeRunnerFile.py
|
|
202
|
+
|
|
203
|
+
# Ruff stuff:
|
|
204
|
+
.ruff_cache/
|
|
205
|
+
|
|
206
|
+
# PyPI configuration file
|
|
207
|
+
.pypirc
|
|
208
|
+
|
|
209
|
+
# Marimo
|
|
210
|
+
marimo/_static/
|
|
211
|
+
marimo/_lsp/
|
|
212
|
+
__marimo__/
|
|
213
|
+
|
|
214
|
+
# Streamlit
|
|
215
|
+
.streamlit/secrets.toml
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "spharmgrid",
|
|
3
|
+
"description": "Spherical harmonic tools for filtering, regridding, and kinematics in atmospheric science with xarray.",
|
|
4
|
+
"creators": [
|
|
5
|
+
{
|
|
6
|
+
"name": "Yau, Albert M. W.",
|
|
7
|
+
"orcid": "0009-0000-7825-9627"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"upload_type": "software",
|
|
11
|
+
"access_right": "open",
|
|
12
|
+
"license": "BSD-3-Clause",
|
|
13
|
+
"language": "eng",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"spherical harmonics",
|
|
16
|
+
"atmospheric science",
|
|
17
|
+
"regridding",
|
|
18
|
+
"spectral filtering",
|
|
19
|
+
"atmospheric kinematics",
|
|
20
|
+
"xarray",
|
|
21
|
+
"Python"
|
|
22
|
+
],
|
|
23
|
+
"related_identifiers": [
|
|
24
|
+
{
|
|
25
|
+
"identifier": "10.5281/zenodo.18764813",
|
|
26
|
+
"relation": "isDerivedFrom",
|
|
27
|
+
"resource_type": "software"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use spharmgrid in research, please cite the software."
|
|
3
|
+
title: spharmgrid
|
|
4
|
+
type: software
|
|
5
|
+
|
|
6
|
+
authors:
|
|
7
|
+
- family-names: Yau
|
|
8
|
+
given-names: Albert M. W.
|
|
9
|
+
orcid: "https://orcid.org/0009-0000-7825-9627"
|
|
10
|
+
|
|
11
|
+
identifiers:
|
|
12
|
+
- type: doi
|
|
13
|
+
value: "10.5281/zenodo.22546616"
|
|
14
|
+
description: "Zenodo DOI for all versions of spharmgrid."
|
|
15
|
+
|
|
16
|
+
repository-code: "https://github.com/mwyau/spharmgrid"
|
|
17
|
+
url: "https://spharmgrid.readthedocs.io/"
|
|
18
|
+
license: BSD-3-Clause
|
|
19
|
+
|
|
20
|
+
keywords:
|
|
21
|
+
- spherical harmonics
|
|
22
|
+
- atmospheric science
|
|
23
|
+
- regridding
|
|
24
|
+
- spectral filtering
|
|
25
|
+
- atmospheric kinematics
|
|
26
|
+
- xarray
|
|
27
|
+
- Python
|
spharmgrid-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Albert Yau
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: spharmgrid
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Spherical harmonic tools for filtering, regridding, and kinematics in atmospheric science with xarray
|
|
5
|
+
Project-URL: Documentation, https://spharmgrid.readthedocs.io/
|
|
6
|
+
Project-URL: Repository, https://github.com/mwyau/spharmgrid
|
|
7
|
+
Author: Albert Yau
|
|
8
|
+
License-Expression: BSD-3-Clause
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
18
|
+
Requires-Python: >=3.12
|
|
19
|
+
Requires-Dist: ducc0>=0.39.0
|
|
20
|
+
Requires-Dist: numpy>=2.0.0
|
|
21
|
+
Requires-Dist: xarray>=2025.11.0
|
|
22
|
+
Provides-Extra: cf
|
|
23
|
+
Requires-Dist: cf-xarray>=0.10.4; extra == 'cf'
|
|
24
|
+
Provides-Extra: cli
|
|
25
|
+
Requires-Dist: cfgrib>=0.9.15; extra == 'cli'
|
|
26
|
+
Requires-Dist: eccodeslib>=2.48.0.26; (sys_platform != 'win32') and extra == 'cli'
|
|
27
|
+
Requires-Dist: h5netcdf[h5py]>=1.8.0; extra == 'cli'
|
|
28
|
+
Requires-Dist: zarr>=3.0.0; extra == 'cli'
|
|
29
|
+
Provides-Extra: dask
|
|
30
|
+
Requires-Dist: dask[array]>=2024.1.0; extra == 'dask'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# spharmgrid
|
|
34
|
+
|
|
35
|
+
[](https://github.com/mwyau/spharmgrid/actions/workflows/ci.yml)
|
|
36
|
+
[](https://spharmgrid.readthedocs.io/en/latest/?badge=latest)
|
|
37
|
+
[](https://pypi.org/project/spharmgrid/)
|
|
38
|
+
[](https://pypi.org/project/spharmgrid/)
|
|
39
|
+
[](https://github.com/mwyau/spharmgrid/blob/main/LICENSE)
|
|
40
|
+
[](https://doi.org/10.5281/zenodo.22546616)
|
|
41
|
+
|
|
42
|
+
Spherical harmonic tools for filtering, regridding, and kinematics in atmospheric science with xarray.
|
|
43
|
+
|
|
44
|
+
**spharmgrid** (**sp**herical **harm**onic **grid**ding) implements spherical harmonic filtering, regridding, differential operators, and atmospheric kinematics for global xarray fields. It computes relative vorticity, divergence, streamfunction, velocity potential, Helmholtz decomposition, and inverse wind transforms. [DUCC](https://gitlab.mpcdf.mpg.de/mtr/ducc) performs the numerical spherical harmonic transforms.
|
|
45
|
+
|
|
46
|
+
Supported grids are full rectangular Gauss–Legendre (GL) and pole-including Clenshaw–Curtis (CC) grids.
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
Install with either pip or uv:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install spharmgrid
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
uv add spharmgrid
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Optional groups are:
|
|
61
|
+
|
|
62
|
+
- `spharmgrid[dask]` — Dask-backed lazy execution;
|
|
63
|
+
- `spharmgrid[cf]` — optional cf-xarray coordinate discovery;
|
|
64
|
+
- `spharmgrid[cli]` — command-line NetCDF, Zarr, and GRIB I/O.
|
|
65
|
+
|
|
66
|
+
Dask-backed transforms execute lazily. DUCC uses four threads per transform. For the local Dask scheduler, spharmgrid sets `num_workers=max(1, os.cpu_count() // 4)` unless `num_workers` is configured.
|
|
67
|
+
|
|
68
|
+
For a standalone command-line installation:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
uv tool install "spharmgrid[cli]"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
For a project environment, install the CLI extra with either:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
uv add "spharmgrid[cli]"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install "spharmgrid[cli]"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Quick start
|
|
85
|
+
|
|
86
|
+
Importing spharmgrid registers the `.sg` accessor on xarray objects. This example applies a T6–42 spectral filter to a `DataArray`:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
import xarray as xr
|
|
90
|
+
import spharmgrid
|
|
91
|
+
|
|
92
|
+
field = xr.open_dataarray("msl.nc")
|
|
93
|
+
filtered = field.sg.filter("T6-42")
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
See the [Quick start](https://spharmgrid.readthedocs.io/en/latest/quickstart.html) for regridding, atmospheric wind diagnostics, direct-function equivalents, and further examples.
|
|
97
|
+
|
|
98
|
+
## Documentation
|
|
99
|
+
|
|
100
|
+
The optional CLI reads NetCDF, Zarr, and GRIB and writes NetCDF and Zarr. See the [CLI documentation](https://spharmgrid.readthedocs.io/en/latest/cli.html) for installation and usage.
|
|
101
|
+
|
|
102
|
+
See the full [documentation](https://spharmgrid.readthedocs.io/) for grid requirements, coordinate handling, CF metadata, atmospheric kinematics, inverse transforms, zero-mode conventions, and command-line use.
|
|
103
|
+
|
|
104
|
+
## References
|
|
105
|
+
|
|
106
|
+
See the documentation [References](https://spharmgrid.readthedocs.io/en/latest/references.html) for the scientific literature and software cited by spharmgrid.
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
spharmgrid is distributed under the [BSD 3-Clause License](LICENSE).
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# spharmgrid
|
|
2
|
+
|
|
3
|
+
[](https://github.com/mwyau/spharmgrid/actions/workflows/ci.yml)
|
|
4
|
+
[](https://spharmgrid.readthedocs.io/en/latest/?badge=latest)
|
|
5
|
+
[](https://pypi.org/project/spharmgrid/)
|
|
6
|
+
[](https://pypi.org/project/spharmgrid/)
|
|
7
|
+
[](https://github.com/mwyau/spharmgrid/blob/main/LICENSE)
|
|
8
|
+
[](https://doi.org/10.5281/zenodo.22546616)
|
|
9
|
+
|
|
10
|
+
Spherical harmonic tools for filtering, regridding, and kinematics in atmospheric science with xarray.
|
|
11
|
+
|
|
12
|
+
**spharmgrid** (**sp**herical **harm**onic **grid**ding) implements spherical harmonic filtering, regridding, differential operators, and atmospheric kinematics for global xarray fields. It computes relative vorticity, divergence, streamfunction, velocity potential, Helmholtz decomposition, and inverse wind transforms. [DUCC](https://gitlab.mpcdf.mpg.de/mtr/ducc) performs the numerical spherical harmonic transforms.
|
|
13
|
+
|
|
14
|
+
Supported grids are full rectangular Gauss–Legendre (GL) and pole-including Clenshaw–Curtis (CC) grids.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
Install with either pip or uv:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install spharmgrid
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
uv add spharmgrid
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Optional groups are:
|
|
29
|
+
|
|
30
|
+
- `spharmgrid[dask]` — Dask-backed lazy execution;
|
|
31
|
+
- `spharmgrid[cf]` — optional cf-xarray coordinate discovery;
|
|
32
|
+
- `spharmgrid[cli]` — command-line NetCDF, Zarr, and GRIB I/O.
|
|
33
|
+
|
|
34
|
+
Dask-backed transforms execute lazily. DUCC uses four threads per transform. For the local Dask scheduler, spharmgrid sets `num_workers=max(1, os.cpu_count() // 4)` unless `num_workers` is configured.
|
|
35
|
+
|
|
36
|
+
For a standalone command-line installation:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
uv tool install "spharmgrid[cli]"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
For a project environment, install the CLI extra with either:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
uv add "spharmgrid[cli]"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install "spharmgrid[cli]"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Quick start
|
|
53
|
+
|
|
54
|
+
Importing spharmgrid registers the `.sg` accessor on xarray objects. This example applies a T6–42 spectral filter to a `DataArray`:
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import xarray as xr
|
|
58
|
+
import spharmgrid
|
|
59
|
+
|
|
60
|
+
field = xr.open_dataarray("msl.nc")
|
|
61
|
+
filtered = field.sg.filter("T6-42")
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
See the [Quick start](https://spharmgrid.readthedocs.io/en/latest/quickstart.html) for regridding, atmospheric wind diagnostics, direct-function equivalents, and further examples.
|
|
65
|
+
|
|
66
|
+
## Documentation
|
|
67
|
+
|
|
68
|
+
The optional CLI reads NetCDF, Zarr, and GRIB and writes NetCDF and Zarr. See the [CLI documentation](https://spharmgrid.readthedocs.io/en/latest/cli.html) for installation and usage.
|
|
69
|
+
|
|
70
|
+
See the full [documentation](https://spharmgrid.readthedocs.io/) for grid requirements, coordinate handling, CF metadata, atmospheric kinematics, inverse transforms, zero-mode conventions, and command-line use.
|
|
71
|
+
|
|
72
|
+
## References
|
|
73
|
+
|
|
74
|
+
See the documentation [References](https://spharmgrid.readthedocs.io/en/latest/references.html) for the scientific literature and software cited by spharmgrid.
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
spharmgrid is distributed under the [BSD 3-Clause License](LICENSE).
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
@media screen and (min-width: 1100px) {
|
|
2
|
+
.wy-nav-content {
|
|
3
|
+
max-width: 1200px;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
@media (prefers-color-scheme: dark) {
|
|
8
|
+
html,
|
|
9
|
+
body,
|
|
10
|
+
.wy-body-for-nav,
|
|
11
|
+
.wy-nav-content-wrap,
|
|
12
|
+
.wy-nav-content {
|
|
13
|
+
background: #17191c;
|
|
14
|
+
color: #d7dce2;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.wy-nav-side {
|
|
18
|
+
background: #111316;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.wy-side-nav-search {
|
|
22
|
+
background: #20242a;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.wy-side-nav-search input[type="text"] {
|
|
26
|
+
background: #17191c;
|
|
27
|
+
border-color: #4a515b;
|
|
28
|
+
color: #f1f3f5;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.wy-menu-vertical a {
|
|
32
|
+
color: #c8ced6;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.wy-menu-vertical a:hover,
|
|
36
|
+
.wy-menu-vertical li.current > a,
|
|
37
|
+
.wy-menu-vertical li.on a {
|
|
38
|
+
background: #252a31;
|
|
39
|
+
color: #ffffff;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.wy-menu-vertical li.current,
|
|
43
|
+
.wy-menu-vertical li.toctree-l1.current > a {
|
|
44
|
+
background: #1d2126;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.rst-content h1,
|
|
48
|
+
.rst-content h2,
|
|
49
|
+
.rst-content h3,
|
|
50
|
+
.rst-content h4,
|
|
51
|
+
.rst-content h5,
|
|
52
|
+
.rst-content h6,
|
|
53
|
+
.rst-content p,
|
|
54
|
+
.rst-content li,
|
|
55
|
+
.rst-content dt,
|
|
56
|
+
.rst-content dd,
|
|
57
|
+
.rst-content table.docutils td,
|
|
58
|
+
.rst-content table.docutils th {
|
|
59
|
+
color: #d7dce2;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.rst-content a,
|
|
63
|
+
.wy-breadcrumbs a {
|
|
64
|
+
color: #75b7ff;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.rst-content code,
|
|
68
|
+
.rst-content tt,
|
|
69
|
+
code.literal {
|
|
70
|
+
background: #24282e;
|
|
71
|
+
border-color: #3a4048;
|
|
72
|
+
color: #f0f2f4;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.highlight,
|
|
76
|
+
.highlight pre,
|
|
77
|
+
div[class^="highlight"] {
|
|
78
|
+
background: #111316;
|
|
79
|
+
color: #e6e9ed;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.rst-content table.docutils,
|
|
83
|
+
.rst-content table.field-list,
|
|
84
|
+
.rst-content table.docutils td,
|
|
85
|
+
.rst-content table.docutils th {
|
|
86
|
+
border-color: #3a4048;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td,
|
|
90
|
+
.rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) th {
|
|
91
|
+
background: #20242a;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.rst-content .admonition,
|
|
95
|
+
.rst-content .note,
|
|
96
|
+
.rst-content .warning,
|
|
97
|
+
.rst-content .seealso {
|
|
98
|
+
background: #20242a;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.rst-content blockquote {
|
|
102
|
+
border-color: #4a515b;
|
|
103
|
+
color: #c8ced6;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.wy-nav-top {
|
|
107
|
+
background: #20242a;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
footer,
|
|
111
|
+
footer p,
|
|
112
|
+
footer a {
|
|
113
|
+
color: #9ea6b0;
|
|
114
|
+
}
|
|
115
|
+
}
|