-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Breaking changes: change spherical harmonic index nomenclature to 'nm…
…' and consistently use negative orders for Sine coefficients. Also improve documentation, and decide on numpy doctring style
- Loading branch information
1 parent
1107a23
commit 994b43a
Showing
24 changed files
with
1,227 additions
and
1,587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Python API Reference | ||
==================== | ||
|
||
API Reference | ||
============= | ||
The calling | ||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,32 @@ | ||
Installation and General Usage | ||
============================== | ||
The latest **shxarray** is hosted on `pypi <https://pypi.org/project/shxarray/>`_ and can be installed through pip: | ||
|
||
``pip install shxarray`` | ||
|
||
Part of the module is written is `Cython <https://cython.readthedocs.io/en/latest/>`_, which means that a c compiler is needed to build the package. A binary wheel is currently not offered, but this may be offered in the future. | ||
|
||
Import and usage | ||
---------------- | ||
For most operations, a simple import will expose the xarray extensions. For example: | ||
|
||
.. code-block:: python | ||
import shxarray | ||
import xarray as xr | ||
#Initialize a dataarray with zeros which has a dimension spanning degrees from nmin to nmax | ||
nmax=20 | ||
nmin=2 | ||
dazeros=xr.DataArray.sh.ones(nmax=nmax,nmin=nmin) | ||
Development | ||
----------- | ||
Users interested in developing can install the latest version from `github <https://github.com/ITC-Water-Resources/shxarray/tree/main>`_. Cython is needed in case the binary extension is being developed, and users can consult the dedicated instructions on the github repository. | ||
|
||
Code can be supplied with `numpy docstrings <https://www.sphinx-doc.org/en/master/usage/extensions/example_numpy.html>`_ so they can be parsed into this documentation. | ||
|
||
|
||
The latest **shxarray** can be installed through ``pip install shxarray`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,26 @@ | ||
Introduction | ||
============ | ||
|
||
The shxarray package is aimed to make using spherical harmonic operations more accessible to a community which is used to xarray. | ||
The **shxarray** package is aimed to make using spherical harmonic operations more accessible to a community which is used to xarray. | ||
|
||
Putting degrees and orders in a MultiIndex | ||
------------------------------------------ | ||
|
||
Spherical harmonic coefficients are often put in 2-dimensional arrays with degree and order spanning the 2 dimensions. This has the advantage that individual coefficients can be easily referenced as e.g. `cnm=mat[n,m]`. However, since only the upper triangle of those matrices are non-zero, the sparseness of these matrices is not made use of. When working with large datasets which also span other dimensions such as time or different levels, this will cause large segments of zeros. | ||
|
||
A `pandas.MultiIndex <https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.MultiIndex.html>`_ can facilitate the stacking of degrees and orders in a single dimension. On top of that, this multindex can then be used in `xarray` to work with spherical harmonics along a single coordinate. In **shxarray**, the spherical harmonic index is generally denoted as ``nm``, while when two spherical harmonic coordinates are needed alternative versions such as ``nm_`` are added. | ||
|
||
Exposing spherical harmonic functionality to xarray | ||
--------------------------------------------------- | ||
|
||
Some of the functionality needed for working with spherical harmonics need specialized access to the degree and order information. The aim of **shxarray** is to expose common functionality through `xarray accessors <https://docs.xarray.dev/en/stable/internals/extending-xarray.html>`_. This allows, besides familiar syntax for xarray users, also chaining of operations in a compact syntax. | ||
|
||
Delegate common operations to xarray | ||
------------------------------------ | ||
|
||
In contrast to specialized spherical harmonic operations, many operations on spherical harmonic data can be delegated to xarray itself. Wherever possible, functionality and broadcasting features of xarray are made use for a consistent syntax. | ||
|
||
|
||
|
||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.