From 1db0cb530cd39e6613d05ba4531fb2f9e202bd7d Mon Sep 17 00:00:00 2001 From: Justus Magin Date: Mon, 6 Jan 2025 16:52:31 +0100 Subject: [PATCH] adapt to changes in the API of `xdggs` (#55) * adapt to the changed name of the `grid_info` param * use the new name of the kwarg --- healpix_convolution/padding.py | 4 ++-- healpix_convolution/tests/test_kernels.py | 2 +- healpix_convolution/tests/test_padding.py | 4 ++-- healpix_convolution/xarray/kernels/gaussian.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/healpix_convolution/padding.py b/healpix_convolution/padding.py index acee7fc..c402ce9 100644 --- a/healpix_convolution/padding.py +++ b/healpix_convolution/padding.py @@ -140,7 +140,7 @@ def agg_mode(cell_ids, neighbours, grid_info, *, agg, ring): pad_neighbours = search_neighbours( new_cell_ids, - resolution=grid_info.resolution, + resolution=grid_info.level, indexing_scheme=grid_info.indexing_scheme, ring=ring, ) @@ -226,7 +226,7 @@ def pad( # plus a method to apply the padding to data. neighbours = search_neighbours( cell_ids, - resolution=grid_info.resolution, + resolution=grid_info.level, indexing_scheme=grid_info.indexing_scheme, ring=ring, ) diff --git a/healpix_convolution/tests/test_kernels.py b/healpix_convolution/tests/test_kernels.py index fa4de35..ee1d90b 100644 --- a/healpix_convolution/tests/test_kernels.py +++ b/healpix_convolution/tests/test_kernels.py @@ -345,7 +345,7 @@ def test_gaussian_kernel(self, obj, kwargs): reconstructed_sigma = reconstruct_sigma( obj.cell_ids.data, actual.data, - resolution=grid_info.resolution, + resolution=grid_info.level, indexing_scheme=grid_info.indexing_scheme, **kwargs, ) diff --git a/healpix_convolution/tests/test_padding.py b/healpix_convolution/tests/test_padding.py index e9d6008..1d01a79 100644 --- a/healpix_convolution/tests/test_padding.py +++ b/healpix_convolution/tests/test_padding.py @@ -147,7 +147,7 @@ class TestArray: ), ) def test_pad(self, dask, ring, mode, kwargs, expected_cell_ids, expected_data): - grid_info = xdggs.healpix.HealpixInfo(resolution=4, indexing_scheme="nested") + grid_info = xdggs.healpix.HealpixInfo(level=4, indexing_scheme="nested") cell_ids = np.array([172, 173]) if not dask: @@ -302,7 +302,7 @@ class TestXarray: def test_pad( self, dask, ring, mode, kwargs, expected_cell_ids, expected_data, type_ ): - grid_info = xdggs.healpix.HealpixInfo(resolution=4, indexing_scheme="nested") + grid_info = xdggs.healpix.HealpixInfo(level=4, indexing_scheme="nested") cell_ids = np.array([172, 173]) if not dask: diff --git a/healpix_convolution/xarray/kernels/gaussian.py b/healpix_convolution/xarray/kernels/gaussian.py index e50f252..d1164b5 100644 --- a/healpix_convolution/xarray/kernels/gaussian.py +++ b/healpix_convolution/xarray/kernels/gaussian.py @@ -10,7 +10,7 @@ def compute_ring(grid_info, sigma, kernel_size, truncate): else: import healpy as hp - cell_distance = hp.nside2resol(2**grid_info.resolution, arcmin=False) + cell_distance = hp.nside2resol(2**grid_info.level, arcmin=False) return int((truncate * sigma / cell_distance) // 2) @@ -46,7 +46,7 @@ def gaussian_kernel( padded_cell_ids, matrix = gaussian.gaussian_kernel( cell_ids.data, - resolution=grid_info.resolution, + resolution=grid_info.level, indexing_scheme=grid_info.indexing_scheme, sigma=sigma, truncate=truncate,