Skip to content

Commit

Permalink
Merge pull request #207 from WorldCereal/fix-empty-df
Browse files Browse the repository at this point in the history
Catch an empty df and throw error
  • Loading branch information
kvantricht authored Oct 17, 2024
2 parents b75a352 + 930e678 commit fe7ed74
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 fe7ed74

Please sign in to comment.