Skip to content

Commit

Permalink
Deprecate get_bbox_lonlats
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiggi committed Nov 23, 2023
1 parent 34edc5c commit 8fbf02f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 1 addition & 2 deletions docs/source/howtos/spherical_geometry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ satellite passes. See trollschedule_ how to generate a list of satellite overpas
`area_def` is an :class:`~pyresample.geometry.AreaDefinition` object.

>>> from pyresample.spherical_utils import GetNonOverlapUnions
>>> from pyresample.boundary import AreaDefBoundary

>>> area_boundary = AreaDefBoundary(area_def, frequency=100) # doctest: +SKIP
>>> area_boundary = area_def.boundary(vertices_per_side=100) # doctest: +SKIP
>>> area_boundary = area_boundary.contour_poly # doctest: +SKIP

>>> list_of_polygons = []
Expand Down
7 changes: 6 additions & 1 deletion pyresample/boundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ def set_counterclockwise(self):
self._wished_order = "counterclockwise"
return self

@property
def sides(self):
"""Return the boundary sides as a tuple of (lon_sides, lat_sides) arrays."""
return self.sides_lons, self.sides_lats

Check warning on line 151 in pyresample/boundary.py

View check run for this annotation

Codecov / codecov/patch

pyresample/boundary.py#L151

Added line #L151 was not covered by tests

@property
def lons(self):
"""Retrieve boundary longitude vertices."""
Expand Down Expand Up @@ -251,7 +256,7 @@ class AreaDefBoundary(AreaBoundary):
"""Boundaries for area definitions (pyresample)."""

def __init__(self, area, frequency=1):
lon_sides, lat_sides = area.get_bbox_lonlats()
lon_sides, lat_sides = area.boundary().sides

Check warning on line 259 in pyresample/boundary.py

View check run for this annotation

Codecov / codecov/patch

pyresample/boundary.py#L259

Added line #L259 was not covered by tests
warnings.warn("'AreaDefBoundary' will be removed in the future. " +
"Use the Swath/AreaDefinition 'boundary' method instead!.",
PendingDeprecationWarning, stacklevel=2)
Expand Down
3 changes: 3 additions & 0 deletions pyresample/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,12 @@ def get_bbox_lonlats(self, vertices_per_side: Optional[int] = None, force_clockw
if frequency is not None:
warnings.warn("The `frequency` argument is pending deprecation, use `vertices_per_side` instead",
PendingDeprecationWarning, stacklevel=2)

vertices_per_side = vertices_per_side or frequency
lon_sides, lat_sides = self._get_boundary_sides(coordinates="geographic",
vertices_per_side=vertices_per_side)
warnings.warn("`get_bbox_lonlats` is pending deprecation. Use `area.boundary().sides` instead",
PendingDeprecationWarning, stacklevel=2)
if force_clockwise and not self._corner_is_clockwise(
lon_sides[0][-2], lat_sides[0][-2],
lon_sides[0][-1], lat_sides[0][-1],
Expand Down

0 comments on commit 8fbf02f

Please sign in to comment.