Skip to content
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

Titiler/encoded alert tiles #166

Merged
merged 6 commits into from
Oct 22, 2024
Merged

Conversation

solomon-negusse
Copy link
Member

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side). Don't request your master!
  • Make sure you are making a pull request against the develop branch (left side). Also you should start your branch off our develop.
  • [] Check the commit's or even all commits' message styles matches our requested structure.
  • Check your code additions will fail neither code linting checks nor unit test.

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 new behavior?

  • Provide encoded Titiler integrated alerts tiles that Flagship uses

Does this introduce a breaking change?

  • Yes
  • No

Other information

@codecov-commenter
Copy link

codecov-commenter commented Oct 21, 2024

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

Codecov Report

Attention: Patch coverage is 94.87179% with 2 lines in your changes missing coverage. Please review.

Project coverage is 80.24%. Comparing base (7a379bf) to head (1c70283).

Files with missing lines Patch % Lines
app/routes/titiler/algorithms/alerts.py 92.59% 2 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #166      +/-   ##
==========================================
+ Coverage   80.07%   80.24%   +0.17%     
==========================================
  Files          59       59              
  Lines        1927     1954      +27     
==========================================
+ Hits         1543     1568      +25     
- Misses        384      386       +2     
Flag Coverage Δ
unittests 80.24% <94.87%> (+0.17%) ⬆️

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.

Copy link
Contributor

@gtempus gtempus left a comment

Choose a reason for hiding this comment

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

This looks like we talked about last week during the huddle, @solomon-negusse. Nice work extending the existing alerts! 💪

I only have one suggested change that I think should be considered (besides the typo).

Comment on lines +36 to +49
# Using the same method used in Data API to provide the confidence encoding
# GFW Flagship expects in the alpha channel where the three alerts' confidence
# levels are packed in the alpha channel with 2 bits for each alert (starting at 3rd).
# The values used are follows (bit layout and decimal value):
# low confidence
# GLADL GLADS2 RADD Unused
# 00 00 01 00 = 4 (decimal)
# high confidence
# GLADL GLADS2 RADD Unused
# 00 00 10 00 = 8 (decimal)
# highest confidence
# GLADL GLADS2 RADD Unused
# 00 01 10 00 = 24 (decimal)
# More explanation: https://github.com/wri/gfw-data-api/blob/master/app/tasks/raster_tile_cache_assets/symbology.py#L92
Copy link
Contributor

Choose a reason for hiding this comment

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

Love this documentation, @solomon-negusse! 😍 📝

tests/titiler/test_alerts_algo.py Outdated Show resolved Hide resolved
Comment on lines 133 to 135
def create_encoded_alpha(self):
"""To be overridden by alert types that implement it."""
return self.create_true_color_alpha()
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand why this method is implemented this way. But, do you think it is likely to cause confusion?
Should we log what we're doing here? Basically, "Hey, I know you asked for an encoded alpha, but your specialized alert class doesn't support that." And we return the true color alpha just like you're doing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. An alternative I considered was to not provide a default behavior and return rgb instead of rgba if this method isn't provided by the alert class, but went with this because we expect an intensity layer as input so it makes sense to act on that.

Copy link
Contributor

@gtempus gtempus left a comment

Choose a reason for hiding this comment

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

Thank you, @solomon-negusse!

Copy link
Contributor

@danscales danscales left a comment

Choose a reason for hiding this comment

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

Looks good!

@solomon-negusse solomon-negusse merged commit 949639d into dev Oct 22, 2024
4 checks passed
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.

4 participants