Skip to content

Commit

Permalink
Catch an empty df and throw error
Browse files Browse the repository at this point in the history
  • Loading branch information
kvantricht committed Oct 17, 2024
1 parent b75a352 commit 930e678
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/worldcereal/utils/refdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,14 @@ def process_parquet(
public_df_raw["valid_date"] = public_df_raw["sample_id"].map(
sample_dates.set_index("sample_id")["proposed_valid_date"]
)
logger.warning(
f"Removed {invalid_samples.shape[0]} samples that do not fit into selected temporal extent."
)
if public_df_raw.empty:
error_msg = "None of the samples matched the proposed temporal extent. Please select a different temporal extent."
logger.error(error_msg)
raise ValueError(error_msg)
else:
logger.warning(
f"Removed {invalid_samples.shape[0]} samples that do not fit into selected temporal extent."
)

public_df = process_parquet_for_presto(public_df_raw)

Expand Down

0 comments on commit 930e678

Please sign in to comment.