Problem
A floodplain-wide dft_stac_composite() over BULK (bulk_co_ff04, tile_size = 20000, 2023 Jul–Aug, clip = TRUE) reads every tile and then fails after the read, on the merged mosaic:
Error: [mask] cannot read from /private/tmp/Rtmp.../spat_16d103f4b1e92_93456_SskviV5XwhZb4QV.tif
That is stac_cube_clip() → terra::mask() failing to read the temp GeoTIFF that mosaic_stacks() (terra::merge(terra::sprc(tiles))) wrote. The same path is dft_stac_cube()'s tiled read, so a floodplain-scale tiled cube is presumably affected too.
Established (drift#79 BULK runs, 2026-09-28)
| run |
what happened |
| 2 |
30 tiles in 54 min, 15 of them lost to expired tokens (fixed in #79). Died at writeRaster(filetype = "COG"), which reads the same merged mosaic |
| 4 |
all 30 tiles read, 0 chunk failures, in 3 h 16 min; peak RSS 3.90 GiB; then the mask error above |
The R session exited on the error, so its tempdir, and the evidence, went with it.
Ruled out
- Disk: 1 TB free on
/private/tmp.
- Writing a floodplain-size COG: an in-memory synthetic raster with the same dims and options writes fine (82 s, 459 MB).
- terra deleting a temp file when its parent object is collected: subset, reassign,
gc() and mask() on a disk-forced merge all work (terra 1.9.50).
- Merge plus mask at this scale, in general: 30 synthetic NetCDF tiles on the exact BULK tile grid, merged to a file-backed
spat_*.tif, reordered by name and masked with the real 104,584-vertex floodplain polygon. OK in 0.7 min.
Not yet separated
What the live run has and the offline rebuild does not:
- gdalcubes' float64 NetCDF with a time dimension as the merge sources;
- 3 hours of elapsed time, and temp files created early being read late;
- per-tile NA patterns from cloud masking.
data-raw/benchmark_composite_bulk.R now catches the error and inventories the temp files before exit: names, sizes, mtimes, and gdalinfo -checksum of every spat_*.tif. The next floodplain run leaves the evidence this one lost. A cheaper way to separate the first candidate is the offline rebuild with tiles written by gdalcubes::write_ncdf() from a local image collection. The #79 review built such a collection in its scratch scripts.
Acceptance
- A floodplain-wide BULK composite completes and caches one COG.
- A test pins the cause (fixture from real gdalcubes NetCDF tiles if that is the discriminator).
- The numbers go in the scale-test record: wall time and peak RSS for the full run.
Relates: drift#79, drift#87
Problem
A floodplain-wide
dft_stac_composite()over BULK (bulk_co_ff04,tile_size = 20000, 2023 Jul–Aug,clip = TRUE) reads every tile and then fails after the read, on the merged mosaic:That is
stac_cube_clip()→terra::mask()failing to read the temp GeoTIFF thatmosaic_stacks()(terra::merge(terra::sprc(tiles))) wrote. The same path isdft_stac_cube()'s tiled read, so a floodplain-scale tiled cube is presumably affected too.Established (drift#79 BULK runs, 2026-09-28)
writeRaster(filetype = "COG"), which reads the same merged mosaicmaskerror aboveThe R session exited on the error, so its tempdir, and the evidence, went with it.
Ruled out
/private/tmp.gc()andmask()on a disk-forced merge all work (terra 1.9.50).spat_*.tif, reordered by name and masked with the real 104,584-vertex floodplain polygon. OK in 0.7 min.Not yet separated
What the live run has and the offline rebuild does not:
data-raw/benchmark_composite_bulk.Rnow catches the error and inventories the temp files before exit: names, sizes, mtimes, andgdalinfo -checksumof everyspat_*.tif. The next floodplain run leaves the evidence this one lost. A cheaper way to separate the first candidate is the offline rebuild with tiles written bygdalcubes::write_ncdf()from a local image collection. The #79 review built such a collection in its scratch scripts.Acceptance
Relates: drift#79, drift#87