Skip to content

GTC-3442: Catch rasterio exceptions on missing data for integrated drivers#249

Merged
dmannarino merged 5 commits intostagingfrom
gtc_3442_fix_none_aletrs_drivers
Jan 8, 2026
Merged

GTC-3442: Catch rasterio exceptions on missing data for integrated drivers#249
dmannarino merged 5 commits intostagingfrom
gtc_3442_fix_none_aletrs_drivers

Conversation

@dmannarino
Copy link
Member

@dmannarino dmannarino commented Dec 17, 2025

It turns out that I we were emitting 500s for all tiles outside the bounds of the associated datasets, rather than polite 404s.

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Trying to generate alerts tiles where they don't exist raises 500s.

Issue Number: GTC-3442

What is the new behavior?

Does this introduce a breaking change?

  • Yes
  • No

Other information

@codecov-commenter
Copy link

codecov-commenter commented Dec 17, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 20.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.89%. Comparing base (73c9f1d) to head (1ec45d8).

Files with missing lines Patch % Lines
...pp/routes/titiler/gfw_integrated_alerts_drivers.py 22.22% 7 Missing ⚠️
...es/titiler/algorithms/integrated_alerts_drivers.py 0.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@             Coverage Diff             @@
##           staging     #249      +/-   ##
===========================================
- Coverage    70.95%   70.89%   -0.07%     
===========================================
  Files           78       78              
  Lines         2734     2738       +4     
===========================================
+ Hits          1940     1941       +1     
- Misses         794      797       +3     
Flag Coverage Δ
unittests 70.89% <20.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@jterry64 jterry64 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 this looks right, but I'd check it on a map on staging before pushing to prod... I vaguely remember a reason I didn't use self.no_data, and I should've written down. Sorry! But it may have just been unnecessary. Is this the case where it's outside of the extent of the layer?

@dmannarino
Copy link
Member Author

Is this the case where it's outside of the extent of the layer?

Yep.

@dmannarino dmannarino changed the title GTC-3442: Check for empty alerts drivers data before comparison for mask GTC-3442: Catch rasterio exceptions on missing data for integrated drivers Jan 7, 2026
@dmannarino dmannarino requested a review from jterry64 January 7, 2026 22:07
"""

mask = self.alert_drivers > 0
mask = ~self.no_data * (self.alert_drivers > 0)
Copy link
Member

Choose a reason for hiding this comment

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

good catch of the dark pixels issue

@dmannarino dmannarino merged commit 7a09335 into staging Jan 8, 2026
5 checks passed
@dmannarino dmannarino deleted the gtc_3442_fix_none_aletrs_drivers branch January 8, 2026 15:13
f"s3://{DATA_LAKE_BUCKET}/wur_integration_alert_drivers_class/{version}/raster/epsg-4326/cog/class.tif"
) as reader:
if reader.tile_exists(tile_x, tile_y, zoom):
try:
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's too bad that the reader.tile_exists() call doesn't catch all particular cases of a TileOutsideBounds requests. I'm just wondering if you could do a ChatGPT/gemini query to see if there is a better function or condition check that would figure out when the access will be out of bounds that wouldn't require catching an exception. But I understand the exception catching is working, so no need to fix unless you find something that seems solid.

Copy link
Member Author

Choose a reason for hiding this comment

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

Mmm, worth exploring, thanks! Will do as a follow-up though.

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.

5 participants