Skip to content

fix(vignette): use pre-cropped fixtures instead of ~2.7 GB of downloads - #35

Merged
eliotmcintire merged 2 commits into
developmentfrom
fix/vignette-use-fixtures-not-2gb-downloads
Sep 1, 2026
Merged

eliotmcintire merged 2 commits into
developmentfrom
fix/vignette-use-fixtures-not-2gb-downloads

Conversation

@eliotmcintire

Copy link
Copy Markdown
Contributor

Fixes the five failing Ubuntu legs on #31.

The failure

Quitting from Firesense_LCC_flammability.Rmd:89-131 [compare_LCC_and_fire_data]
! ParseException: Unexpected EOF parsing WKB
  1. ├─sf::st_crop(firePolygons, sf::st_bbox(lcc))
  ...
  9. │       └─sf:::CPL_geos_op2(op, x, y)

Why it happened

The vignette downloaded, at build time:

source size
Land Cover of Canada 2015 (ftp.maps.canada.ca) 1.9 GB
National Fire Database polygons (cwfis.cfs.nrcan.gc.ca) 778 MB

~2.7 GB per leg, to analyse a 50 km square. With five Ubuntu legs that is ~13.5 GB pulled concurrently from two NRCan servers. When a transfer truncates, sf::read_sf gets a short shapefile; the first GEOS operation then reads past the end of the WKB buffer and reports Unexpected EOF. "Unexpected EOF" is a truncated-file symptom, not a library-version one.

All five Ubuntu legs failed; macOS (1 leg) and Windows (3 legs) passed. That is the concurrency signature.

The existing HEAD reachability probe cannot catch this — the servers are up, the transfer is simply cut short.

The fix

Two fixtures in inst/extdata, 680 KB total:

file
lcc_studyArea.tif 1359 × 1977 @ 30 m, exact window extract (gdal_translate -projwin, no resampling)
firePolygons_studyArea.gpkg 11 features, 2007–2024

The live-download code is kept verbatim in a commented block, so the real workflow remains visible as documentation.

Latent bug fixed while here

NFDB_poly.zip contains two layers — NFDB_poly_1972to2020 and NFDB_poly_2021to2024 — and sf::read_sf reads only the first. The live version therefore silently excluded every fire after 2020, despite filtering YEAR > 2004. The fixture combines both layers, then filters, and covers 2007–2024.

How the fixtures were built

GDAL reads these archives without downloading them, via /vsizip//vsicurl/<url> — it range-requests the ZIP central directory, then fetches only the member bytes it needs. The 778 MB fire archive clipped in 27 s. (The 1.9 GB raster is DEFLATE-compressed inside its zip, so that one degraded to a full download — worth knowing before relying on the technique.)

Verified

rmarkdown::render() completes with no network access, and the burn table is unchanged in structure (10 LCC classes, e.g. class 10 at 83% burned).

Also drops library(reproducible) from the packages chunk — prepInputs/checkPath are now only in the commented block.

🤖 Generated with Claude Code

https://claude.ai/code/session_012DVjmY3im9Xak7tXLSMGCa

Firesense_LCC_flammability.Rmd downloaded the national Land Cover of Canada
2015 raster (1.9 GB zip) and the National Fire Database polygons (778 MB zip)
at vignette-build time, to analyse a 50 km square in central Saskatchewan.

Under a full CI matrix, five Ubuntu legs pulled ~13.5 GB concurrently from two
NRCan servers. Truncated transfers produced short WKB buffers, which GEOS
reported as `ParseException: Unexpected EOF parsing WKB` from inside
sf::st_crop() -> st_intersection(). All five Ubuntu legs failed; macOS (1 leg)
and Windows (3 legs) passed, which is the concurrency signature rather than a
library-version one.

The existing HEAD reachability probe could not catch this: the servers are up,
the transfer is simply cut short. Removed, along with the macOS `archive`
work-around, since nothing is downloaded or extracted any more.

Ships two fixtures in inst/extdata (680 KB total):
  - lcc_studyArea.tif           1359x1977 @ 30 m, exact window extract
  - firePolygons_studyArea.gpkg 11 features, 2007-2024

The live-download code is preserved verbatim in a commented block so the real
workflow stays visible as documentation.

Fixes a latent bug while here: NFDB_poly.zip contains TWO layers
(1972to2020 and 2021to2024) and sf::read_sf reads only the first, so the live
version silently excluded every fire after 2020. The fixture combines both
layers before filtering YEAR > 2004, and so covers 2007-2024.

`library(reproducible)` dropped from the packages chunk -- prepInputs and
checkPath are only used by the commented live block now.

Verified: rmarkdown::render() completes with no network access, and the
computed burn table is unchanged in structure (10 LCC classes).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012DVjmY3im9Xak7tXLSMGCa
@eliotmcintire
eliotmcintire merged commit 50477ea into development Sep 1, 2026
11 checks passed
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