• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geo-engine / geoengine / 17043803691

18 Aug 2025 02:38PM UTC coverage: 88.339%. First build
17043803691

Pull #1059

github

web-flow
Merge 5d8c31cc7 into db8685e5e
Pull Request #1059: Multi_band_gdal_source

3198 of 3544 new or added lines in 21 files covered. (90.24%)

116507 of 131886 relevant lines covered (88.34%)

477654.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.18
/operators/src/source/multi_band_gdal_source/loading_info.rs
1
use super::GdalDatasetParameters;
2
use crate::engine::RasterResultDescriptor;
3
use geoengine_datatypes::{
4
    primitives::{CacheHint, SpatialPartition2D, SpatialPartitioned, TimeInterval},
5
    raster::TileInformation,
6
};
7
use postgres_types::{FromSql, ToSql};
8
use serde::{Deserialize, Serialize};
9

NEW
10
#[derive(Serialize, Deserialize, Debug, Clone, FromSql, ToSql, PartialEq)]
×
11
#[serde(rename_all = "camelCase")]
12
pub struct GdalMultiBand {
13
    pub result_descriptor: RasterResultDescriptor,
14
}
15

16
#[derive(Debug, Clone)]
17
pub struct MultiBandGdalLoadingInfo {
18
    files: Vec<TileFile>,
19
    time_steps: Vec<TimeInterval>,
20
    cache_hint: CacheHint,
21
}
22

23
#[derive(Debug, Clone, Deserialize)]
24
pub struct TileFile {
25
    pub time: TimeInterval,
26
    pub spatial_partition: SpatialPartition2D,
27
    pub band: u32,
28
    pub z_index: u32,
29
    pub params: GdalDatasetParameters,
30
}
31

32
impl MultiBandGdalLoadingInfo {
33
    pub fn new(time_steps: Vec<TimeInterval>, files: Vec<TileFile>, cache_hint: CacheHint) -> Self {
12✔
34
        debug_assert!(!time_steps.is_empty(), "time_steps must not be empty");
12✔
35

36
        debug_assert!(
12✔
37
            time_steps.windows(2).all(|w| w[0] <= w[1]),
12✔
NEW
38
            "time_steps must be sorted"
×
39
        );
40

41
        #[cfg(debug_assertions)]
42
        {
43
            let mut groups: std::collections::HashMap<(TimeInterval, u32), Vec<&TileFile>> =
12✔
44
                std::collections::HashMap::new();
12✔
45

46
            for file in &files {
126✔
47
                groups.entry((file.time, file.band)).or_default().push(file);
114✔
48
            }
114✔
49

50
            for ((time, band), group) in &groups {
41✔
51
                debug_assert!(
29✔
52
                    group.windows(2).all(|w| w[0].z_index <= w[1].z_index),
85✔
NEW
53
                    "Files for time {time:?} and band {band} are not sorted by z_index",
×
54
                );
55
            }
56
        }
57

58
        Self {
12✔
59
            files,
12✔
60
            time_steps,
12✔
61
            cache_hint,
12✔
62
        }
12✔
63
    }
12✔
64

65
    /// Return a gap-free list of time steps for the current loading info and query time.
66
    pub fn time_steps(&self) -> &[TimeInterval] {
12✔
67
        &self.time_steps
12✔
68
    }
12✔
69

70
    /// Return all files necessary to load a single tile, sorted by z-index. Might be empty if no files are needed.
71
    pub fn tile_files(
360✔
72
        &self,
360✔
73
        time: TimeInterval,
360✔
74
        tile: TileInformation,
360✔
75
        band: u32,
360✔
76
    ) -> Vec<GdalDatasetParameters> {
360✔
77
        let tile_partition = tile.spatial_partition();
360✔
78

79
        let mut files = vec![];
360✔
80
        for file in &self.files {
6,440✔
81
            if time.intersects(&file.time)
6,080✔
82
                && file.spatial_partition.intersects(&tile_partition)
1,728✔
83
                && file.band == band
1,280✔
84
            {
85
                debug_assert!(file.time == time, "file's time must match query time");
704✔
86

87
                files.push(file.params.clone());
704✔
88
            }
5,376✔
89
        }
90

91
        files
360✔
92
    }
360✔
93

94
    pub fn cache_hint(&self) -> CacheHint {
360✔
95
        self.cache_hint
360✔
96
    }
360✔
97
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc