Skip to content

add spatial intervals validation #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 28, 2025

Conversation

vincentsarago
Copy link
Member

following #177


# if bbox is crossing the Antimeridian limit we move xmax to the west
if xmin > xmax:
xmax = 180 - (xmax % 360)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2025-05-22 at 1 06 16 PM

@vincentsarago
Copy link
Member Author

😬 I'm not checking for case when sub-sequent intervals are on the right side 😓

Screenshot 2025-05-22 at 1 11 42 PM

and the current implementation won't work

Comment on lines 75 to 78
# │ │ ┌──────┐ │ ┌─────────┐ │ │
# └──│──► 2 │ │ │ 1 │ │ │
# │ │ │ │ │ │◄────│────────┘
# │ └──────┘ │ └─────────┘ │
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The left case is:

xmax < xmin_sub and xmax < xmax_sub

Right case is:

xmin > xmin_xub and xmin > xmax_sub

Middle case is:

xmax < xmax_sub and xmin < xmin_sub

vincentsarago and others added 5 commits May 26, 2025 11:14
Co-authored-by: Pete Gadomski <pete.gadomski@gmail.com>
Co-authored-by: Pete Gadomski <pete.gadomski@gmail.com>
Co-authored-by: Pete Gadomski <pete.gadomski@gmail.com>
Co-authored-by: Pete Gadomski <pete.gadomski@gmail.com>
@vincentsarago vincentsarago requested a review from gadomski May 26, 2025 18:53
Copy link
Member

@gadomski gadomski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the suggestions are needed, but this stuff sometimes can be guess-and-check for me 🫠. I don't think 0 should show up in the checks at all, though...

raise error_msg

# case 1
elif xmax_sub <= 0 and xmax_sub > xmax:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
elif xmax_sub <= 0 and xmax_sub > xmax:
elif xmax_sub > xmax or xmin_sub > xmax:

raise error_msg

# case 2
elif xmin_sub >= 0 and xmin_sub < xmin:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
elif xmin_sub >= 0 and xmin_sub < xmin:
elif xmin_sub < xmin or xmax_sub < xmin:

@vincentsarago
Copy link
Member Author

@gadomski I've added more comments to explain the reasoning for the if/elif blocks

@vincentsarago vincentsarago merged commit caf39a5 into main May 28, 2025
6 checks passed
@vincentsarago vincentsarago deleted the feature/validate-spatial-intervals branch May 28, 2025 11:12
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.

2 participants