Skip to content

Commit

Permalink
added resampling mode and cleaned up notebook for resasmpling
Browse files Browse the repository at this point in the history
  • Loading branch information
bonevbs committed Aug 29, 2024
1 parent 603318c commit c50fca1
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ Detailed usage of torch-harmonics, alongside helpful analysis provided in a seri
5. [Conditioning of the Gramian](./notebooks/conditioning_sht.ipynb)
6. [Solving the Helmholtz equation](./notebooks/helmholtz.ipynb)
7. [Solving the shallow water equations](./notebooks/shallow_water_equations.ipynb)
8. [Training Spherical Fourier Neural Operators](./notebooks/train_sfno.ipynb)
8. [Training Spherical Fourier Neural Operators (SFNO)](./notebooks/train_sfno.ipynb)
9. [Resampling signals on the sphere](./notebooks/resample_sphere.ipynb)

## Remarks on automatic mixed precision (AMP) support

Expand Down
209 changes: 209 additions & 0 deletions notebooks/resample_sphere.ipynb

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions torch_harmonics/resampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,17 @@ def __init__(
nlon_out: int,
grid_in: Optional[str] = "equiangular",
grid_out: Optional[str] = "equiangular",
mode: Optional[str] = "bilinear",
):

assert nlat_in <= nlat_out
assert nlon_in <= nlon_out

super().__init__()

# currently only bilinear is supported
if mode == "bilinear":
self.mode = mode
else:
raise NotImplementedError(f"unknown interpolation mode {mode}")

self.nlat_in, self.nlon_in = nlat_in, nlon_in
self.nlat_out, self.nlon_out = nlat_out, nlon_out

Expand Down

0 comments on commit c50fca1

Please sign in to comment.