Skip to content

Commit

Permalink
Remove broken cached area bounds calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
aliaksei135 committed Apr 20, 2021
1 parent fdb94ee commit 267329f
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions seedpod_ground_risk/core/plot_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,20 +312,8 @@ def generate_layer(layer: DataLayer, bounds_poly: sg.Polygon, raster_shape: Tupl
resolution: float) -> Union[
Tuple[str, Tuple[Geometry, np.ndarray, gpd.GeoDataFrame]], Tuple[str, None]]:

import shapely.ops as so

from_cache = False
layer_bounds_poly = bounds_poly
if bounds_poly.within(layer.cached_area):
# Requested bounds are fully inside the area that has been generated already
from_cache = True
elif bounds_poly.intersects(layer.cached_area):
# Some of the requested bounds are outside the generated area
# Get only the area that needs to be generated
layer_bounds_poly = bounds_poly.difference(layer.cached_area)
layer.cached_area = so.unary_union([layer.cached_area, bounds_poly])
try:
result = layer.key, layer.generate(layer_bounds_poly, raster_shape, from_cache=from_cache, hour=hour,
result = layer.key, layer.generate(bounds_poly, raster_shape, from_cache=False, hour=hour,
resolution=resolution)
return result
except Exception as e:
Expand Down

0 comments on commit 267329f

Please sign in to comment.