Skip to content

Commit

Permalink
Merge branch 'main' into support-3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese authored Jan 24, 2025
2 parents 54f8729 + f16de0f commit 68839d3
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 11 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ jobs:
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
mamba-version: "1.5.10"
python-version: ${{ matrix.python-version }}
environment-file: continuous_integration/environment.yaml
activate-environment: test-environment
channels: conda-forge
conda-remove-defaults: true
channel-priority: strict

- name: Install unstable dependencies
if: matrix.experimental == true
Expand Down Expand Up @@ -85,7 +86,7 @@ jobs:
cd docs && mkdir doctest && sphinx-build -E -n -b doctest ./source ./doctest && cd ..
- name: Upload unittest coverage to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
flags: unittests
file: ./coverage.xml
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
git fetch --prune --unshallow
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
uses: pypa/cibuildwheel@v2.22.0
env:
CIBW_SKIP: "cp36-* cp37-* cp38-* cp39-* cp310-* pp* *i686 *-musllinux*"
CIBW_ARCHS: "${{ matrix.cibw_archs }}"
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
path: dist
- name: Publish package to PyPI
if: github.event.action != 'published'
uses: pypa/gh-action-pypi-publish@v1.11.0
uses: pypa/gh-action-pypi-publish@v1.12.3
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
Expand All @@ -116,7 +116,7 @@ jobs:
path: dist
- name: Publish package to PyPI
if: github.event.action == 'published'
uses: pypa/gh-action-pypi-publish@v1.11.0
uses: pypa/gh-action-pypi-publish@v1.12.3
with:
user: __token__
password: ${{ secrets.pypi_password }}
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exclude: '^$'
fail_fast: false
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.7.2'
rev: 'v0.8.6'
hooks:
- id: ruff
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -13,12 +13,12 @@ repos:
- id: check-yaml
args: [--unsafe]
- repo: https://github.com/PyCQA/bandit
rev: '1.7.10' # Update me!
rev: '1.8.0' # Update me!
hooks:
- id: bandit
args: [--ini, .bandit]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.13.0' # Use the sha / tag you want to point at
rev: 'v1.14.1' # Use the sha / tag you want to point at
hooks:
- id: mypy
additional_dependencies:
Expand Down
6 changes: 5 additions & 1 deletion pyresample/_formatting_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,18 @@ def proj_area_attrs_section(area: 'geom.AreaDefinition') -> str: # noqa F821
sorted(proj_dict.keys())]))
area_units = proj_dict.get("units", "")

resolution_bp_name = "Resolution x/y"
if proj_dict.get("proj") == "geos":
resolution_bp_name += " (SSP)"

attrs_icon = _icon("icon-file-text2")

area_attrs = ("<dl>"
f"<dt>Area name</dt><dd>{area.area_id}</dd>"
f"<dt>Description</dt><dd>{area.description}</dd>"
f"<dt>Projection</dt><dd>{proj_str}</dd>"
f"<dt>Width/Height</dt><dd>{area.width}/{area.height} Pixel</dd>"
f"<dt>Resolution x/y (SSP)</dt><dd>{resolution_str} {area_units}</dd>"
f"<dt>{resolution_bp_name}</dt><dd>{resolution_str} {area_units}</dd>"
f"<dt>Extent (ll_x, ll_y, ur_x, ur_y)</dt>"
f"<dd>{tuple(round(float(x), 4) for x in area.area_extent)}</dd>"
"</dl>"
Expand Down
2 changes: 1 addition & 1 deletion pyresample/gradient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def gradient_resampler(data, source_area, target_area, method='bilinear'):
method=method)


def gradient_resampler_indices_block(block_info=None, **kwargs):
def gradient_resampler_indices_block(block_info, **kwargs):
"""Do the gradient search resampling using block_info for areas, returning the resulting indices."""
source_area = block_info[0]["area"]
target_area = block_info[None]["area"]
Expand Down
1 change: 1 addition & 0 deletions pyresample/gradient/_gradient_search.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ cdef void one_step_gradient_search_no_gil(const data_type[:, :, :] data,

for _ in range(x_size):
if isinf(dst_x[i, j]):
j += col_step
continue
cnt = 0
while True:
Expand Down
26 changes: 25 additions & 1 deletion pyresample/test/test_gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@

from pyresample.area_config import create_area_def
from pyresample.geometry import AreaDefinition, SwathDefinition
from pyresample.gradient import ResampleBlocksGradientSearchResampler, create_gradient_search_resampler
from pyresample.gradient import (
ResampleBlocksGradientSearchResampler,
create_gradient_search_resampler,
gradient_resampler_indices,
)


class TestRBGradientSearchResamplerArea2Area:
Expand Down Expand Up @@ -624,3 +628,23 @@ def test_index_search_with_data_requested_outside_top_left_boundary(self):
self.dst_x, self.dst_y)
np.testing.assert_allclose(res_x, expected_x)
np.testing.assert_allclose(res_y, expected_y)


def test_resampling_geos_edge_to_mercator():
"""Test that projecting the edges of geos onto a mercator area does not produce unnecessary NaNs."""
source_area = AreaDefinition.from_extent(area_id="side",
projection={'ellps': 'WGS84', 'h': '35786400', 'lon_0': '0',
'no_defs': 'None', 'proj': 'geos', 'type': 'crs',
'units': 'm', 'x_0': '0', 'y_0': '0'},
area_extent=(-2483999.9974, 5121999.9947, -1739999.9982, 4809999.995),
shape=(156, 372))
dest_area = AreaDefinition.from_extent(area_id="dest",
projection={'a': '6378137', 'b': '6378137', 'k': '1', 'lat_ts': '0',
'lon_0': '0', 'nadgrids': '@null', 'no_defs': 'None',
'proj': 'merc', 'type': 'crs', 'units': 'm', 'wktext': 'None',
'x_0': '0', 'y_0': '0'},
area_extent=(-7800000.0, 8595618.56, -6073037.8378, 10321713.92),
shape=(512, 512))

res = gradient_resampler_indices(source_area, dest_area, fill_value=np.nan)
assert not np.any(np.isnan(res[:, :, -1]))

0 comments on commit 68839d3

Please sign in to comment.