Skip to content

Commit

Permalink
Fix tests related to gradient resampling
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiggi committed Nov 22, 2023
1 parent 8eff9b4 commit 36795df
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
3 changes: 2 additions & 1 deletion pyresample/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,8 @@ def get_edge_bbox_in_projection_coordinates(self, vertices_per_side: Optional[in
warnings.warn("The `frequency` argument is pending deprecation, use `vertices_per_side` instead",
PendingDeprecationWarning, stacklevel=2)
vertices_per_side = vertices_per_side or frequency
x_sides, y_sides = self._get_boundary_sides(coordinates="projection", vertices_per_side=vertices_per_side)
x_sides, y_sides = self._get_boundary_sides(coordinates="projection",
vertices_per_side=vertices_per_side)
return np.hstack(x_sides), np.hstack(y_sides)

@property
Expand Down
15 changes: 7 additions & 8 deletions pyresample/gradient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def _get_projection_coordinates(self, datachunks):
chunks=datachunks)
src_crs = self.source_geo_def.crs
self.use_input_coords = True
except AttributeError:
except NotImplementedError:
self.src_x, self.src_y = self.source_geo_def.get_lonlats(
chunks=datachunks)
src_crs = pyproj.CRS.from_string("+proj=longlat")
Expand All @@ -116,7 +116,7 @@ def _get_projection_coordinates(self, datachunks):
self.dst_x, self.dst_y = self.target_geo_def.get_proj_coords(
chunks=CHUNK_SIZE)
dst_crs = self.target_geo_def.crs
except AttributeError as err:
except NotImplementedError as err:
if self.use_input_coords is False:
raise NotImplementedError('Cannot resample lon/lat to lon/lat with gradient search.') from err
self.dst_x, self.dst_y = self.target_geo_def.get_lonlats(
Expand All @@ -137,12 +137,11 @@ def _get_src_poly(self, src_y_start, src_y_end, src_x_start, src_x_end):
"""Get bounding polygon for source chunk."""
geo_def = self.source_geo_def[src_y_start:src_y_end,
src_x_start:src_x_end]
try:
src_poly = get_polygon(self.prj, geo_def)
except AttributeError:
# Can't create polygons for SwathDefinition
src_poly = False

if isinstance(geo_def, SwathDefinition):
return False

# NOTE: th code below could be used to return a polygon also for SwathDefinition object
src_poly = get_polygon(self.prj, geo_def)
return src_poly

def _get_dst_poly(self, idx, dst_x_start, dst_x_end,
Expand Down

0 comments on commit 36795df

Please sign in to comment.