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

Determine num_channels and dtype in RasterSource statically without reading a chip #2212

Merged
merged 2 commits into from
Aug 6, 2024

Conversation

AdeelH
Copy link
Collaborator

@AdeelH AdeelH commented Aug 5, 2024

Overview

The num_channels and dtype of a RasterSource can be different from the underlying data source because of RasterTransformers. Previously, these could only be determined dynamically at runtime by reading a 1x1 chip and checking its shape and dtype. This can be very slow when initializing many RasterSources or when initializing a RasterSources with many bands.

This PR adds get_out_channels() and get_out_dtype() methods to RasterTransformers, allowing num_channels and dtype to be determined statically without reading any data.

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.

@AdeelH AdeelH force-pushed the rs_channels_dtype_static branch 2 times, most recently from 6e15236 to f5a91ca Compare August 5, 2024 22:22
The num_channels and dtype of a RasterSource can be different from the underlying data source because of RasterTransformers. Previously, these could only be determined dynamically at runtime by reading a 1x1 chip and checking its shape and dtype. This can be very slow when initializing many RasterSources or when initializing a RasterSources with many bands.

This change adds get_out_channels() and get_out_dtype() methods to each RasterTransformer, allowing num_channels and dtype to be determined statically without reading any data.
@AdeelH AdeelH force-pushed the rs_channels_dtype_static branch 2 times, most recently from c72da72 to 027d12b Compare August 6, 2024 13:41
Require sub raster sources to have the same dtype.
@AdeelH AdeelH force-pushed the rs_channels_dtype_static branch from 027d12b to d8094ea Compare August 6, 2024 14:00
@AdeelH AdeelH marked this pull request as ready for review August 6, 2024 15:17
@AdeelH AdeelH merged commit 0f45c2c into azavea:master Aug 6, 2024
2 checks passed
@AdeelH AdeelH deleted the rs_channels_dtype_static branch August 7, 2024 17:12
Copy link

codecov bot commented Nov 4, 2024

Codecov Report

Attention: Patch coverage is 98.07692% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.34%. Comparing base (b263422) to head (d8094ea).
Report is 29 commits behind head on master.

Files with missing lines Patch % Lines
...e/data/raster_source/multi_raster_source_config.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2212      +/-   ##
==========================================
+ Coverage   90.21%   90.34%   +0.12%     
==========================================
  Files         198      199       +1     
  Lines        9906     9908       +2     
==========================================
+ Hits         8937     8951      +14     
+ Misses        969      957      -12     

☔ 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.

1 participant