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

Task/tpi summarize hfi #3800

Merged
merged 44 commits into from
Aug 8, 2024
Merged

Task/tpi summarize hfi #3800

merged 44 commits into from
Aug 8, 2024

Conversation

conbrad
Copy link
Collaborator

@conbrad conbrad commented Jul 24, 2024

Summarizes advisory area based on TPI. Uses the snow-masked pmtiles hfi layer for the given date to mask contributing TPI pixels.

After finding out the initial implementation uses up to 20GB of memory, commit ab72307 and onwards introduce a more memory optimized implementation. Basically all datasets are loaded from S3, but data is only read in and transformed a chunk at a time. This implementation stays under 4.5GB of memory usage.

Test Links:

Landing Page
MoreCast
Percentile Calculator
C-Haines
FireBat
FireBat bookmark
Auto Spatial Advisory (ASA)
HFI Calculator

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 47.43590% with 41 lines in your changes missing coverage. Please review.

Project coverage is 79.31%. Comparing base (2467550) to head (a926e48).

Files Patch % Lines
api/app/utils/geospatial.py 0.00% 41 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3800      +/-   ##
==========================================
- Coverage   79.59%   79.31%   -0.29%     
==========================================
  Files         294      295       +1     
  Lines       10823    10874      +51     
  Branches      518      518              
==========================================
+ Hits         8615     8625      +10     
- Misses       2064     2105      +41     
  Partials      144      144              

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

api/app/utils/geospatial.py Outdated Show resolved Hide resolved
api/app/utils/geospatial.py Outdated Show resolved Hide resolved
api/app/utils/geospatial.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@dgboss dgboss left a comment

Choose a reason for hiding this comment

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

I'm loving the abstraction of opening rasters in geospatial.py. It's a great idea!

Co-authored-by: dgboss <darren.boss@gov.bc.ca>
@conbrad
Copy link
Collaborator Author

conbrad commented Jul 25, 2024

I'm loving the abstraction of opening rasters in geospatial.py. It's a great idea!

Naming and abstraction boundaries could be improved I think, but short of recreating rasterio I think it works for now. We can adjust as we go.

Copy link
Collaborator

@dgboss dgboss left a comment

Choose a reason for hiding this comment

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

I haven't tested it locally but it looks good!

Copy link
Collaborator

@dgboss dgboss left a comment

Choose a reason for hiding this comment

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

Nice re-work! Just a few comments/thoughts.

api/app/auto_spatial_advisory/elevation.py Show resolved Hide resolved
api/app/auto_spatial_advisory/elevation.py Show resolved Hide resolved
api/app/auto_spatial_advisory/elevation.py Show resolved Hide resolved
api/app/utils/geospatial.py Outdated Show resolved Hide resolved
@conbrad conbrad temporarily deployed to production August 8, 2024 19:26 Inactive
Copy link

sonarcloud bot commented Aug 8, 2024

@conbrad conbrad temporarily deployed to production August 8, 2024 22:38 Inactive
@conbrad conbrad temporarily deployed to production August 8, 2024 22:49 Inactive
@conbrad conbrad merged commit f4bd676 into main Aug 8, 2024
30 checks passed
@conbrad conbrad deleted the task/tpi-summarize-hfi branch August 8, 2024 23:02
conbrad added a commit that referenced this pull request Aug 13, 2024
Co-authored-by: dgboss <darren.boss@gov.bc.ca>
Test suite for geospatial functions introduced in #3800
dgboss pushed a commit that referenced this pull request Aug 14, 2024
Co-authored-by: dgboss <darren.boss@gov.bc.ca>

Summarizes advisory area based on TPI. Uses the snow-masked pmtiles hfi layer for the given date to mask contributing TPI pixels.

After finding out the initial implementation uses up to 20GB of memory, commit ab72307 and onwards introduce a more memory optimized implementation. Basically all datasets are loaded from S3, but data is only read in and transformed a chunk at a time. This implementation stays under 4.5GB of memory usage.
dgboss pushed a commit that referenced this pull request Aug 14, 2024
Co-authored-by: dgboss <darren.boss@gov.bc.ca>
Test suite for geospatial functions introduced in #3800
vanislekahuna pushed a commit to vanislekahuna/wps that referenced this pull request Sep 19, 2024
Co-authored-by: dgboss <darren.boss@gov.bc.ca>

Summarizes advisory area based on TPI. Uses the snow-masked pmtiles hfi layer for the given date to mask contributing TPI pixels.

After finding out the initial implementation uses up to 20GB of memory, commit bcgov@ab72307 and onwards introduce a more memory optimized implementation. Basically all datasets are loaded from S3, but data is only read in and transformed a chunk at a time. This implementation stays under 4.5GB of memory usage.
vanislekahuna pushed a commit to vanislekahuna/wps that referenced this pull request Sep 19, 2024
Co-authored-by: dgboss <darren.boss@gov.bc.ca>
Test suite for geospatial functions introduced in bcgov#3800
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.

3 participants