Skip to content

Commit

Permalink
Fix projected bbox issue for big hfun raster
Browse files Browse the repository at this point in the history
  • Loading branch information
SorooshMani-NOAA committed Oct 6, 2023
1 parent a595e2d commit c5ea5c6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ocsmesh/hfun/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1964,8 +1964,15 @@ def _create_big_raster(self, out_path: Union[str, Path]) -> Raster:
transformer = Transformer.from_crs(
'EPSG:4326', utm_crs, always_xy=True)

box_epsg4326 = box(x0, y0, x1, y1)
poly_utm = ops.transform(transformer.transform, Polygon(box_epsg4326))
# If it's the full earth, then the spaces are at least 1/2 deg
xs = np.linspace(x0, x1, 720)
ys = np.linspace(y0, y1, 720)
coords = [[x0, y] for y in ys]
coords.extend([[x, y1] for x in xs])
coords.extend([[x1, y] for y in reversed(ys)])
coords.extend([[x, y0] for x in reversed(xs)])
poly_epsg4326 = Polygon(np.array(coords))
poly_utm = ops.transform(transformer.transform, poly_epsg4326)
x0, y0, x1, y1 = poly_utm.bounds

worst_res = 0
Expand Down

0 comments on commit c5ea5c6

Please sign in to comment.