#!/usr/bin/env python3 """Fetch every input of our check of Peterson (2026) into /downloads/, by URL. python3 -I fetch_inputs.py Standard library only. About 180 MB in all: - NASA SPDF's OMNI data (CC0): the daily averages, omni_01_av.dat (7.7 MB), and the hourly files omni2_YYYY.dat for 2000-2007 and 2010-2023 (2.9 MB each); - NOAA PSL's NCEP/NCAR Reanalysis 1 daily means: surface pressure, pres.sfc.YYYY.nc, 2010-2023 (6-8 MB each, whole files), and precipitation rate cut to 29-51 N, 234-301 E by PSL's subset service (0.3-0.4 MB each). "NCEP-NCAR Reanalysis 1 data provided by the NOAA PSL, Boulder, Colorado, USA, from their website at https://psl.noaa.gov". Every request sends the plain client name below, with TLS verification on. Nothing fetched is run. Each whole file's SHA-256 is compared with the copy we used on 2026-11-15; a difference is reported, not fatal (NASA revises OMNI now and then). The subset service stamps the time into each file it makes, so those files never match byte for byte: run check_inputs.py, which compares the values. Then run_all.py runs every script and writes the outputs to /out/. Written for factchecked.science, 2026-11-15. """ import hashlib, os, sys, urllib.request UA = 'factchecked-research/1.0' OMNI = 'https://spdf.gsfc.nasa.gov/pub/data/omni/low_res_omni/' PSL_FILE = 'https://psl.noaa.gov/thredds/fileServer/Datasets/ncep.reanalysis/Dailies/surface/pres.sfc.{y}.nc' PSL_NCSS = ('https://psl.noaa.gov/thredds/ncss/grid/Datasets/ncep.reanalysis/Dailies/surface_gauss/prate.sfc.gauss.{y}.nc' '?var=prate&north=51&south=29&west=234&east=301&horizStride=1' '&time_start={y}-01-01T00:00:00Z&time_end={y}-12-31T00:00:00Z&accept=netcdf4') OURS = { # SHA-256 of the whole files we used, fetched 2026-11-15 'omni_01_av.dat': 'cff96d3d840ba75143811c671465ba1468f659e64465daed3258c66aebb3c9cd', 'omni2_2000.dat': 'f707f2c9fd3279839943e049b5eb6bf68a095d8caf9c47eb1a3ec39ef8768c66', 'omni2_2001.dat': '778393a58ba8e5c5ac677edae058670adeed029d0a38f0c44ffbd28fc8f74555', 'omni2_2002.dat': 'ad0316866abee6f17741e8940d02f8199570ce8a107e2cb45c2eff01972a560a', 'omni2_2003.dat': 'cb1fcee0f95af4c318b239617bbb46f6e41c811bdca8464cf397eb7fd2fb7fc9', 'omni2_2004.dat': '5538ae44d3476bb84eb963d6892537a085a9707a296cd57d6a1960ea43f89b90', 'omni2_2005.dat': '9b99d08300d8e2a2cbeaeab073b2e0d83e31b5c925c0f465860430602ad07102', 'omni2_2006.dat': '27db7ba84a0889b0438fd4428e26128a2235bcf9e30b2a77bf678fab531bf4ea', 'omni2_2007.dat': '2bdae448301e6de3863e78643178628e3bcd39dee2aea111fe523d1e393217e7', 'omni2_2010.dat': '5a70010684b553f740b95b31fb56d6ab99b0d545c6f02b11dd84141bbd8b60cb', 'omni2_2011.dat': '9a93c0e8b563a8ca6ae9c76448d2140ad00574ef65abc7a6504fdad1c3a196ce', 'omni2_2012.dat': '342612e8ed98fcc5952e4f33e3de92c657d6682728722716d68930b981f87faf', 'omni2_2013.dat': '46db595b661833960638cb1c44a9c90df55769907bdf1473ad5d9feb68e3d0d9', 'omni2_2014.dat': '8078580877128e53904084bf22cd712b347deb33c8db5133876baa19be2f57c0', 'omni2_2015.dat': 'aaa291634e011715066ddcf59028e4db16d92495ebca88e4ac034edd1f0f4b19', 'omni2_2016.dat': '9a2be4f3e975ff307fcfcca5fc1a5d4cb9f04942a0aae47d9c3529303b51c51e', 'omni2_2017.dat': 'b53494bc4fa719da1a5e6914c93307d2c9cfa1fa77abb3883e5925bfc9e0b3bc', 'omni2_2018.dat': '2f4b43cc5106d856a4765581eaf277f10506c002d72d927b21eca85776ae0b04', 'omni2_2019.dat': '8f4e57f313687b4fb86865dbb2df06adf414c7e496b99893b86013d91744b48e', 'omni2_2020.dat': '11c2de98f1fd1ebe0156ca36c439fd4063d28c95e3706ec8752e7f59eea41700', 'omni2_2021.dat': 'c7a68a97abddd6842f26225b6ac5761cdb2f375aca2b5f53b752f7158ed2f211', 'omni2_2022.dat': '413ac4895d24cab0af4861710c437f12efab44f3cd6c814a614815fa0f2c8d88', 'omni2_2023.dat': 'df74e09c22b126841835c0add8c46933b93118c33a1978f7e977f9488cf7d743', 'pres.sfc.2010.nc': '709eb0fdeb43a0f78e47693586b4b224e6ec81024e7c339876a934d362a363d7', 'pres.sfc.2011.nc': '317845c0117787fb5c3bfe32b81559cfe08ff0d4348cb043474dced05908c643', 'pres.sfc.2012.nc': '4d8f4334dc796f5cd504e52ed48667e55c0d44fa12d64526a19a6fac5d3a4217', 'pres.sfc.2013.nc': '64ccefc61215bc1b4fc6f84319892c2a069db4317a0af507640d30b52574a365', 'pres.sfc.2014.nc': '5555a2f42235830d12980e3793780ad3df05ced15cd0811890d05756dbf90bad', 'pres.sfc.2015.nc': '688d49ba68d6b72ba459c0b5641e75c5c3975385dd23f5849d811e856047bade', 'pres.sfc.2016.nc': '16a289ac75c8188c98ca9afb3929982b76b7ea214134c088a942999b6f1156f4', 'pres.sfc.2017.nc': '549a45eae112d63b3cb99839606c98ed972a4735d0e8d3504afb3e1cb82f3d83', 'pres.sfc.2018.nc': '6c95e80e3b52b67e6c382d4785cf6ef5b589cd261383aa9a3e451cf0749a040d', 'pres.sfc.2019.nc': '80f9ed6a604f3180543e2f1d26e9dcf7ac6a6ce6383f0c7c91fa32505fa90a15', 'pres.sfc.2020.nc': '6fa246b2aeb91b13837a39a94d647ac3df0bdedd3062818505a0839ba38de95d', 'pres.sfc.2021.nc': '38fb86928ff7e7c0f4c8faf8196bcda35b96db0315da2b8cc01f200e05ca5898', 'pres.sfc.2022.nc': '346dde89919db3294ea6b4c4fcfcf35e4e56901d052d2b43845d46fcce93a546', 'pres.sfc.2023.nc': 'd144a87f05168ccafa4e3a48de1867d842c4fc11609cb24879f0bf17d7c0b3bc', } def get(url, path): req = urllib.request.Request(url, headers={'User-Agent': UA}) with urllib.request.urlopen(req, timeout=300) as r, open(path + '.part', 'wb') as f: while True: b = r.read(1 << 20) if not b: break f.write(b) os.replace(path + '.part', path) def main(root): jobs = [('omni', 'omni_01_av.dat', OMNI + 'omni_01_av.dat')] for y in list(range(2000, 2008)) + list(range(2010, 2024)): jobs.append(('omni', f'omni2_{y}.dat', OMNI + f'omni2_{y}.dat')) for y in range(2010, 2024): jobs.append(('ncep-r1', f'pres.sfc.{y}.nc', PSL_FILE.format(y=y))) jobs.append(('ncep-r1', f'prate.sfc.gauss.{y}.USAbox.nc', PSL_NCSS.format(y=y))) for sub, name, url in jobs: folder = os.path.join(root, 'downloads', sub) os.makedirs(folder, exist_ok=True) path = os.path.join(folder, name) if not os.path.exists(path): get(url, path) h = hashlib.sha256(open(path, 'rb').read()).hexdigest() want = OURS.get(name) note = 'matches our copy' if want == h else ('differs from our copy' if want else 'subset file: check values with check_inputs.py') print(f'{name}: {os.path.getsize(path):,} bytes, {note}') if __name__ == '__main__': if len(sys.argv) != 2: sys.exit(__doc__) main(sys.argv[1])