Skip to content

Fix inverted date filtering logic in load_gee_as_image()#79

Open
mihiarc wants to merge 1 commit intotaraskiba:mainfrom
mihiarc:fix/date-filtering-logic
Open

Fix inverted date filtering logic in load_gee_as_image()#79
mihiarc wants to merge 1 commit intotaraskiba:mainfrom
mihiarc:fix/date-filtering-logic

Conversation

@mihiarc
Copy link
Contributor

@mihiarc mihiarc commented Feb 2, 2026

Summary

  • Fixed inverted conditional logic for date filtering in load_gee_as_image() functions

Problem

The date filtering logic was inverted - filters were being applied when dates were None rather than when they were provided:

# Before (incorrect)
if start_date is None and end_date is None:
    col = col.filterDate(start_date, end_date)
else:
    pass

This caused:

  • Date filters to be ignored when users specified date ranges
  • Attempts to filter with None values when no dates were provided

Solution

# After (correct)
if start_date is not None and end_date is not None:
    col = col.filterDate(start_date, end_date)

Files Changed

  • skiba/point_extraction.py
  • skiba/aggregated_point_extraction.py
  • skiba/buffer_method.py

Testing

The fix is straightforward logic correction. Date filtering now works as expected:

  • When dates are provided → filter is applied
  • When dates are not provided → no filtering (uses full time range)

Fixes #75

The condition for applying date filters was inverted - filters were
being applied when dates were None rather than when they were provided.

Changed from:
  if start_date is None and end_date is None:
      col = col.filterDate(start_date, end_date)

To:
  if start_date is not None and end_date is not None:
      col = col.filterDate(start_date, end_date)

Fixes taraskiba#75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Date filtering logic is inverted in load_gee_as_image()

1 participant