-
Notifications
You must be signed in to change notification settings - Fork 16
fix: Cache and Stacker should keep band order for subsets #1120
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
Merged
Merged
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9f6243b
fix(cache):filter returned band by query.band
jdroenner 5f0f713
stacker: produce tiles with band selection stored
jdroenner 45a85e3
update cache stored bands
jdroenner 5256f11
lint test
jdroenner 3d98d32
add debug outputs on error tiles (only in debug mode)
jdroenner 5acd2c0
remove no needed method
jdroenner 322d13c
enhance expect method
jdroenner a2e58da
remove comment regarding TimeInstants
jdroenner 3251a69
remove band update in stored query since bands must not change
jdroenner 4995ba9
remove redundant filterin in cache
jdroenner f213cd2
remove and cleanup code fix MockRasterSource
jdroenner bd38247
back to old StackerAdapter stratey where bands are not selected
jdroenner 9f2862a
baseline stacker approach. Fix tests
jdroenner b635d59
improve comment
jdroenner ea972f7
lints
jdroenner 791c4f5
add band selection logic to SimpleRasterStacker
jdroenner 771461a
add regular time stackerwith band selection to RasterStacker Operator
jdroenner ddc7fb7
more tests and checks
jdroenner fcf3717
lints
jdroenner 14adb72
more lint
jdroenner ab86016
Merge branch 'main' of github.com:geo-engine/geoengine into cache_ban…
jdroenner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| use crate::{ | ||
| primitives::{BandSelection, BandSelectionIter}, | ||
| raster::{GridBoundingBox2D, GridIdx2D, GridIdx2DIter, TileInformation, TileInformationIter}, | ||
| }; | ||
|
|
||
| #[derive(Clone, Debug)] | ||
| pub struct TileIdxBandCrossProductIter { | ||
| tile_iter: GridIdx2DIter, | ||
| band_iter: BandSelectionIter, // TODO: maybe change this to actual attributes from ResultDescriptor not the Selection? | ||
| current_tile: Option<GridIdx2D>, | ||
| } | ||
|
|
||
| impl TileIdxBandCrossProductIter { | ||
| pub fn new(tile_iter: GridIdx2DIter, band_iter: BandSelectionIter) -> Self { | ||
| let mut tile_iter = tile_iter; | ||
| let current_tile = tile_iter.next(); | ||
| Self { | ||
| tile_iter, | ||
| band_iter, | ||
| current_tile, | ||
| } | ||
| } | ||
|
|
||
| pub fn grid_bounds(&self) -> GridBoundingBox2D { | ||
| self.tile_iter.grid_bounds | ||
| } | ||
|
|
||
| pub fn band_selection(&self) -> &BandSelection { | ||
| &self.band_iter.band_selection | ||
| } | ||
|
|
||
| pub fn with_grid_bounds_and_selection( | ||
| bounds: GridBoundingBox2D, | ||
| band_selection: BandSelection, | ||
| ) -> Self { | ||
| let tile_iter = GridIdx2DIter::new(&bounds); | ||
| let band_iter = BandSelectionIter::new(band_selection); | ||
| Self::new(tile_iter, band_iter) | ||
| } | ||
|
|
||
| pub fn reset(&mut self) { | ||
| self.band_iter.reset(); | ||
| self.tile_iter.reset(); | ||
| self.current_tile = self.tile_iter.next(); | ||
| } | ||
| } | ||
|
|
||
| impl Iterator for TileIdxBandCrossProductIter { | ||
| type Item = (GridIdx2D, u32); | ||
|
|
||
| fn next(&mut self) -> Option<Self::Item> { | ||
| let current_t = self.current_tile; | ||
|
|
||
| match (current_t, self.band_iter.next()) { | ||
| (None, _) => None, | ||
| (Some(t), Some(b)) => Some((t, b)), | ||
| (Some(_t), None) => { | ||
| self.band_iter.reset(); | ||
| self.current_tile = self.tile_iter.next(); | ||
| self.current_tile.map(|t| { | ||
| ( | ||
| t, | ||
| self.band_iter | ||
| .next() | ||
| .expect("There must be at least one band"), | ||
| ) | ||
| }) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[derive(Clone, Debug)] | ||
| pub struct TileInformationBandCrossProductIter { | ||
| tile_iter: TileInformationIter, | ||
| band_iter: BandSelectionIter, | ||
| current_tile: Option<TileInformation>, | ||
| } | ||
|
|
||
| impl TileInformationBandCrossProductIter { | ||
| pub fn new(tile_iter: TileInformationIter, band_iter: BandSelectionIter) -> Self { | ||
| let mut tile_iter = tile_iter; | ||
| let current_tile = tile_iter.next(); | ||
| Self { | ||
| tile_iter, | ||
| band_iter, | ||
| current_tile, | ||
| } | ||
| } | ||
|
|
||
| pub fn reset(&mut self) { | ||
| self.band_iter.reset(); | ||
| self.tile_iter.reset(); | ||
| self.current_tile = self.tile_iter.next(); | ||
| } | ||
| } | ||
|
|
||
| impl Iterator for TileInformationBandCrossProductIter { | ||
| type Item = (TileInformation, u32); | ||
|
|
||
| fn next(&mut self) -> Option<Self::Item> { | ||
| let current_t = self.current_tile; | ||
|
|
||
| match (current_t, self.band_iter.next()) { | ||
| (None, _) => None, | ||
| (Some(t), Some(b)) => Some((t, b)), | ||
| (Some(_t), None) => { | ||
| self.band_iter.reset(); | ||
| self.current_tile = self.tile_iter.next(); | ||
| self.current_tile.map(|t| { | ||
| ( | ||
| t, | ||
| self.band_iter | ||
| .next() | ||
| .expect("There must be at least one band"), | ||
| ) | ||
| }) | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.