Skip to content

Commit 84d5b62

Browse files
committed
Merge branch 'main' into pre-commit-ci-update-config
2 parents 91fcbba + e2c20c9 commit 84d5b62

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ jobs:
3636
uses: conda-incubator/setup-miniconda@v3
3737
with:
3838
miniforge-version: latest
39-
mamba-version: "1.5.10"
4039
python-version: ${{ matrix.python-version }}
4140
environment-file: continuous_integration/environment.yaml
4241
activate-environment: test-environment
4342
channels: conda-forge
43+
conda-remove-defaults: true
44+
channel-priority: strict
4445

4546
- name: Install unstable dependencies
4647
if: matrix.experimental == true

pyresample/gradient/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def gradient_resampler(data, source_area, target_area, method='bilinear'):
309309
method=method)
310310

311311

312-
def gradient_resampler_indices_block(block_info=None, **kwargs):
312+
def gradient_resampler_indices_block(block_info, **kwargs):
313313
"""Do the gradient search resampling using block_info for areas, returning the resulting indices."""
314314
source_area = block_info[0]["area"]
315315
target_area = block_info[None]["area"]

pyresample/gradient/_gradient_search.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ cdef void one_step_gradient_search_no_gil(const data_type[:, :, :] data,
187187

188188
for _ in range(x_size):
189189
if isinf(dst_x[i, j]):
190+
j += col_step
190191
continue
191192
cnt = 0
192193
while True:

pyresample/test/test_gradient.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@
3232

3333
from pyresample.area_config import create_area_def
3434
from pyresample.geometry import AreaDefinition, SwathDefinition
35-
from pyresample.gradient import ResampleBlocksGradientSearchResampler, create_gradient_search_resampler
35+
from pyresample.gradient import (
36+
ResampleBlocksGradientSearchResampler,
37+
create_gradient_search_resampler,
38+
gradient_resampler_indices,
39+
)
3640

3741

3842
class TestRBGradientSearchResamplerArea2Area:
@@ -624,3 +628,23 @@ def test_index_search_with_data_requested_outside_top_left_boundary(self):
624628
self.dst_x, self.dst_y)
625629
np.testing.assert_allclose(res_x, expected_x)
626630
np.testing.assert_allclose(res_y, expected_y)
631+
632+
633+
def test_resampling_geos_edge_to_mercator():
634+
"""Test that projecting the edges of geos onto a mercator area does not produce unnecessary NaNs."""
635+
source_area = AreaDefinition.from_extent(area_id="side",
636+
projection={'ellps': 'WGS84', 'h': '35786400', 'lon_0': '0',
637+
'no_defs': 'None', 'proj': 'geos', 'type': 'crs',
638+
'units': 'm', 'x_0': '0', 'y_0': '0'},
639+
area_extent=(-2483999.9974, 5121999.9947, -1739999.9982, 4809999.995),
640+
shape=(156, 372))
641+
dest_area = AreaDefinition.from_extent(area_id="dest",
642+
projection={'a': '6378137', 'b': '6378137', 'k': '1', 'lat_ts': '0',
643+
'lon_0': '0', 'nadgrids': '@null', 'no_defs': 'None',
644+
'proj': 'merc', 'type': 'crs', 'units': 'm', 'wktext': 'None',
645+
'x_0': '0', 'y_0': '0'},
646+
area_extent=(-7800000.0, 8595618.56, -6073037.8378, 10321713.92),
647+
shape=(512, 512))
648+
649+
res = gradient_resampler_indices(source_area, dest_area, fill_value=np.nan)
650+
assert not np.any(np.isnan(res[:, :, -1]))

0 commit comments

Comments
 (0)