This PR adds a package containing an xarray wrapper of a spherical harmonic transform roundtrip that can be completed with NVIDIA's torch_harmonics package. The roundtrip transform code itself is derived from this notebook of @oliverwm1. The xarray wrapper is based on that developed in this notebook of mine.
Some updates from that development notebook include:
Code to ensure that DataArray and Dataset level attributes are preserved in round trips.
A split of the grid parameter into forward_grid and inverse_grid components to allow for more flexibility.
Optional grid validation code to ensure that the coordinates of the grid match the expectation of the forward_grid specified. This can be disabled by setting unsafe=True.
Updating of the latitude coordinate in the case that the forward_grid does not equal the inverse_grid.
Added public API:
xtorch_harmonics.roundtrip: a function to apply a roundtrip spherical harmonic transform to all horizontally varying variables in a Dataset or to a single DataArray.
This PR adds a package containing an xarray wrapper of a spherical harmonic transform roundtrip that can be completed with NVIDIA's
torch_harmonics
package. The roundtrip transform code itself is derived from this notebook of @oliverwm1. The xarray wrapper is based on that developed in this notebook of mine.Some updates from that development notebook include:
grid
parameter intoforward_grid
andinverse_grid
components to allow for more flexibility.forward_grid
specified. This can be disabled by settingunsafe=True
.forward_grid
does not equal theinverse_grid
.Added public API:
xtorch_harmonics.roundtrip
: a function to apply a roundtrip spherical harmonic transform to all horizontally varying variables in a Dataset or to a single DataArray.Requirement changes:
torch-harmonics@git+https://github.com/NVIDIA/torch-harmonics.git@8826246cacf6c37b600cdd63fde210815ba238fd
Install
git
andgit-lfs
in the fv3net Docker image to enable installation oftorch_harmonics
from GitHub.Pin
pip
to version 20.2.4 (consistent with what we do inenvironment.yml
in fv3net) in thelint
build in CircleCI to avoid errors like this.[x] Ran
make lock_deps/lock_pip
following these instructions[x] Add PR review with license info for any additions to
constraints.txt
(example)[x] Tests added
Coverage reports (updated automatically):