You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dft_stac_cube() builds its gdalcubes cube over the AOI's bounding box (cube_view(extent = bbox_target)), so the COG streaming — the dominant cost, ~10–30 min for a multi-year monthly Sentinel-2 fetch — scales with the bbox, not the AOI. For a thin, corridor-shaped floodplain the bounding box is largely empty.
#32 restored polygon-tight output (clip = TRUE masks the assembled stack with terra::mask()), but that runs after the pixels are streamed — it does not reduce what gdalcubes reads, so fetch time is unchanged.
Measured on the packaged example AOI (Neexdzii Kwa reach): area / bbox ≈ 0.105, i.e. ~90% of the streamed bounding box is outside the polygon — a ~10× streaming overhead. Thinner / more diagonal reaches are worse (NECR io-lulc: ~10.1% inside, per #36).
#32 clips the output of dft_stac_cube() (via terra::mask(), since gdalcubes::filter_geom() segfaults on the pinned build — see inst/notes/gdalcubes-pc-gotchas.md). This issue is about reducing the read: bounding the COG streaming to near the AOI footprint.
#36 is the same download overhead on the categorical dft_stac_fetch() (io-lulc) path, with a tiling proposal (fetch only tiles intersecting the AOI, then mosaic). The technique transfers, but this issue tracks it for dft_stac_cube() (continuous Sentinel-2), which has its own surface: a per-tile cube_view, cloud/SCL masking, the baseline-offset item split at 2022-01-25, and the terra::cover() coalesce.
Proposed
Options, roughly in order of feasibility:
Tile the cube_view — split the AOI bbox into a grid, build/stream one cube per tile intersecting the AOI, skip empty tiles, and mosaic (mirrors Tile dft_stac_fetch to bound download over sparse-floodplain bounding boxes #36). Peak read approaches the union of intersecting tile bboxes — near the AOI footprint for a corridor.
A working filter_geom — if/when the gdalcubes segfault is fixed upstream, it pushes the AOI into the read directly (no output-side terra::mask() needed either).
Server-side windowing — any STAC/gdalcubes path that reads only the AOI window.
Problem
dft_stac_cube()builds its gdalcubes cube over the AOI's bounding box (cube_view(extent = bbox_target)), so the COG streaming — the dominant cost, ~10–30 min for a multi-year monthly Sentinel-2 fetch — scales with the bbox, not the AOI. For a thin, corridor-shaped floodplain the bounding box is largely empty.#32 restored polygon-tight output (
clip = TRUEmasks the assembled stack withterra::mask()), but that runs after the pixels are streamed — it does not reduce what gdalcubes reads, so fetch time is unchanged.Measured on the packaged example AOI (Neexdzii Kwa reach): area / bbox ≈ 0.105, i.e. ~90% of the streamed bounding box is outside the polygon — a ~10× streaming overhead. Thinner / more diagonal reaches are worse (NECR io-lulc: ~10.1% inside, per #36).
Distinct from #32
#32 clips the output of
dft_stac_cube()(viaterra::mask(), sincegdalcubes::filter_geom()segfaults on the pinned build — seeinst/notes/gdalcubes-pc-gotchas.md). This issue is about reducing the read: bounding the COG streaming to near the AOI footprint.Related to #36
#36 is the same download overhead on the categorical
dft_stac_fetch()(io-lulc) path, with a tiling proposal (fetch only tiles intersecting the AOI, then mosaic). The technique transfers, but this issue tracks it fordft_stac_cube()(continuous Sentinel-2), which has its own surface: a per-tilecube_view, cloud/SCL masking, the baseline-offset item split at 2022-01-25, and theterra::cover()coalesce.Proposed
Options, roughly in order of feasibility:
cube_view— split the AOI bbox into a grid, build/stream one cube per tile intersecting the AOI, skip empty tiles, and mosaic (mirrors Tile dft_stac_fetch to bound download over sparse-floodplain bounding boxes #36). Peak read approaches the union of intersecting tile bboxes — near the AOI footprint for a corridor.filter_geom— if/when the gdalcubes segfault is fixed upstream, it pushes the AOI into the read directly (no output-sideterra::mask()needed either).Related
terra::mask()(this is the read-side residual)dft_stac_fetch(); shared tiling techniqueinst/notes/gdalcubes-pc-gotchas.md— records thefilter_geomsegfault, the dft_stac_cube: restore AOI-polygon clip (filter_geom segfault workaround) #32 resolution, and this residual