Skip to content

Host the archives on Arbutus and download over HTTPS - #44

Open
achubaty wants to merge 39 commits into
feat/climatena-dockerfrom
feat/arbutus-hosting
Open

achubaty wants to merge 39 commits into
feat/climatena-dockerfrom
feat/arbutus-hosting

Conversation

@achubaty

@achubaty achubaty commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Moves the climate archives from Google Drive to a public bucket on Arbutus (the Digital Research Alliance of Canada's object storage) and downloads them over HTTPS. Stacked on #39; to be retargeted to development once #39 merges. This is climateData 2.3.0 in #36's plan.

For users

  • No Google account, googledrive::drive_auth() or service account: archives download over HTTPS (fixes prepInputs failures using google service account #13). Each download is checked against the MD5 in the tile index and downloaded once more if it doesn't match; network failures (e.g. DNS timeouts) are retried. A partial download left by an interrupted session is removed by a later one (after a day); a download that can't be moved into place, or an index row with no archive, stops with a message naming it.
  • makeClimateDEM() gets its GTOPO30 elevation data from the same bucket. climateData no longer depends on googledrive.
  • getClimateURLs() returns, per tile, a data frame of URLs and MD5s instead of Drive IDs.
  • rewrite_asc() writes CRLF line endings on every platform (it wrote LF on Linux and macOS).
  • Removed: ClimateNA_path() and checksums_sql(), used only by the old build scripts.
  • Once 2.3.0 is released and downloads are confirmed, the Drive copies are deleted; 2.2.3 and earlier then can't download.

For maintainers

  • Index: each archive is named by its object key (replacing gid); release.base_url holds the bucket's public URL; archives.md5 is the object's MD5 (single-part upload, so ETag = MD5). The tile tables (tiles_<type>) refer to their archive by id, and views with the old table names (historical, ...) give readers the same columns as before (zipfile, archived, key, uploaded), so the index is 20 MB instead of 52 MB. The shipped index was rebuilt in this schema by the pipeline from the release's store (tar_make(names = "index", shortcut = TRUE)); every row, archive, filled cell and release field equals the previous index's.
  • Uploads (data-raw/pipeline/R/upload_s3.R): one branch per batch, through rclone (--s3-acl public-read, single part up to 1 GiB). Each upload is checked with an anonymous HEAD (status, size, ETag). An object a released index refers to is never replaced; a changed zip replaces its object only with replace_changed = TRUE. Identical zips from the previous release are reused, not uploaded again.
  • Catalogue: after uploads, buckethost's generateIndexes() refreshes the bucket's browsable pages with the live settings, wbi/ excluded as in the live catalogue (catalogue in release.yml).
  • DEM tiles: a release with no dem_dir in _local.R builds its own DEM tiles from the GTOPO30 mosaic, after checking that the tile grid rule still gives the shipped tiles.gpkg. Every release's DEM files are checked for CRLF, cell size and lon/lat. The 3 and 1 arcmin releases keep their DEM folders.
  • Report: report.csv also lists release.yml settings that differ from available(), and lists errors only for branches the pipeline still has (a dropped tile's old errors stay in the store until tar_prune()).
  • Checks before a run: a _local.R path with a space or quote stops the run (zip, docker and rclone get paths through the shell). DEM mode fetches GTOPO30 from the release's bucket.
  • Old scripts removed: data-raw/01 to 06 (the Windows/Drive workflow) and the Drive audit helpers. An audit of every step in them found each one covered by the pipeline, obsolete (Drive), or added here (the DEM step and the report checks).
  • Includes development with Read the bundled tile index without writing beside it #43 (immutable read-only index connections).

Data

  • cna-v7.70-3arcmin: 24,219 zips, 150 GiB, at climateData/cna-v7.70-3arcmin/ in the predictiveecology bucket. The shipped index is this release's.
  • GTOPO30 Canada mosaic: climateData/dem/gtopo30Canada.zip (copied from Drive; MD5 8adc54c83fcca0301a9a2f716237d077).

Checks

  • Devtest on a scratch prefix (pipeline README, "Bucket devtest"): uploads, reruns, a changed zip, the released-index guard, reuse by a second release, a single-part upload of the largest 1 arcmin zip, catalogue timing.
  • The 3 arcmin upload: a listing of climateData/cna-v7.70-3arcmin/ against the shipped index: 24,219 keys, none missing, no MD5 or size differences (the 52 other objects are catalogue pages). 200 random anonymous HEADs: status 200, ETag = MD5. A rerun found every object and re-ran no ClimateNA batch or zip.
  • End to end on a compute node with no Google credentials: prepClimateLayers() for tile 39, one variable per archive type, 4 zips over HTTPS, no googledrive call.
  • DEM-mode devtest (pipeline README, "DEM devtest"): the tile grid rule gives the shipped tiles.gpkg; built tiles match the 3 arcmin release's grid and elevations; ClimateNA's outputs on tile 39 are byte-identical to the release's.
  • R CMD check on a compute node: 0 errors, 0 warnings, 1 note (unused hms import, as on Build data releases with a targets pipeline; ship cna-v7.70-3arcmin #39). Full suite with the online tests: 546 expectations, 0 failed, 1 skipped (makeClimateDEM(), Windows only).

🤖 Generated with Claude Code

achubaty and others added 30 commits December 3, 2026 15:08
Archives move from Google Drive to the Arbutus bucket: each index row
names its object by key, and the release table holds the bucket's URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replaces the Drive upload. Each object is uploaded public in one part
and checked with an anonymous HEAD; an object a released index refers to
is never replaced, since installed copies check its MD5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pipeline reads the bucket from release.yml and the rclone remote
from _local.R; the index records each zip's key and the bucket's URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A run whose uploads changed rewrites the bucket's browsable catalogue
with buckethost, using the bucket's live settings from release.yml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upload, reuse and guard checks passed on a scratch prefix; the catalogue
refresh takes hours over the whole bucket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
buckethost 0.3.2 rewrites the whole bucket (~18 h); release.yml's
catalogue: refresh switch keeps it off until it can rewrite one prefix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With wbi/ excluded a refresh takes minutes, not ~18 h, so the off switch
from 3936e23 goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
getClimateURLs() gives each zip's URL and index MD5; getClimateTiles()
downloads over HTTPS with httr2 and checks the MD5. No Google login.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
User vignette drops the Google login; NEWS, CLAUDE.md and the
climateDataRelease()/prepClimateLayers() docs describe the bucket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Canada mosaic is copied from Drive to climateData/dem/ and checked
against its MD5; googledrive leaves Imports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
data-raw/04 and 05 audited the Drive archives; .driveProblems(),
.archiveIndexGaps() and assessGoogle served only them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A DNS timeout failed four 3 arcmin upload branches at once: httr2 >= 1.0.4
retries curl failures only with retry_on_failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
data-raw/03 and 06 built and fingerprinted the Drive archives; the targets
pipeline replaces them. 01 and 02 stay until the DEM step has a home.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hosting

# Conflicts:
#	data-raw/06-archive_fingerprints.R
rewrite_asc() wrote LF on Linux; dem_files now stops on a DEM tile
ClimateNA can't use at the release's dem_resolution.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From data-raw/02: holes filled, 10 x 10 grid, cells that intersect Canada;
it reproduces the shipped 86 tiles exactly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Projected to the release's resolution, masked to Canada (holes filled),
cut by tile id; tiles with no DEM cell get no file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without dem_dir in _local.R, the pipeline checks the tile grid rule against
tiles.gpkg and builds the DEM tiles; releases that set dem_dir are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iles

The old scripts read years and scenarios from available() and their audit
flagged small and extra files; report.csv now lists both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pipeline now holds 02's tile and DEM recipe; ClimateNA_path() and
checksums_sql() served only the old scripts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GDAL 3.8 writes .asc rows that start with nan, then can't read the file
back; the existing DEM tiles prefix every data row with a space.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under error = "null" the DEM build went on with no input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
R CMD check warned: test-pipelineReport.R reads release.yml with yaml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cna-v7.70-3arcmin as uploaded to the bucket: 24,219 archives by object key,
release.base_url set, rollback-journal mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Built tiles match the 3 arcmin release's grid and elevations; ClimateNA's
outputs on tile 39 are byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 3 arcmin release had 1,498 small-file notes, nearly all variables close
to zero in some months (e.g. Eref04, CMD06).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pkgdown stops on a topic that matches nothing; a test now checks the index.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The DEM plan required it: file names come from makeTiles()'s numbering,
and a shift would point tile ids at another area's data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A private object with the zip's MD5 was found on every rerun and failed the
anonymous check each time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
achubaty and others added 2 commits December 3, 2026 23:39
makeClimateDEM()'s DEMdestinationPath need not exist, as with prepInputs()
before; a missing folder showed as an MD5 mismatch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every zip_notes branch of the 1 arcmin run failed with "could not find
function '.archiveExpected'" on workers started without the package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
achubaty and others added 7 commits December 4, 2026 21:45
A failed rename stops naming the file; day-old .part files from a killed session are removed;
a key with no archives row stops naming it. getClimateTiles()' return value is documented.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
.demCheck() failed with 'subscript out of bounds' on a header without ncols, nrows or a corner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stops on a _local.R path with a space or quote; reports only current branches; drops the
zip notes step, which could never fire (zip_batch() stages only allowed variables).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The release table arrived in 2.3.0; 3.0.0 is the 1 arcmin release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CLAUDE.md no longer lists prepInputs(); ClimateNA_sql() isn't a checksums database. NA keys on
both sides would have passed the shipped-index test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tile tables (tiles_<type>) hold an archive id instead of each zip's key, path and times;
views with the old table names give readers the same columns. The index shrinks from 52 to 20 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rebuilt by the pipeline (tar_make(names = "index", shortcut = TRUE)) from the release's store;
every view row, archive, filled cell and release field equals the previous index's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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