diff --git a/.gitignore b/.gitignore index af55669..6a108ac 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,10 @@ Thumbs.db runs/ *.parquet !tests/data/*.parquet +# The Gate 1 daily dv/v products are archived with the paper: derived data +# from the public SCEDC archive, redistributable under its licence +# (paper/data/gate1/DATA_LICENCE.md). About 0.8 MB in total. +!paper/data/gate1/dvv2y/**/*.parquet !tests/data/*.feather *.feather !tests/data/*.feather diff --git a/literature/figs/SOURCES.md b/literature/figs/SOURCES.md index 8445b51..fbad2e0 100644 --- a/literature/figs/SOURCES.md +++ b/literature/figs/SOURCES.md @@ -18,7 +18,7 @@ prints the registry. `paper/build.py --figures` runs the driver. | `demo_11_multiverse` | `codameter.deviations.multiverse` + `fig_multiverse_full` (slow) | | `demo_12_bayes` | `codameter.uq_bayes._build_bayes` + `_fig_bayes` (slow) | -| `realdata_1_validation` | `codameter.gate1.fig_gate1_comparison`: needs the untracked daily products under `paper/data/gate1/dvv2y/` (skipped with a message where they are absent); every plotted array is in the sidecar | +| `realdata_1_validation` | `codameter.gate1.fig_gate1_comparison`: reads the daily products archived under `paper/data/gate1/dvv2y/` (skipped with a message where they are absent); every plotted array is in the sidecar | Every `.json` sidecar records `git_commit`; sidecars written since 2026-09-13 also record `git_dirty` (true when tracked files under `src/` @@ -39,8 +39,10 @@ noisepy-dvv-cloud Gate 1 run (CI.LJR / CI.RXH / CI.ARV, 2018-2019; see run, which are not archived here, so they are committed as produced. The comparison figure (`realdata_1_validation`) used to be produced there as well; it is now generated in this repository from the archived daily products and -`paper/data/gate1/comparison.json`. The Gate 1 run commit and `--use-case` -are to be pinned in `paper/data/gate1/README.md` (issue #46). -Until then the two interferogram-based figures cannot be regenerated from -this checkout; the comparison figure can, wherever the daily products are -present. +`paper/data/gate1/comparison.json`. The run is pinned to noisepy-dvv-cloud +`be1538b` with the `groundwater` use case; the evidence for both is in +`paper/data/gate1/README.md` (issue #46). +The two interferogram-based figures cannot be regenerated from this +checkout, because the correlations they are drawn from are not archived. +The comparison figure regenerates from any checkout: its inputs are +archived with the paper. diff --git a/paper/data/gate1/CHECKSUMS.sha256 b/paper/data/gate1/CHECKSUMS.sha256 new file mode 100644 index 0000000..2567dd4 --- /dev/null +++ b/paper/data/gate1/CHECKSUMS.sha256 @@ -0,0 +1,28 @@ +42661e2bc3c0d66bc91da6473c50f905096f412c761b2bdc37324278e0d1af50 dvv2y/band=1.0-2.0/CI.ARV.parquet +babf41406b3a9d20b177da5ebf21dbabfc7de3f1ebdcf53cc17bcf5c8db04c6d dvv2y/band=1.0-2.0/CI.ARV.v040.parquet +317ae3bf73c87920fd9fe8ab7daa53ed2461bd0bd2d25a332d0e2f319e33c3ae dvv2y/band=1.0-2.0/CI.LJR.parquet +1538aa0d289d0c23b223158d2da4dcda64721d97f04255f4b0fd1f0ba7ec4eb0 dvv2y/band=1.0-2.0/CI.LJR.v040.parquet +8e86da38d87280419a81fd7425ca0b70bfe6fed25453ddf0d19814ca2b7649cd dvv2y/band=1.0-2.0/CI.RXH.parquet +0cf6d5463eb1911877f5feefbd626bbbef0be05d8ca667d5b227a32bc7493059 dvv2y/band=1.0-2.0/CI.RXH.v040.parquet +a7a45da17140344c7b6aeeb758decd072e800c7ad46664392e2aaaeaea5b98b4 dvv2y/band=2.0-4.0/CI.ARV.parquet +d31df2f2b2adde81acaeab25008d68ceac992c5618e9454c133972a22c2ea7b3 dvv2y/band=2.0-4.0/CI.ARV.v040.parquet +dcd5e4989c6cc37f0d5aa0fbe9aeb405085e799acaf4cd00a69b7b710790da7d dvv2y/band=2.0-4.0/CI.LJR.parquet +288412098cc8174dc1dd4ec9c725b9648e18478bd6acc9590e0339e38ddf72b9 dvv2y/band=2.0-4.0/CI.LJR.v040.parquet +45bd1d71a6111db7a9a08b81612f8a8a2604d145aaedba330c4874a39985cb52 dvv2y/band=2.0-4.0/CI.RXH.parquet +36360595c608585637068890c8818269bbd58249ff88020b1d4b6f4fc916612b dvv2y/band=2.0-4.0/CI.RXH.v040.parquet +58f39fe282a96c6f58902ae2c16a033548958a55fd066f4299b35f7f36f1f5d6 dvv2y/band=4.0-8.0/CI.ARV.parquet +8c654a16ead161b1cfb07646c4c6eb27c1c51035a96d39e51c8e98ba1817b2ca dvv2y/band=4.0-8.0/CI.ARV.v040.parquet +311b73e8e92d63ad7da6fc95cbc9b57515f9a5ed069435dbc70d06d5f29a23af dvv2y/band=4.0-8.0/CI.LJR.parquet +2869992de8074b9bdf6ee3923d4881576f92fd7b51545d33abe78b8a1203550d dvv2y/band=4.0-8.0/CI.LJR.v040.parquet +fa42d7a6a47b44824d57f13fe1628f301e429990a4955f212bab3645ddc3f380 dvv2y/band=4.0-8.0/CI.RXH.parquet +ae77974424cd422c1bbd5b97fbbf9d84d3ee6425b3002babdb28c62fd537d2c1 dvv2y/band=4.0-8.0/CI.RXH.v040.parquet +d62c081811443186d336760307f8ff888d31d21af68aeb4a7316b0afce664ccc dvv2y/band=8.0-16.0/CI.ARV.parquet +a91710bd1b7e9580ae065c206628ad6f3d36528aa39e3b481e0f2e4dcc023fdc dvv2y/band=8.0-16.0/CI.ARV.v040.parquet +9f85167dd37ec46201cccba1ce1237b069c4a1a8fd5fceb9b4d1318b1dab487c dvv2y/band=8.0-16.0/CI.LJR.parquet +ea8b83b5f2a186462f7a46ffd664efefbd62bcf7ce5b2cadd7297e2e63be415b dvv2y/band=8.0-16.0/CI.LJR.v040.parquet +4c2a34cffaae837dd491c879e2645e3e88b307c29bdae82f84301f0833d866fc dvv2y/band=8.0-16.0/CI.RXH.parquet +576880c9f4e3bd34f6e3813e3fdc0148983c8c8b57fa8af740d121751100080b dvv2y/band=8.0-16.0/CI.RXH.v040.parquet +7956fc2e2b070a1dc3933ff818efd4f34f0c2d2e695260d1a532d8fd47906c65 legacy_cd2022/CI.ARV.arrow +85e33fa2611f6b7a3beccbfb368abc42573a0f9da142df346a71b8cb9d6658f7 legacy_cd2022/CI.LJR.arrow +f0ab6c687b75e06ae19fa5a10668bc95515c8fdeab00e2d8a0ab5787772ccc19 legacy_cd2022/CI.RXH.arrow +afe9ef0253242e75ee2aa094765ee15055079efc02bb251901d3cf309aef9158 dvv2y/correction.json diff --git a/paper/data/gate1/DATA_LICENCE.md b/paper/data/gate1/DATA_LICENCE.md new file mode 100644 index 0000000..71a1cb8 --- /dev/null +++ b/paper/data/gate1/DATA_LICENCE.md @@ -0,0 +1,72 @@ +# Terms for the data archived here + +## What is archived + +Derived data only. `dvv2y/` holds daily relative velocity change series +(one value per station, band and day, with its error columns and the +per-epoch coherence) computed from cross-correlations of continuous +ground motion. No waveform, no correlation function and no station +metadata from the upstream archive is redistributed here. +`legacy_cd2022/` holds the published 90-day composite product the +comparison is made against. + +## Upstream terms, continuous ground motion + +The correlations behind these products were computed from the public +Southern California Earthquake Data Center archive (`s3://scedc-pds`, +network CI), distributed through the AWS Open Data programme under this +grant, quoted verbatim from its registry entry: + +> SCEDC herby grants the non-exclusive, royalty free, non-transferable, +> worldwide right and license to use, reproduce and publicly display in all +> media public data from the Southern California Seismic Network. Please cite +> the SCEDC (doi:10.7909/C3WD3xH1) and SCSN (doi:10.7914/SN/CI) for any +> research publications using this data. + +Checked 2026-11-01 at . +The archive states a citation policy and no further restriction on reuse +(). + +Any publication using these products must therefore cite both: + +- SCEDC (2013). Southern California Earthquake Center. Caltech. Dataset. + doi:10.7909/C3WD3xH1 +- California Institute of Technology (1926). Southern California Seismic + Network. International Federation of Digital Seismograph Networks. + Other/Seismic Network. doi:10.7914/SN/CI + +The manuscript's data availability statement carries both citations. + +## Upstream terms, the comparison product + +`legacy_cd2022/CI..arrow` is the 90-day composite relative velocity +change product of Clements and Denolle, as published with + +- Clements, T., and Denolle, M. A. (2023). The seismic signature of + California's earthquakes, droughts, and floods. *Journal of Geophysical + Research: Solid Earth*, 128. doi:10.1029/2022JB025553 + +It is reproduced here by its authors, one of whom is an author of this +paper, restricted to the three stations and the two years the comparison +covers. + +## Terms for the derived products + +**To be confirmed by the author before the archive is deposited.** The +proposal is Creative Commons Attribution 4.0 (CC BY 4.0) for the contents +of `dvv2y/`, which is compatible with the upstream grant and with the +repository's software licence, and keeps the two citations above +mandatory in practice. Until that is confirmed, treat these files as +released for academic use with attribution to this paper. + +## Integrity + +`CHECKSUMS.sha256` and `MANIFEST.json` list a SHA-256 digest for every +file here. Verify a copy with + +``` +cd paper/data/gate1 && shasum -a 256 -c CHECKSUMS.sha256 +``` + +or regenerate the manifest with `python scripts/gate1_manifest.py` +(`--check` verifies without writing). diff --git a/paper/data/gate1/MANIFEST.json b/paper/data/gate1/MANIFEST.json new file mode 100644 index 0000000..1293566 --- /dev/null +++ b/paper/data/gate1/MANIFEST.json @@ -0,0 +1,281 @@ +{ + "provenance": { + "pipeline_repository": "https://github.com/noisepy/noisepy-dvv-cloud", + "pipeline_commit": "be1538b", + "pipeline_commit_subject": "Version-aware dv/v convention: no negation on codameter >= 0.4", + "pipeline_commit_utc": "2026-08-09T15:39Z", + "use_case": "groundwater", + "use_case_evidence": "the dv/v stage hashes its effective configuration into config_hash; recomputing that hash over the six use cases of codameter.use_cases matches 'groundwater' on all four bands and nothing else", + "codameter_version_at_run": "0.4.0", + "waveform_source": "SCEDC public archive (s3://scedc-pds), network CI", + "stations": [ + "CI.LJR", + "CI.ARV", + "CI.RXH" + ], + "period": "2018-01-01/2019-12-31", + "licence": "paper/data/gate1/DATA_LICENCE.md" + }, + "files": [ + { + "path": "dvv2y/band=1.0-2.0/CI.ARV.parquet", + "bytes": 41557, + "sha256": "42661e2bc3c0d66bc91da6473c50f905096f412c761b2bdc37324278e0d1af50", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 660, + "config_hash": "dc93a54800a6" + }, + { + "path": "dvv2y/band=1.0-2.0/CI.ARV.v040.parquet", + "bytes": 41593, + "sha256": "babf41406b3a9d20b177da5ebf21dbabfc7de3f1ebdcf53cc17bcf5c8db04c6d", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 660, + "config_hash": "dc93a54800a6" + }, + { + "path": "dvv2y/band=1.0-2.0/CI.LJR.parquet", + "bytes": 42316, + "sha256": "317ae3bf73c87920fd9fe8ab7daa53ed2461bd0bd2d25a332d0e2f319e33c3ae", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 678, + "config_hash": "dc93a54800a6" + }, + { + "path": "dvv2y/band=1.0-2.0/CI.LJR.v040.parquet", + "bytes": 42352, + "sha256": "1538aa0d289d0c23b223158d2da4dcda64721d97f04255f4b0fd1f0ba7ec4eb0", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 678, + "config_hash": "dc93a54800a6" + }, + { + "path": "dvv2y/band=1.0-2.0/CI.RXH.parquet", + "bytes": 36746, + "sha256": "8e86da38d87280419a81fd7425ca0b70bfe6fed25453ddf0d19814ca2b7649cd", + "rows": 639, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 565, + "config_hash": "dc93a54800a6" + }, + { + "path": "dvv2y/band=1.0-2.0/CI.RXH.v040.parquet", + "bytes": 36782, + "sha256": "0cf6d5463eb1911877f5feefbd626bbbef0be05d8ca667d5b227a32bc7493059", + "rows": 639, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 565, + "config_hash": "dc93a54800a6" + }, + { + "path": "dvv2y/band=2.0-4.0/CI.ARV.parquet", + "bytes": 31668, + "sha256": "a7a45da17140344c7b6aeeb758decd072e800c7ad46664392e2aaaeaea5b98b4", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 394, + "config_hash": "2976066eb87b" + }, + { + "path": "dvv2y/band=2.0-4.0/CI.ARV.v040.parquet", + "bytes": 31706, + "sha256": "d31df2f2b2adde81acaeab25008d68ceac992c5618e9454c133972a22c2ea7b3", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 394, + "config_hash": "2976066eb87b" + }, + { + "path": "dvv2y/band=2.0-4.0/CI.LJR.parquet", + "bytes": 42452, + "sha256": "dcd5e4989c6cc37f0d5aa0fbe9aeb405085e799acaf4cd00a69b7b710790da7d", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 681, + "config_hash": "2976066eb87b" + }, + { + "path": "dvv2y/band=2.0-4.0/CI.LJR.v040.parquet", + "bytes": 42488, + "sha256": "288412098cc8174dc1dd4ec9c725b9648e18478bd6acc9590e0339e38ddf72b9", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 681, + "config_hash": "2976066eb87b" + }, + { + "path": "dvv2y/band=2.0-4.0/CI.RXH.parquet", + "bytes": 36674, + "sha256": "45bd1d71a6111db7a9a08b81612f8a8a2604d145aaedba330c4874a39985cb52", + "rows": 639, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 563, + "config_hash": "2976066eb87b" + }, + { + "path": "dvv2y/band=2.0-4.0/CI.RXH.v040.parquet", + "bytes": 36710, + "sha256": "36360595c608585637068890c8818269bbd58249ff88020b1d4b6f4fc916612b", + "rows": 639, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 563, + "config_hash": "2976066eb87b" + }, + { + "path": "dvv2y/band=4.0-8.0/CI.ARV.parquet", + "bytes": 12289, + "sha256": "58f39fe282a96c6f58902ae2c16a033548958a55fd066f4299b35f7f36f1f5d6", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 24, + "config_hash": "ab49fee56135" + }, + { + "path": "dvv2y/band=4.0-8.0/CI.ARV.v040.parquet", + "bytes": 12325, + "sha256": "8c654a16ead161b1cfb07646c4c6eb27c1c51035a96d39e51c8e98ba1817b2ca", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 24, + "config_hash": "ab49fee56135" + }, + { + "path": "dvv2y/band=4.0-8.0/CI.LJR.parquet", + "bytes": 42459, + "sha256": "311b73e8e92d63ad7da6fc95cbc9b57515f9a5ed069435dbc70d06d5f29a23af", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 682, + "config_hash": "ab49fee56135" + }, + { + "path": "dvv2y/band=4.0-8.0/CI.LJR.v040.parquet", + "bytes": 42495, + "sha256": "2869992de8074b9bdf6ee3923d4881576f92fd7b51545d33abe78b8a1203550d", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 682, + "config_hash": "ab49fee56135" + }, + { + "path": "dvv2y/band=4.0-8.0/CI.RXH.parquet", + "bytes": 36510, + "sha256": "fa42d7a6a47b44824d57f13fe1628f301e429990a4955f212bab3645ddc3f380", + "rows": 639, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 560, + "config_hash": "ab49fee56135" + }, + { + "path": "dvv2y/band=4.0-8.0/CI.RXH.v040.parquet", + "bytes": 36546, + "sha256": "ae77974424cd422c1bbd5b97fbbf9d84d3ee6425b3002babdb28c62fd537d2c1", + "rows": 639, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 560, + "config_hash": "ab49fee56135" + }, + { + "path": "dvv2y/band=8.0-16.0/CI.ARV.parquet", + "bytes": 13573, + "sha256": "d62c081811443186d336760307f8ff888d31d21af68aeb4a7316b0afce664ccc", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 37, + "config_hash": "d06385415eed" + }, + { + "path": "dvv2y/band=8.0-16.0/CI.ARV.v040.parquet", + "bytes": 13609, + "sha256": "a91710bd1b7e9580ae065c206628ad6f3d36528aa39e3b481e0f2e4dcc023fdc", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 37, + "config_hash": "d06385415eed" + }, + { + "path": "dvv2y/band=8.0-16.0/CI.LJR.parquet", + "bytes": 22416, + "sha256": "9f85167dd37ec46201cccba1ce1237b069c4a1a8fd5fceb9b4d1318b1dab487c", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 237, + "config_hash": "d06385415eed" + }, + { + "path": "dvv2y/band=8.0-16.0/CI.LJR.v040.parquet", + "bytes": 22452, + "sha256": "ea8b83b5f2a186462f7a46ffd664efefbd62bcf7ce5b2cadd7297e2e63be415b", + "rows": 727, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 237, + "config_hash": "d06385415eed" + }, + { + "path": "dvv2y/band=8.0-16.0/CI.RXH.parquet", + "bytes": 36277, + "sha256": "4c2a34cffaae837dd491c879e2645e3e88b307c29bdae82f84301f0833d866fc", + "rows": 639, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 553, + "config_hash": "d06385415eed" + }, + { + "path": "dvv2y/band=8.0-16.0/CI.RXH.v040.parquet", + "bytes": 36313, + "sha256": "576880c9f4e3bd34f6e3813e3fdc0148983c8c8b57fa8af740d121751100080b", + "rows": 639, + "first_date": "2018-01-01", + "last_date": "2019-12-30", + "rows_with_dvv": 553, + "config_hash": "d06385415eed" + }, + { + "path": "legacy_cd2022/CI.ARV.arrow", + "bytes": 120618, + "sha256": "7956fc2e2b070a1dc3933ff818efd4f34f0c2d2e695260d1a532d8fd47906c65" + }, + { + "path": "legacy_cd2022/CI.LJR.arrow", + "bytes": 132954, + "sha256": "85e33fa2611f6b7a3beccbfb368abc42573a0f9da142df346a71b8cb9d6658f7" + }, + { + "path": "legacy_cd2022/CI.RXH.arrow", + "bytes": 120114, + "sha256": "f0ab6c687b75e06ae19fa5a10668bc95515c8fdeab00e2d8a0ab5787772ccc19" + }, + { + "path": "dvv2y/correction.json", + "bytes": 8082, + "sha256": "afe9ef0253242e75ee2aa094765ee15055079efc02bb251901d3cf309aef9158" + } + ] +} diff --git a/paper/data/gate1/README.md b/paper/data/gate1/README.md index 49eb1b7..9c0a65e 100644 --- a/paper/data/gate1/README.md +++ b/paper/data/gate1/README.md @@ -5,6 +5,11 @@ Clements & Denolle (2022), generated by the noisepy-dvv-cloud Gate 1 run (CI.LJR / CI.RXH / CI.ARV, 2018-2019, NoisePy correlations, codameter 5-member ensemble, physical dv/v convention of codameter v0.4.0). +All four octave bands (1-2, 2-4, 4-8, 8-16 Hz) are tracked in the +repository, with their pre-correction originals, their SHA-256 digests +(`CHECKSUMS.sha256`, `MANIFEST.json`) and the terms they are distributed +under (`DATA_LICENCE.md`). The manuscript uses the 2-4 Hz band. + - `dvv2y/band=-/CI..parquet` — daily ensemble dv/v. Columns: date, dvv (%), dvv_err (between-config = epistemic), dvv_err_within (Weaver CC-based measurement), dvv_err_method, cc @@ -54,9 +59,52 @@ Ensemble members (from `noisepy_dvv_cloud/dvv.py`): the codameter recommendation for the `--use-case` passed to the run, at the product's band, plus four perturbations (stack halved, stack doubled, coda window shifted later by a quarter of its length, fixed reference swapped to -moving). `config_hash` covers the NoisePy correlation settings only. +moving). `config_hash` is the digest of the *dv/v* configuration (the +estimator, band, coda window, stack length, reference scheme, coherence +gate and component-combination rule), which is what makes the use case +recoverable from the products; the correlation stage keeps a separate +hash of its own settings. + +## Provenance (resolved 2026-11-01, issue #46; audit REP-02) + +**Use case: `groundwater`.** The products do not record it, but they do +record `config_hash`, which the dv/v stage computes over its effective +configuration. Recomputing that digest for each of the six use cases of +`codameter.use_cases` reproduces the stored value on all four bands for +`groundwater` and for no other case, and the no-use-case fallback does +not match either: + +| band (Hz) | stored `config_hash` | reproduced by | +|---|---|---| +| 1-2 | `dc93a54800a6` | `groundwater` | +| 2-4 | `2976066eb87b` | `groundwater` | +| 4-8 | `ab49fee56135` | `groundwater` | +| 8-16 | `d06385415eed` | `groundwater` | + +At 2-4 Hz that use case gives a 2-8 s coda window, which is the window +the ensemble was built around. + +**Pipeline commit: `be1538b`** of noisepy-dvv-cloud ("Version-aware dv/v +convention: no negation on codameter >= 0.4", 2026-08-09 15:39 UTC). The +products were written at 15:25 local on 2026-08-09; `be1538b` is the last +commit touching the dv/v stage before that, no commit at all landed in +that repository between it and the run, and the next change to the stage +is `567fb8b` on 2026-08-17. The three candidates the audit listed differ +only in the comparison script and the sign convention; `be1538b` is the +latest of them, which is the one the author directed us to pin. + +**Codameter version at run: 0.4.0.** The archived `dvv_err_within` +columns were rescaled afterwards under the corrected Weaver floor (see +the correction note above), so the error columns correspond to the +current codameter floor rather than to the code at `be1538b`. + +**Figure scripts.** The comparison figure of the manuscript is no longer +the one this run produced: it is regenerated in this repository from the +products below. The two remaining real-data figures (the interferograms +and the warm-up behaviour) were produced inside the cloud run from +correlations that are not archived here, and no committed script in that +repository reproduces them; they are committed as produced. -Provenance still to pin (audit REP-02): the noisepy-dvv-cloud commit of -the Gate 1 run (candidates: bbd1b02, 341b83b, be1538b, all dated -2026-08-09) and the `--use-case` it was given, neither of which the -products record. +**Rights.** The waveforms behind these products are public SCEDC data, +redistributable under the licence quoted in `DATA_LICENCE.md`, which also +lists the two citations that any use of them requires. diff --git a/paper/data/gate1/dvv2y/band=1.0-2.0/CI.ARV.parquet b/paper/data/gate1/dvv2y/band=1.0-2.0/CI.ARV.parquet new file mode 100644 index 0000000..baf5f7b Binary files /dev/null and b/paper/data/gate1/dvv2y/band=1.0-2.0/CI.ARV.parquet differ diff --git a/paper/data/gate1/dvv2y/band=1.0-2.0/CI.ARV.v040.parquet b/paper/data/gate1/dvv2y/band=1.0-2.0/CI.ARV.v040.parquet new file mode 100644 index 0000000..ec72bc3 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=1.0-2.0/CI.ARV.v040.parquet differ diff --git a/paper/data/gate1/dvv2y/band=1.0-2.0/CI.LJR.parquet b/paper/data/gate1/dvv2y/band=1.0-2.0/CI.LJR.parquet new file mode 100644 index 0000000..50f69dc Binary files /dev/null and b/paper/data/gate1/dvv2y/band=1.0-2.0/CI.LJR.parquet differ diff --git a/paper/data/gate1/dvv2y/band=1.0-2.0/CI.LJR.v040.parquet b/paper/data/gate1/dvv2y/band=1.0-2.0/CI.LJR.v040.parquet new file mode 100644 index 0000000..92d3da4 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=1.0-2.0/CI.LJR.v040.parquet differ diff --git a/paper/data/gate1/dvv2y/band=1.0-2.0/CI.RXH.parquet b/paper/data/gate1/dvv2y/band=1.0-2.0/CI.RXH.parquet new file mode 100644 index 0000000..192a988 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=1.0-2.0/CI.RXH.parquet differ diff --git a/paper/data/gate1/dvv2y/band=1.0-2.0/CI.RXH.v040.parquet b/paper/data/gate1/dvv2y/band=1.0-2.0/CI.RXH.v040.parquet new file mode 100644 index 0000000..0e0ef09 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=1.0-2.0/CI.RXH.v040.parquet differ diff --git a/paper/data/gate1/dvv2y/band=2.0-4.0/CI.ARV.parquet b/paper/data/gate1/dvv2y/band=2.0-4.0/CI.ARV.parquet new file mode 100644 index 0000000..42fdf99 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=2.0-4.0/CI.ARV.parquet differ diff --git a/paper/data/gate1/dvv2y/band=2.0-4.0/CI.ARV.v040.parquet b/paper/data/gate1/dvv2y/band=2.0-4.0/CI.ARV.v040.parquet new file mode 100644 index 0000000..3386b00 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=2.0-4.0/CI.ARV.v040.parquet differ diff --git a/paper/data/gate1/dvv2y/band=2.0-4.0/CI.LJR.parquet b/paper/data/gate1/dvv2y/band=2.0-4.0/CI.LJR.parquet new file mode 100644 index 0000000..67d90b5 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=2.0-4.0/CI.LJR.parquet differ diff --git a/paper/data/gate1/dvv2y/band=2.0-4.0/CI.LJR.v040.parquet b/paper/data/gate1/dvv2y/band=2.0-4.0/CI.LJR.v040.parquet new file mode 100644 index 0000000..874aed5 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=2.0-4.0/CI.LJR.v040.parquet differ diff --git a/paper/data/gate1/dvv2y/band=2.0-4.0/CI.RXH.parquet b/paper/data/gate1/dvv2y/band=2.0-4.0/CI.RXH.parquet new file mode 100644 index 0000000..d7afe0a Binary files /dev/null and b/paper/data/gate1/dvv2y/band=2.0-4.0/CI.RXH.parquet differ diff --git a/paper/data/gate1/dvv2y/band=2.0-4.0/CI.RXH.v040.parquet b/paper/data/gate1/dvv2y/band=2.0-4.0/CI.RXH.v040.parquet new file mode 100644 index 0000000..59b4a0d Binary files /dev/null and b/paper/data/gate1/dvv2y/band=2.0-4.0/CI.RXH.v040.parquet differ diff --git a/paper/data/gate1/dvv2y/band=4.0-8.0/CI.ARV.parquet b/paper/data/gate1/dvv2y/band=4.0-8.0/CI.ARV.parquet new file mode 100644 index 0000000..6824425 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=4.0-8.0/CI.ARV.parquet differ diff --git a/paper/data/gate1/dvv2y/band=4.0-8.0/CI.ARV.v040.parquet b/paper/data/gate1/dvv2y/band=4.0-8.0/CI.ARV.v040.parquet new file mode 100644 index 0000000..88b174d Binary files /dev/null and b/paper/data/gate1/dvv2y/band=4.0-8.0/CI.ARV.v040.parquet differ diff --git a/paper/data/gate1/dvv2y/band=4.0-8.0/CI.LJR.parquet b/paper/data/gate1/dvv2y/band=4.0-8.0/CI.LJR.parquet new file mode 100644 index 0000000..3b78196 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=4.0-8.0/CI.LJR.parquet differ diff --git a/paper/data/gate1/dvv2y/band=4.0-8.0/CI.LJR.v040.parquet b/paper/data/gate1/dvv2y/band=4.0-8.0/CI.LJR.v040.parquet new file mode 100644 index 0000000..6321577 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=4.0-8.0/CI.LJR.v040.parquet differ diff --git a/paper/data/gate1/dvv2y/band=4.0-8.0/CI.RXH.parquet b/paper/data/gate1/dvv2y/band=4.0-8.0/CI.RXH.parquet new file mode 100644 index 0000000..6749bc9 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=4.0-8.0/CI.RXH.parquet differ diff --git a/paper/data/gate1/dvv2y/band=4.0-8.0/CI.RXH.v040.parquet b/paper/data/gate1/dvv2y/band=4.0-8.0/CI.RXH.v040.parquet new file mode 100644 index 0000000..7d71476 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=4.0-8.0/CI.RXH.v040.parquet differ diff --git a/paper/data/gate1/dvv2y/band=8.0-16.0/CI.ARV.parquet b/paper/data/gate1/dvv2y/band=8.0-16.0/CI.ARV.parquet new file mode 100644 index 0000000..f1393a2 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=8.0-16.0/CI.ARV.parquet differ diff --git a/paper/data/gate1/dvv2y/band=8.0-16.0/CI.ARV.v040.parquet b/paper/data/gate1/dvv2y/band=8.0-16.0/CI.ARV.v040.parquet new file mode 100644 index 0000000..7068b93 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=8.0-16.0/CI.ARV.v040.parquet differ diff --git a/paper/data/gate1/dvv2y/band=8.0-16.0/CI.LJR.parquet b/paper/data/gate1/dvv2y/band=8.0-16.0/CI.LJR.parquet new file mode 100644 index 0000000..b773923 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=8.0-16.0/CI.LJR.parquet differ diff --git a/paper/data/gate1/dvv2y/band=8.0-16.0/CI.LJR.v040.parquet b/paper/data/gate1/dvv2y/band=8.0-16.0/CI.LJR.v040.parquet new file mode 100644 index 0000000..bb40175 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=8.0-16.0/CI.LJR.v040.parquet differ diff --git a/paper/data/gate1/dvv2y/band=8.0-16.0/CI.RXH.parquet b/paper/data/gate1/dvv2y/band=8.0-16.0/CI.RXH.parquet new file mode 100644 index 0000000..e89778f Binary files /dev/null and b/paper/data/gate1/dvv2y/band=8.0-16.0/CI.RXH.parquet differ diff --git a/paper/data/gate1/dvv2y/band=8.0-16.0/CI.RXH.v040.parquet b/paper/data/gate1/dvv2y/band=8.0-16.0/CI.RXH.v040.parquet new file mode 100644 index 0000000..a33a0f8 Binary files /dev/null and b/paper/data/gate1/dvv2y/band=8.0-16.0/CI.RXH.v040.parquet differ diff --git a/paper/manuscript_marine.qmd b/paper/manuscript_marine.qmd index b9dfdfc..69aca53 100644 --- a/paper/manuscript_marine.qmd +++ b/paper/manuscript_marine.qmd @@ -1923,14 +1923,23 @@ Table\ \ref{tab:calibration} is rerun for each of its three scenarios seeds of each run are stored with the archived run); and how Table\ \ref{tab:gate1} and Fig.\ \ref{fig:realdata-validation} are recomputed from the daily products and the published \citet{Clements2023} -series archived with the paper. The daily products and the two remaining -real-data figures were produced by the noisepy-dvv-cloud Gate 1 run from -public Southern California Earthquake Data Center waveforms; the products -are available locally during this analysis but are not tracked in the -repository. The exact Gate 1 run commit, run configuration and -redistribution archive remain to be supplied; their current provenance -limits are recorded with the archived products. A versioned archive is -planned but has not yet been deposited. +series archived with the paper. Those daily products cover all four octave +bands (1--2, 2--4, 4--8 and 8--16$\,$Hz) at the three stations, and are +deposited with their pre-correction originals, a SHA-256 digest for each +file, and the terms they are distributed under. They were produced +by the noisepy-dvv-cloud pipeline at commit \texttt{be1538b} with the +groundwater use case, which sets the 2--8$\,$s coda window at 2--4$\,$Hz; +the use case is not recorded in the products but is recoverable from the +configuration digest they carry, which it reproduces on all four bands +and no other use case does. The correlations behind them come from the +public Southern California Earthquake Data Center archive, network CI +[@SCEDC2013; @SCSN1926], which grants the right to reproduce and publicly +display these data and requires both citations; the waveforms and +correlations themselves are not redistributed here. The comparison +product is the published 90-day composite of @Clements2023. The two +remaining real-data figures were produced inside the same cloud run from +correlations that are not archived. A versioned deposit of the archive, +with a DOI, is planned at the next release and has not yet been made. # Acknowledgements {.unnumbered} diff --git a/paper/manuscript_marine.tex b/paper/manuscript_marine.tex index 0368034..c51021d 100644 --- a/paper/manuscript_marine.tex +++ b/paper/manuscript_marine.tex @@ -102,7 +102,7 @@ - + \usepackage[]{natbib} \bibliographystyle{gji} @@ -2303,14 +2303,25 @@ \section*{Data availability}\label{data-availability} the settings and seeds of each run are stored with the archived run); and how Table~\ref{tab:gate1} and Fig.~\ref{fig:realdata-validation} are recomputed from the daily products and the published -\citet{Clements2023} series archived with the paper. The daily products -and the two remaining real-data figures were produced by the -noisepy-dvv-cloud Gate 1 run from public Southern California Earthquake -Data Center waveforms; the products are available locally during this -analysis but are not tracked in the repository. The exact Gate 1 run -commit, run configuration and redistribution archive remain to be -supplied; their current provenance limits are recorded with the archived -products. A versioned archive is planned but has not yet been deposited. +\citet{Clements2023} series archived with the paper. Those daily +products cover all four octave bands (1--2, 2--4, 4--8 and +8--16\(\,\)Hz) at the three stations, and are deposited with their +pre-correction originals, a SHA-256 digest for each file, and the terms +they are distributed under. They were produced by the noisepy-dvv-cloud +pipeline at commit \texttt{be1538b} with the groundwater use case, which +sets the 2--8\(\,\)s coda window at 2--4\(\,\)Hz; the use case is not +recorded in the products but is recoverable from the configuration +digest they carry, which it reproduces on all four bands and no other +use case does. The correlations behind them come from the public +Southern California Earthquake Data Center archive, network CI +\citep{SCEDC2013, SCSN1926}, which grants the right to reproduce and +publicly display these data and requires both citations; the waveforms +and correlations themselves are not redistributed here. The comparison +product is the published 90-day composite of \citet{Clements2023}. The +two remaining real-data figures were produced inside the same cloud run +from correlations that are not archived. A versioned deposit of the +archive, with a DOI, is planned at the next release and has not yet been +made. \section*{Acknowledgements}\label{acknowledgements} \addcontentsline{toc}{section}{Acknowledgements} diff --git a/paper/references.bib b/paper/references.bib index ad119b4..4e25e28 100644 --- a/paper/references.bib +++ b/paper/references.bib @@ -389,3 +389,19 @@ @article{Viens2020 year = {2020}, doi = {10.1093/gji/ggz509} } + +@misc{SCEDC2013, + author = {{Southern California Earthquake Data Center}}, + title = {Southern California Earthquake Center}, + howpublished = {Caltech. Dataset}, + year = {2013}, + doi = {10.7909/C3WD3xH1} +} + +@misc{SCSN1926, + author = {{California Institute of Technology}}, + title = {Southern California Seismic Network}, + howpublished = {International Federation of Digital Seismograph Networks. Other/Seismic Network}, + year = {1926}, + doi = {10.7914/SN/CI} +} diff --git a/review/HUMAN_AI_COLLABORATION.md b/review/HUMAN_AI_COLLABORATION.md index c15ee8f..30b2a08 100644 --- a/review/HUMAN_AI_COLLABORATION.md +++ b/review/HUMAN_AI_COLLABORATION.md @@ -24,6 +24,9 @@ Agents involved: Astra (Codex/GPT-6), which produced the iteration-1 review, the 13. **"PR51 is merged. Move on to P1?"** The author merged the P0 pull request and asked for P1. The agent branched `iter3/P1`, executed the package (daily-grid multiverse, robust step metric, gate probe, three-seed sweep, hyper-priors and chain settings stated, held-out coverage and split R-hat in the calibration driver, the depth and framework wording), and opened PR #52. Two of the plan's diagnostics found errors the plan had not anticipated: the correlation-length fit of the temporal covariance was wrong (39 days from an intercept fit over 40 lags, 5.7 days from the short-lag decay), and the credible band on the ensemble mean is about 80 percent set by the smoothness prior. Both were corrected or stated, not hidden. Where an author decision was pending (#50, the step metric), the agent proceeded under a stated default and recorded it in the issue. 14. **"Back in here, keep working; some Copilot reviews came in."** The author asked the agent to continue and to handle the automatic Copilot reviews. The agent answered every Copilot thread on PRs #52, #53 and #54 with a fix and a reply (zero-variance rows in the autocorrelation, a stale docstring, the wavefield split among measuring rows, a false "one DOI each", a markdown code-span corruption in Appendix C that predated the branch, an untracked-file leak in the dirty flag, a literal tilde, an over-claim about sidecar fields, the tolerance scale of the sidecar check). It then went on to the next agent-ready packages without being asked package by package: P4 (survey hygiene, PR #53) and P3 part 1 (provenance, sidecar check, in-repo Gate 1 figure, paper workflow, PR #54). The locked calibration reruns were lost to a machine restart and rerun. +15. **"Merge #52, then #53, then #54 with that three-hunk resolution."** The author merged the three finished packages through the agent, having first asked for a status update and for the software's own names to be taken out of the manuscript, on the ground that the paper is about the method and not the software. Fable removed every script, module, command line and file path from the text, keeping the package name and the repository link in the data availability statement. +16. **"Tackling issue 46."** The author answered the four provenance questions: archive all four bands, not only the one the paper uses; SCEDC-derived products may be archived and disseminated for academic research, with the licensing tracked to be sure; keep the use-case flag; pin the latest cloud commit. Two of the answers were checkable rather than assertions, and were checked: the use case was recovered as `groundwater` by reproducing the configuration digest the products carry, which no other use case reproduces, and the commit was pinned to `be1538b` by showing that nothing landed in the pipeline repository between it and the hour the products were written. The licence was read from the archive's own registry entry and quoted verbatim beside the two citations it requires. + ## Decisions that were the author's - The scope of the paper: depth propagation as an interface, the advisor as infrastructure, no cloud-scalability claim. @@ -31,6 +34,7 @@ Agents involved: Astra (Codex/GPT-6), which produced the iteration-1 review, the - The impact framing and the extension to engineering applications. - Tracking the revision through GitHub issues with one pull request per issue and Copilot review before approval. - Merging each package; the agent opens pull requests and answers reviews but does not merge. +- The provenance answers of issue #46, including the right to redistribute the derived field products. - Adjudication of every reviewer finding remains the author's; no finding was closed on the agent's say-so, and the iteration-2 verdicts came from independent subagents. ## What the agents did not do diff --git a/review/REVISION_PLAN_ITER3.md b/review/REVISION_PLAN_ITER3.md index eb5017c..6991eea 100644 --- a/review/REVISION_PLAN_ITER3.md +++ b/review/REVISION_PLAN_ITER3.md @@ -160,3 +160,4 @@ The submission decision should rest on a defensible measurement claim, transpare - 2026-09-13: P1 executed on branch `iter3/P1` (commits 6613570, 7b67e53, f62e01e) for issue #39; step-error metric taken as post- minus pre-event medians pending #50, the Yuan et al. (2021) regime left for #47. Two findings beyond the plan: the correlation-length fit was wrong (39 d from an intercept fit over 40 lags; 5.7 d from the short-lag decay; whitening check added) and the credible band on mu is about 80% prior-set (duplication check added). The shared_source and clock_drift locked reruns were still running when the PR opened and follow in the same PR. - 2026-09-13: P4 executed on branch `iter3/P4` (commit 04edd37) for issue #42: DOI-aware key reuse (Obermann2013b), denominators (103 publications, 96 measuring, 82 full text, 75 full text measuring), coded uncertainty rates (57 / 11 / 7), documented provenance. Row verification and the search queries stay with the author in #48; the Yuan regime with #47. - 2026-09-13: P3 part 1 executed on branch `iter3/P3` (PR #54) for issue #41: sidecar `git_dirty` and `generator_digest`, `codameter.figures --check`, shard generator digests, `codameter.gate1` regenerating Fig 15 from the archived products with the corrected error band and the matched-rule r, the calibration invocations in Data availability, and `.github/workflows/paper.yml` (sidecar check, survey drift, PDF build with text checks). Archive, release and DOI wait on #46 and the other packages. +- 2026-11-01: P0, P1, P4 and P3 part 1 merged into the manuscript branch. Issue #46 answered by the author: archive all four bands, SCEDC-derived products may be redistributed, keep the use-case flag, pin the latest cloud commit. Acted on in P3 part 2: the four bands are archived in the repository with digests and licence terms, the run is pinned to noisepy-dvv-cloud `be1538b`, and the use case is recovered as `groundwater` from the configuration digest the products carry. Still open in P3: the licence for the derived products (CC BY 4.0 proposed) and the versioned deposit with a DOI, both at the release. diff --git a/scripts/gate1_manifest.py b/scripts/gate1_manifest.py new file mode 100644 index 0000000..bd041d6 --- /dev/null +++ b/scripts/gate1_manifest.py @@ -0,0 +1,147 @@ +#!/usr/bin/env python3 +"""Checksum manifest for the archived Gate 1 data products. + +Writes, for every data file under ``paper/data/gate1/``: + +- ``paper/data/gate1/CHECKSUMS.sha256``: the usual two-column format, so + ``shasum -a 256 -c CHECKSUMS.sha256`` verifies a copy anywhere; +- ``paper/data/gate1/MANIFEST.json``: the same digests plus what each file + holds (rows, first and last date, the dv/v configuration hash) and the + provenance the products do not carry in themselves. + +Run ``python scripts/gate1_manifest.py`` to write them, ``--check`` to verify +the committed digests against the files on disk (exit 1 on any mismatch). +""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import sys +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +GATE1 = ROOT / "paper" / "data" / "gate1" +PATTERNS = ("dvv2y/**/*.parquet", "legacy_cd2022/*.arrow", "dvv2y/correction.json") + +#: Provenance recovered in 2026-11 (issue #46); see paper/data/gate1/README.md. +PROVENANCE = { + "pipeline_repository": "https://github.com/noisepy/noisepy-dvv-cloud", + "pipeline_commit": "be1538b", + "pipeline_commit_subject": "Version-aware dv/v convention: no negation on codameter >= 0.4", + "pipeline_commit_utc": "2026-08-09T15:39Z", + "use_case": "groundwater", + "use_case_evidence": ( + "the dv/v stage hashes its effective configuration into config_hash; " + "recomputing that hash over the six use cases of codameter.use_cases " + "matches 'groundwater' on all four bands and nothing else" + ), + "codameter_version_at_run": "0.4.0", + "waveform_source": "SCEDC public archive (s3://scedc-pds), network CI", + "stations": ["CI.LJR", "CI.ARV", "CI.RXH"], + "period": "2018-01-01/2019-12-31", + "licence": "paper/data/gate1/DATA_LICENCE.md", +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as fh: + for chunk in iter(lambda: fh.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def describe(path: Path) -> dict: + """What the file holds, for the files we can read cheaply.""" + out: dict = {} + if path.suffix == ".parquet": + import pandas as pd + + df = pd.read_parquet(path) + out["rows"] = int(len(df)) + if "date" in df: + d = pd.to_datetime(df["date"]) + out["first_date"], out["last_date"] = ( + str(d.min().date()), + str(d.max().date()), + ) + if "dvv" in df: + out["rows_with_dvv"] = int(df["dvv"].notna().sum()) + if "config_hash" in df and len(df): + out["config_hash"] = str(df["config_hash"].iloc[0]) + return out + + +def files() -> list[Path]: + seen: list[Path] = [] + for pattern in PATTERNS: + seen.extend(sorted(p for p in GATE1.glob(pattern) if p.is_file())) + return seen + + +def main(argv: list[str] | None = None) -> int: + ap = argparse.ArgumentParser(description=__doc__.split("\n\n")[0]) + ap.add_argument("--check", action="store_true", help="verify, do not write") + args = ap.parse_args(argv) + + if args.check: + # Digests only: a checker must not depend on the files it checks being + # readable as data. A truncated product has to come out as a mismatch, + # not as a traceback from the parquet reader. + committed = json.loads((GATE1 / "MANIFEST.json").read_text())["files"] + have: dict[str, str] = {} + unreadable: list[str] = [] + for path in files(): + rel = path.relative_to(GATE1).as_posix() + try: + have[rel] = sha256(path) + except OSError as exc: + unreadable.append(f"{rel} ({exc.strerror or exc})") + bad = [ + c["path"] + for c in committed + if c["path"] in have and have[c["path"]] != c["sha256"] + ] + missing = [c["path"] for c in committed if c["path"] not in have] + extra = sorted(set(have) - {c["path"] for c in committed}) + for label, names in ( + ("changed", bad), + ("missing", missing), + ("unreadable", unreadable), + ("untracked", extra), + ): + for n in names: + print(f"{label}: {n}") + ok = len(committed) - len(bad) - len(missing) + print(f"checked {len(committed)} file(s): {ok} match") + return 1 if bad or missing or unreadable else 0 + + entries = [] + for path in files(): + rel = path.relative_to(GATE1).as_posix() + entries.append( + { + "path": rel, + "bytes": path.stat().st_size, + "sha256": sha256(path), + **describe(path), + } + ) + + (GATE1 / "MANIFEST.json").write_text( + json.dumps({"provenance": PROVENANCE, "files": entries}, indent=1) + "\n" + ) + (GATE1 / "CHECKSUMS.sha256").write_text( + "".join(f"{e['sha256']} {e['path']}\n" for e in entries) + ) + total = sum(e["bytes"] for e in entries) + print( + f"wrote MANIFEST.json and CHECKSUMS.sha256 ({len(entries)} files, {total / 1024:.0f} KiB)" + ) + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/src/codameter/figures.py b/src/codameter/figures.py index eab88e2..efdd7be 100644 --- a/src/codameter/figures.py +++ b/src/codameter/figures.py @@ -310,7 +310,7 @@ def _gen(b=builder): _gen_demo_12, ) gens["realdata_1_validation"] = ( - "codameter.gate1.fig_gate1_comparison (needs paper/data/gate1/dvv2y)", + "codameter.gate1.fig_gate1_comparison (from the archived Gate 1 products)", _gen_realdata_1, ) return gens diff --git a/src/codameter/gate1.py b/src/codameter/gate1.py index 49697e4..b4b1df3 100644 --- a/src/codameter/gate1.py +++ b/src/codameter/gate1.py @@ -5,9 +5,11 @@ - ``paper/data/gate1/dvv2y/band=2.0-4.0/CI..parquet``: the daily single-station ensemble dv/v of the noisepy-dvv-cloud Gate 1 run, with the error columns rescaled to the corrected Weaver floor - (``scripts/correct_gate1_within_error.py``); not tracked by git until the - redistribution terms are settled (issue #46), so the generator raises - :class:`codameter.errors.MissingInputs` where they are absent. + (``scripts/correct_gate1_within_error.py``); archived with the paper since + the redistribution terms were settled (issue #46), so a checkout can + regenerate this figure. The generator still raises + :class:`codameter.errors.MissingInputs` where the inputs are absent, which + is what a partial copy of the data directory looks like. - ``paper/data/gate1/legacy_cd2022/CI..arrow``: the published Clements and Denolle (2022) product (tracked). - ``paper/data/gate1/comparison.json``: the statistics of @@ -57,7 +59,7 @@ def load_station(sta: str, *, gate1: Path = GATE1, band: str = BAND): pq = gate1 / "dvv2y" / f"band={band}" / f"CI.{sta}.parquet" if not pq.exists(): - raise MissingInputs(f"{pq} is not available (untracked Gate 1 product)") + raise MissingInputs(f"{pq} is not available (archived Gate 1 product)") d = pd.read_parquet(pq) d["date"] = pd.to_datetime(d["date"]) d = d.set_index("date").sort_index() diff --git a/tests/test_gate1_archive.py b/tests/test_gate1_archive.py new file mode 100644 index 0000000..8991b5a --- /dev/null +++ b/tests/test_gate1_archive.py @@ -0,0 +1,126 @@ +"""The archived Gate 1 products and the provenance claims made about them. + +Two claims in the manuscript and in `paper/data/gate1/README.md` rest on +these files rather than on code: that the archived products are the ones +whose digests are published with them, and that the run used the +``groundwater`` use case, which is recoverable from the configuration digest +the products carry. Both are checked here so that a silent change to either +the data or ``codameter.use_cases`` cannot leave the paper asserting +something that is no longer true (issue #46). +""" + +from __future__ import annotations + +import hashlib +import importlib.util +import json +from pathlib import Path + +import pandas as pd +import pytest +from codameter.use_cases import recommend + +ROOT = Path(__file__).resolve().parents[1] +GATE1 = ROOT / "paper" / "data" / "gate1" +BANDS = ((1.0, 2.0), (2.0, 4.0), (4.0, 8.0), (8.0, 16.0)) +STATIONS = ("LJR", "ARV", "RXH") +USE_CASE = "groundwater" +COMBINE = "hobiger" + +pytestmark = pytest.mark.skipif( + not (GATE1 / "MANIFEST.json").exists(), reason="Gate 1 archive not present" +) + + +def _manifest() -> dict: + return json.loads((GATE1 / "MANIFEST.json").read_text()) + + +def _config_hash(cfg: dict, combine: str = COMBINE) -> str: + """The digest the cloud pipeline's dv/v stage writes into each product.""" + blob = json.dumps({**cfg, "combine": combine}, default=str).encode() + return hashlib.sha1(blob).hexdigest()[:12] + + +def test_every_archived_file_matches_its_published_digest(): + for entry in _manifest()["files"]: + path = GATE1 / entry["path"] + assert path.exists(), entry["path"] + assert path.stat().st_size == entry["bytes"], entry["path"] + digest = hashlib.sha256(path.read_bytes()).hexdigest() + assert digest == entry["sha256"], entry["path"] + + +def test_checksums_file_agrees_with_the_manifest(): + lines = (GATE1 / "CHECKSUMS.sha256").read_text().splitlines() + pairs = dict(reversed(line.split(" ", 1)) for line in lines if line.strip()) + assert pairs == {e["path"]: e["sha256"] for e in _manifest()["files"]} + + +def test_the_manifest_covers_every_archived_product(): + listed = {e["path"] for e in _manifest()["files"]} + on_disk = { + p.relative_to(GATE1).as_posix() for p in GATE1.glob("dvv2y/**/*.parquet") + } + assert on_disk <= listed + + +@pytest.mark.parametrize("band", BANDS) +def test_the_groundwater_use_case_reproduces_the_stored_configuration_digest(band): + """The products do not record the use case; this is how we know it.""" + expected = _config_hash(recommend(USE_CASE, band=band)) + for station in STATIONS: + path = GATE1 / f"dvv2y/band={band[0]}-{band[1]}" / f"CI.{station}.parquet" + stored = pd.read_parquet(path)["config_hash"].iloc[0] + assert stored == expected, ( + f"{station} at {band} Hz stores {stored}, but the '{USE_CASE}' use case " + f"now hashes to {expected}; the provenance claim in " + f"paper/data/gate1/README.md and in the paper's data availability " + f"statement needs rechecking" + ) + + +def test_no_other_use_case_reproduces_it(): + import codameter.use_cases as uc + + cases = [c for c in uc.USE_CASES if c != USE_CASE] + band = (2.0, 4.0) + stored = pd.read_parquet(GATE1 / "dvv2y/band=2.0-4.0/CI.LJR.parquet")[ + "config_hash" + ].iloc[0] + for case in cases: + assert _config_hash(recommend(case, band=band)) != stored, case + + +def _manifest_script(): + spec = importlib.util.spec_from_file_location( + "gate1_manifest", ROOT / "scripts" / "gate1_manifest.py" + ) + assert spec is not None and spec.loader is not None + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + return mod + + +def test_the_manifest_script_verifies_the_archive(): + assert _manifest_script().main(["--check"]) == 0 + + +def test_the_checker_reports_a_corrupt_product_rather_than_raising( + tmp_path, monkeypatch, capsys +): + """--check must survive the condition it exists to catch: a file that is + no longer readable as data still has to come out as a mismatch.""" + mod = _manifest_script() + target = "dvv2y/band=1.0-2.0/CI.ARV.parquet" + shadow = tmp_path / "gate1" + for entry in _manifest()["files"]: + dest = shadow / entry["path"] + dest.parent.mkdir(parents=True, exist_ok=True) + dest.write_bytes((GATE1 / entry["path"]).read_bytes()) + (shadow / "MANIFEST.json").write_bytes((GATE1 / "MANIFEST.json").read_bytes()) + (shadow / target).write_bytes(b"not a parquet file") + monkeypatch.setattr(mod, "GATE1", shadow) + assert mod.main(["--check"]) == 1 + out = capsys.readouterr().out + assert f"changed: {target}" in out