#!/usr/bin/env python """Write ../downloads/MANIFEST.md and the per-file index of the SWPC daily reports. Run: python -I make_manifest.py """ import hashlib import os import sys HERE = os.path.dirname(os.path.abspath(__file__)) ROOT = os.path.dirname(HERE) DL = os.path.join(ROOT, "downloads") DATE = "2026-11-04" def sha(p): h = hashlib.sha256() with open(p, "rb") as f: for chunk in iter(lambda: f.read(1 << 20), b""): h.update(chunk) return h.hexdigest() NCEI = "https://www.ngdc.noaa.gov/stp/space-weather/solar-data/solar-features/solar-flares/x-rays/goes/xrs" GOESR = "https://data.ngdc.noaa.gov/platforms/solar-space-observing-satellites/goes" ARXIV_PDF = { "arxiv-2610.16428": "2610.16428", "arxiv-2602.11227v2": "2602.11227v2", "arxiv-2606.07132v1": "2606.07132v1", "arxiv-2501.03791v2": "2501.03791v2", "arxiv-2206.14809v1": "2206.14809v1", "arxiv-2301.07469v1": "2301.07469v1", "arxiv-1605.04162v1": "1605.04162v1", "arxiv-2108.04006v1": "2108.04006v1", "arxiv-2208.00644v1": "2208.00644v1", "arxiv-2310.11457v1": "2310.11457v1", "arxiv-1307.5988v2": "1307.5988v2", "arxiv-2503.22337v3": "2503.22337v3", "arxiv-2303.01154v1": "2303.01154v1", "arxiv-2309.00666": "2309.00666", } def url_of(folder, name): if folder in ARXIV_PDF: aid = ARXIV_PDF[folder] if name.endswith(".pdf"): return f"https://arxiv.org/pdf/{name[:-4]}" if folder != "arxiv-2610.16428" else "https://arxiv.org/pdf/2610.16428v1" if name == "e-print.bin": return f"https://arxiv.org/e-print/{aid}" if name == "abs.html": return f"https://arxiv.org/abs/{aid}" if name.startswith("headers-"): return "response headers of the fetch" if name.endswith(".txt"): return "our pdftotext extract of the PDF" if folder == "oulu-gle": return "https://gle.oulu.fi/grid.php" if folder == "rudimirz-flares": return "https://rudimirz.com/flares/flare_data.js" if name.endswith(".js") else "response headers of the fetch" if folder == "ncei-goes-xrs-reports": return f"{NCEI}/{name}" if folder == "ncei-goesr-flsum": sat = name.split("_")[2].replace("g", "goes") return f"{GOESR}/{sat}/l2/data/xrsf-l2-flsum_science/{name}" if folder == "silso-sunspots": return { "SN_ms_tot_V2.0.csv": "https://www.sidc.be/SILSO/INFO/snmstotcsv.php", "SN_m_tot_V2.0.csv": "https://www.sidc.be/SILSO/INFO/snmtotcsv.php", "silso-datafiles.html": "https://www.sidc.be/SILSO/datafiles", }.get(name, "") if folder == "nasa-fact-sheets": return f"https://nssdc.gsfc.nasa.gov/planetary/factsheet/{name}" if folder == "charbonneau-2022": return "https://www.frontiersin.org/articles/10.3389/fspas.2022.853676/pdf" if name.endswith(".pdf") else "our extract or the response headers" if folder == "literature-index": if name.startswith("crossref-stefani2026"): return "https://api.crossref.org/works/10.3847/1538-4357/ae75b6" if name.startswith("openalex-"): return "https://api.openalex.org/works/doi:" if name.startswith("crossref-"): return "https://api.crossref.org/works?query.bibliographic=" if name.startswith("citers-"): return "https://api.openalex.org/works?filter=cites:" if name.startswith("arxiv-"): return "http://export.arxiv.org/api/query" if name == "nature-rieger1984.html": return "https://www.nature.com/articles/312623a0" if name == "nature-bai1991.html": return "https://www.nature.com/articles/350141a0" if name == "springer-dejager2005.html": return "https://link.springer.com/article/10.1007/s11207-005-4086-7 (visitor IP replaced in the footer)" if name.startswith("semanticscholar"): return "https://api.semanticscholar.org/graph/v1/paper/DOI:10.1016/j.newast.2017.09.007 (answered 429)" return "our query list" if folder == "probe": return { "oulu-root.html": "https://gle.oulu.fi/", "oulu-txtarchive.html": "https://gle.oulu.fi/txtarchive", "oulu-mainApp.js": "https://gle.oulu.fi/js/mainApp.js", "rudimirz.html": "https://rudimirz.com/flares", "rudimirz-about.html": "https://rudimirz.com/flares/about", "ncei-xrs-dir.html": f"{NCEI}/", "ncei-privacy.html": "https://www.ngdc.noaa.gov/ngdcinfo/privacy.html (answered 403)", "goes-doc.html": f"{NCEI}/documentation/", "ngdc-evt.html": "https://www.ngdc.noaa.gov/stp/space-weather/swpc-products/daily_reports/solar_event_reports/", "ngdc-evt-2024.html": "https://www.ngdc.noaa.gov/stp/space-weather/swpc-products/daily_reports/solar_event_reports/2024/", "ngdc-evt-202405.html": "https://www.ngdc.noaa.gov/stp/space-weather/swpc-products/daily_reports/solar_event_reports/2024/05/", "sci-flsum16.html": f"{GOESR}/goes16/l2/data/xrsf-l2-flsum_science/", }.get(name, "response headers of a probe") return "" lines = [ "# Downloads for `rieger-tidal-periods`", "", f"All files were fetched on {DATE} (UTC) with `curl -L -A \"factchecked-research/1.0\"`. Nothing here was executed: `flare_data.js` and `oulu-mainApp.js` were read as text, and `flare_data.js` was parsed as JSON. We searched these files for the visitor's IP address (`footer-user-ip`, \"downloaded from IP\", IPv4 patterns). One page held it: Springer's footer in `literature-index/springer-dejager2005.html`, replaced with `[visitor IP removed]` before the file was hashed here. None of the others held it. E-mail addresses printed in NOAA's report headers and in the papers stay in the raw files and go on no page.", "", "Files of 200 kB or more get moved out of the project later; this manifest keeps their URLs.", "", "## Refused or not fetched", "", "| What | URL | Answer | Size |", "|---|---|---|---|", "| NCEI's privacy, disclaimer and copyright page | https://www.ngdc.noaa.gov/ngdcinfo/privacy.html | HTTP 403 to the plain client; not retried | error page of 919 bytes kept in `probe/` |", "| Semantic Scholar record of Velasco Herrera et al. 2018 | https://api.semanticscholar.org/graph/v1/paper/DOI:10.1016/j.newast.2017.09.007 | HTTP 429; not retried | 174 bytes |", "| SWPC FTP warehouse | https://ftp.swpc.noaa.gov/pub/warehouse/ | no connection on port 443; NCEI's copy of the daily reports used instead | none |", "| SWPC daily reports for 2025-12-30 and 2025-12-31 | https://www.ngdc.noaa.gov/stp/space-weather/swpc-products/daily_reports/solar_event_reports/2025/12/20251230events.txt and 20251231events.txt | HTTP 404. GOES-R science summaries list no X-flare on those days | none |", "| Velasco Herrera et al. 2018 | https://doi.org/10.1016/j.newast.2017.09.007 | ScienceDirect not attempted, as the brief says; not read | unknown |", "| rudimirz's Google Drive deposit and `live_flares.js` | linked from https://rudimirz.com/flares | not fetched: NOAA's reports cover the same months | unknown |", "", ] total = 0 count = 0 for folder in sorted(os.listdir(DL)): p = os.path.join(DL, folder) if not os.path.isdir(p): continue if folder == "ngdc-swpc-daily-events": rows = [] for y in sorted(os.listdir(p)): yp = os.path.join(p, y) if not os.path.isdir(yp): continue for f in sorted(os.listdir(yp)): fp = os.path.join(yp, f) sz = os.path.getsize(fp) rows.append((f, sz, sha(fp), f"https://www.ngdc.noaa.gov/stp/space-weather/swpc-products/daily_reports/solar_event_reports/{y}/{f[4:6]}/{f}")) with open(os.path.join(p, "INDEX.tsv"), "w", newline="\n", encoding="utf-8") as idx: idx.write("file\tbytes\tsha256\turl\n") for r in rows: idx.write("\t".join(str(x) for x in r) + "\n") size = sum(r[1] for r in rows) total += size count += len(rows) combined = hashlib.sha256("\n".join(r[2] for r in rows).encode()).hexdigest() lines += [ f"## `{folder}/` (NOAA SWPC daily solar event reports, NCEI's copy)", "", f"{len(rows)} files, 2017-06-29 to 2026-11-03, {size:,} bytes in all, one per day. URL pattern: https://www.ngdc.noaa.gov/stp/space-weather/swpc-products/daily_reports/solar_event_reports/YYYY/MM/YYYYMMDDevents.txt. Each file's size, SHA-256 and URL are in `{folder}/INDEX.tsv` (SHA-256 {sha(os.path.join(p, 'INDEX.tsv'))}). SHA-256 of the list of file hashes: {combined}.", "", ] continue lines += [f"## `{folder}/`", "", "| File | Bytes | SHA-256 | URL |", "|---|---|---|---|"] for dp, dn, fn in os.walk(p): dn.sort() rel_dir = os.path.relpath(dp, p).replace("\\", "/") if "src-extracted" in rel_dir: continue for f in sorted(fn): fp = os.path.join(dp, f) sz = os.path.getsize(fp) total += sz count += 1 rel = f if rel_dir == "." else f"{rel_dir}/{f}" lines.append(f"| `{rel}` | {sz:,} | `{sha(fp)}` | {url_of(folder, f)} |") if os.path.isdir(os.path.join(p, "src-extracted")): lines += ["", "`src-extracted/` holds the unpacked contents of `e-print.bin`: LaTeX, bibliography and figures, read as data."] lines.append("") lines.insert(4, f"{count} files listed, {total:,} bytes, not counting the unpacked sources.") lines.insert(5, "") with open(os.path.join(DL, "MANIFEST.md"), "w", newline="\n", encoding="utf-8") as f: f.write("\n".join(lines) + "\n") print(count, total)