Skip to content

Commit 79d8a08

Browse files
authored
Fix/granules sel (#508)
* ensure select_granules returns correct order (rank) * comment out noaa selected files print
1 parent 0299b69 commit 79d8a08

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

rapida/ntl/fetch.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ async def fetch(bbox:tuple[numbers.Number]=None, nominal_date:datetime=None,
6262
download_and_track(granule, dst_dir, progress)
6363
)
6464
tasks.append(task)
65-
6665
downloaded_files = {}
6766

6867
for coro in asyncio.as_completed(tasks, timeout=100 * 3 * len(tasks)):
@@ -81,7 +80,7 @@ async def fetch(bbox:tuple[numbers.Number]=None, nominal_date:datetime=None,
8180
await asyncio.gather(*tasks, return_exceptions=True)
8281
raise
8382

84-
return downloaded_files
83+
return {g.timestamp:downloaded_files[g.timestamp] for g in selected_granules if g.timestamp in downloaded_files}
8584

8685
expected_tiles = get_intersecting_tiles(bbox=bbox)
8786
routes = nasaconst.ROUTES
@@ -151,7 +150,7 @@ async def fetch(bbox:tuple[numbers.Number]=None, nominal_date:datetime=None,
151150
# Break out of the 'routes' loop to stop searching for this processing_level
152151
break
153152

154-
153+
print(downloaded_files)
155154
return downloaded_files
156155

157156

rapida/ntl/noaa/cmask.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ def select_required_granules(sorted_granules: list, bbox: tuple, progress:Progre
103103
logger.warning("Exhausted all combinations. BBOX cannot be fully covered by available data.")
104104
logger.warning(f"Selecting max of {combos}.")
105105

106-
w = max(combos)
107-
return combos[w]
106+
max_cov = max(combos)
107+
return combos[max_cov]
108108
finally:
109109
if progress and progress_task:
110110
progress.remove_task(progress_task)

rapida/ntl/outage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ async def detect_outage(
3333
logger.info(f'No imagery was found for {nominal_date:"%Y%m%d"} over {bbox} {deliverable.split("_")[0]}')
3434
logger.info(f'Consider adjusting source, date or the bounding box')
3535
return
36-
for timestamp, product_files in daily_results.items():
37-
print(timestamp, product_files)
36+
3837

3938
arrays = {}
4039
# --- 1. FETCH & PROCESS MONTHLY BASELINE ---
@@ -73,6 +72,7 @@ async def detect_outage(
7372

7473
for timestamp, product_files in daily_results.items():
7574

75+
7676
daily_data, cloud_mask = read_and_align_sdr_and_cmask(
7777
sdr_path=product_files[noaa_const.SDR], geo_path=product_files[noaa_const.GEO],
7878
cmask_path=product_files[noaa_const.CM], target_area=target_area

0 commit comments

Comments
 (0)