@@ -18,26 +18,30 @@ def tile_dates(
1818 start : datetime , end : datetime , is_point : bool = False
1919) -> List [Tuple [datetime , datetime ]]:
2020 """Break a date range into smaller slices if it exceeds thresholds.
21-
21+
2222 Args:
2323 start: Start datetime
2424 end: End datetime
2525 is_point: True if input is a point, False for polygons/AOIs
26-
26+
2727 Returns:
2828 List of (start, end) tuples
2929 """
3030 total_days = (end - start ).days + 1
3131 slices = []
3232
33- threshold_days = POINT_DATE_THRESHOLD_DAYS if is_point else DATE_RANGE_THRESHOLD_DAYS
33+ threshold_days = (
34+ POINT_DATE_THRESHOLD_DAYS if is_point else DATE_RANGE_THRESHOLD_DAYS
35+ )
3436 if total_days <= threshold_days :
3537 return [(start , end )]
3638
3739 slice_length = min (threshold_days , total_days )
3840 current_start = start
3941 while current_start <= end :
40- current_end = min (current_start + timedelta (days = slice_length - 1 ), end )
42+ current_end = min (
43+ current_start + timedelta (days = slice_length - 1 ), end
44+ )
4145 slices .append ((current_start , current_end ))
4246 current_start = current_end + timedelta (days = 1 )
4347
@@ -59,12 +63,14 @@ def tile_aoi(geom: Union[Polygon, Point]) -> List[Polygon]:
5963 while lat < lat_max :
6064 lon = lon_min
6165 while lon < lon_max :
62- tile = Polygon ([
63- (lon , lat ),
64- (min (lon + 1 , lon_max ), lat ),
65- (min (lon + 1 , lon_max ), min (lat + 1 , lat_max )),
66- (lon , min (lat + 1 , lat_max )),
67- ])
66+ tile = Polygon (
67+ [
68+ (lon , lat ),
69+ (min (lon + 1 , lon_max ), lat ),
70+ (min (lon + 1 , lon_max ), min (lat + 1 , lat_max )),
71+ (lon , min (lat + 1 , lat_max )),
72+ ]
73+ )
6874 tiles .append (tile .intersection (geom ))
6975 lon += 1
7076 lat += 1
@@ -94,9 +100,8 @@ def fetch_planet_data(
94100 # Mock data for demonstration
95101 ids .append (f"scene_{ s_start .strftime ('%Y%m%d' )} " )
96102 geometries .append (tile .__geo_interface__ )
97- properties .append ({
98- "cloud_cover" : max_cloud ,
99- "sun_angle" : min_sun_angle
100- })
103+ properties .append (
104+ {"cloud_cover" : max_cloud , "sun_angle" : min_sun_angle }
105+ )
101106
102- return ids , geometries , properties
107+ return ids , geometries , properties
0 commit comments