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

Compute RasterStats from transformed RasterSource #2211

Merged
merged 3 commits into from
Aug 6, 2024

Conversation

AdeelH
Copy link
Collaborator

@AdeelH AdeelH commented Aug 5, 2024

Overview

This PR makes RasterStats use RasterSource.get_chip() instead of RasterSource.get_raw_chip() when computing stats (#2177). This requires 2 further downstream changes:

  • After the change, the computed stats are now in the same order as RasterSource.channel_order which makes the channel_order argument to StatsTransformer unnecessary. Since StatsTransformer was the only RasterTransformer using this argument, this meant that the argument could now safely be removed from all RasterTransformers--and it was.
  • Since older stats were computed with RasterSource.get_raw_chip(), they still require channel_order to be applied before they can be used by the StatsTransformer. Therefore, to maintain backward compatibility with older model-bundles, a new boolean needs_channel_order field has been added to StatsTransformerConfig, which, if True, causes channel_order to be applied when initializing the StatsTransformer in StatsTransformerConfig.build(). This field is set automatically by the config upgrader.

Checklist

  • Added unit tests, if applicable
  • Updated documentation, if applicable
  • Added needs-backport label if the change should be back-ported to the previous release
  • PR has a name that won't get you publicly shamed for vagueness

Notes

N/A

Testing Instructions

See new/updated unit tests.


Closes #2177

@AdeelH AdeelH marked this pull request as ready for review August 6, 2024 13:29
@AdeelH AdeelH merged commit b263422 into azavea:master Aug 6, 2024
2 checks passed
@AdeelH AdeelH deleted the raster_stats_get_chip branch August 6, 2024 13:30
Copy link

codecov bot commented Nov 4, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 4 lines in your changes missing coverage. Please review.

Project coverage is 90.21%. Comparing base (d5e3b1c) to head (906ff30).
Report is 33 commits behind head on master.

Files with missing lines Patch % Lines
.../core/data/raster_source/rasterio_source_config.py 75.00% 1 Missing ⚠️
...data/raster_source/temporal_multi_raster_source.py 0.00% 1 Missing ⚠️
...tervision/core/data/raster_source/xarray_source.py 0.00% 1 Missing ⚠️
...on/core/data/raster_source/xarray_source_config.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2211      +/-   ##
==========================================
+ Coverage   90.19%   90.21%   +0.01%     
==========================================
  Files         198      198              
  Lines        9896     9906      +10     
==========================================
+ Hits         8926     8937      +11     
+ Misses        970      969       -1     

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

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.

Compute RasterStats from transformed RasterSource
1 participant