"""EXPLORATORY (added after a fresh review of the built page, 2026-11-15): the numbers the review asked for. Not pre-registered; every result is labelled exploratory on the page. Usage: py -3.12 -I fixround_checks.py 1. Each READER station's own trend since 1979 (stations.py's annual series; at least 10 valid years), for a "since 1979" column in the station table. 2. Like for like at 65 S and 40 S: R1's sea-level pressure interpolated (bilinear) to Marshall's six sites at each latitude (his Table 1, p. 4137), against his six-station means, as Marshall compared them, beside R1's whole latitude circle. Writes r1_slp_points_annual.csv (also R1 at Eureka) for the standard-library check. 3. Eureka, from the ISD reports themselves, with a parser of its own: the month and the file in which station pressure parts from sea-level pressure; the altimeter setting; the elevation written in each report; Resolute Bay's reports for comparison. Then the sea-level series with a 0.2 or 0.5 hPa step removed, the 1977 step against five reanalysis series with and without a linear drift, and R1's ground height at Eureka. 4. The window test computed the note's way (M6, Pearson lag-1 of residuals) beside the registered M1; fixed 30-year windows; R1's dry-air trend over 2001-2025 and on the 2.5 deg file; the detrended scatter of R1's polar means; 20CRv3's Arctic share. """ import calendar import csv import glob import gzip import json import math import os import re import sys from collections import defaultdict import cftime import netCDF4 import numpy as np from scipy import stats sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) import ppt_lib as L # noqa: E402 downloads, out = sys.argv[1], sys.argv[2] RES = {} LINES = [] def say(s): print(s) LINES.append(s) def fmt(t, d=3): if t is None: return "n/a" if t.get("lo") is None: return f"{t['slope']:+.{d}f} [undefined] n={t['n']}" return f"{t['slope']:+.{d}f} [{t['lo']:+.{d}f}, {t['hi']:+.{d}f}] n={t['n']}" def read_csv_cols(path): with open(path, encoding="utf-8") as fh: rows = list(csv.reader(fh)) head = rows[0] cols = {h: [] for h in head} for r in rows[1:]: for h, v in zip(head, r): cols[h].append(float(v) if v not in ("", "nan") else np.nan) return {h: np.array(v) for h, v in cols.items()} # ---------------------------------------------------------------- 1. stations since 1979 say("== 1. READER stations: own trend since 1979 (M1; >= 10 valid years)") RES["stations_since1979"] = {} for fn in sorted(glob.glob(os.path.join(out, "station_annual_*.csv"))): st = os.path.basename(fn)[len("station_annual_"):-4] if st == "Eureka": continue c = read_csv_cols(fn) y, v = c["year"].astype(int), c["annual_mean_hPa"] sel = y >= 1979 t = L.trend_window(y, v, 1979, int(y.max())) if sel.sum() >= 10 else None if t is not None: t["valid_years"] = int(sel.sum()) RES["stations_since1979"][st] = t say(f" {st:16s} {fmt(t)}" + (f" ({t['start']}-{t['end']}, {t['valid_years']} years)" if t else "")) sig = [s for s, t in RES["stations_since1979"].items() if t and t["hi"] is not None and t["hi"] < 0] n30 = [s for s, t in RES["stations_since1979"].items() if t and t["valid_years"] >= 30] sig30 = [s for s in sig if s in n30] say(f" significant falls since 1979: {len(sig)} of {sum(1 for t in RES['stations_since1979'].values() if t)}" f" stations; {len(sig30)} of the {len(n30)} with at least 30 valid years: {', '.join(sig30)}") RES["stations_since1979_summary"] = {"significant_fall": sig, "with_30_years": n30, "significant_of_30": sig30} # ---------------------------------------------------------------- 2. Marshall's sites SITES = {"65S": [("Novolazarevskaya", -70.8, 11.8), ("Mawson", -67.6, 62.9), ("Mirny", -66.6, 93.0), ("Casey", -66.3, 110.5), ("Dumont d'Urville", -66.7, 140.0), ("Faraday", -65.2, -64.3)], "40S": [("Marion Island", -46.9, 37.9), ("Ile Nouvelle Amsterdam", -37.8, 77.5), ("Hobart", -42.9, 147.3), ("Christchurch", -43.5, 172.6), ("Valdivia", -39.6, -73.1), ("Gough Island", -40.4, -9.9)]} coords = json.load(open(os.path.join(out, "station_coords.json"), encoding="utf-8")) EUR = (coords["Eureka"]["lat"], coords["Eureka"]["lon"]) def marshall_annual(path): out_ = {} for line in open(path, encoding="utf-8"): f = line.split() if f and re.fullmatch(r"\d{4}", f[0]) and len(f) == 13: yr = int(f[0]) d = [calendar.monthrange(yr, m)[1] for m in range(1, 13)] out_[yr] = sum(float(v) * w for v, w in zip(f[1:], d)) / sum(d) return out_ with netCDF4.Dataset(os.path.join(downloads, "psl-r1", "slp.mon.mean.nc")) as ds: ds.set_auto_mask(False) t = ds.variables["time"] dd = cftime.num2date(t[:], t.units, calendar=getattr(t, "calendar", "standard")) yy = np.array([d.year for d in dd]) mm = np.array([d.month for d in dd]) lat, lon = ds.variables["lat"][:], ds.variables["lon"][:] slp = np.asarray(ds.variables["slp"][:], dtype=float) points = {} for band, sites in SITES.items(): for name, la, lo in sites: points[name] = L.annual_means(yy, mm, L.apply_point(slp, L.bilinear_setup(lat, lon, la, lo % 360.0))) points["Eureka"] = L.annual_means(yy, mm, L.apply_point(slp, L.bilinear_setup(lat, lon, EUR[0], EUR[1] % 360.0))) years = points["Eureka"][0] for k in points: assert np.array_equal(points[k][0], years) mean_sites = {band: np.mean([points[n][1] for n, _, _ in sites], axis=0) for band, sites in SITES.items()} with open(os.path.join(out, "r1_slp_points_annual.csv"), "w", newline="\n") as fh: names = [n for b in SITES.values() for n, _, _ in b] fh.write("year," + ",".join(n.replace(" ", "_").replace("'", "") for n in names) + ",sites_mean_65S,sites_mean_40S,Eureka\n") for i, yr in enumerate(years): fh.write(f"{yr}," + ",".join(f"{points[n][1][i]:.4f}" for n in names) + f",{mean_sites['65S'][i]:.4f},{mean_sites['40S'][i]:.4f},{points['Eureka'][1][i]:.4f}\n") zon = read_csv_cols(os.path.join(out, "r1_slp_zonal_annual.csv")) say("== 2. Like for like: R1 at Marshall's six sites (bilinear, 2.5 deg slp file)") RES["sites"] = {} for band, fn in (("65S", "l65.1957.2007.txt"), ("40S", "l40.1957.2007.txt")): st = marshall_annual(os.path.join(downloads, "bas-sam", fn)) zy = zon["year"].astype(int) zc = zon[f"r1_slp_{band}"] ys = np.array([y for y in years if y in st and 1957 <= y <= 2025 and y in set(zy)]) S_ = np.array([st[y] for y in ys]) R_ = np.array([mean_sites[band][list(years).index(y)] for y in ys]) C_ = np.array([zc[list(zy).index(y)] for y in ys]) r = {"years": [int(ys[0]), int(ys[-1])], "n": int(len(ys)), "level_sites_minus_circle": float((R_ - C_).mean()), "level_sites_minus_stations_pre1979": float((R_ - S_)[ys <= 1978].mean()), "level_sites_minus_stations_1979on": float((R_ - S_)[ys >= 1979].mean())} for a, b in ((1957, 2025), (1957, 1978), (1979, 2025)): sel = (ys >= a) & (ys <= b) r[f"{a}-{b}"] = {"stations": L.trend(ys[sel], S_[sel]), "r1_sites": L.trend(ys[sel], R_[sel]), "r1_circle": L.trend(ys[sel], C_[sel]), "sites_minus_stations": L.trend(ys[sel], R_[sel] - S_[sel]), "circle_minus_stations": L.trend(ys[sel], C_[sel] - S_[sel]), "sites_minus_circle": L.trend(ys[sel], R_[sel] - C_[sel])} x = r[f"{a}-{b}"] say(f" {band} {a}-{b}: stations {fmt(x['stations'])}; R1 sites {fmt(x['r1_sites'])}; " f"R1 circle {fmt(x['r1_circle'])}") say(f" sites - stations {fmt(x['sites_minus_stations'])}; circle - stations " f"{fmt(x['circle_minus_stations'])}; sites - circle {fmt(x['sites_minus_circle'])}") r["ratio_sites_to_stations_full"] = r["1957-2025"]["r1_sites"]["slope"] / r["1957-2025"]["stations"]["slope"] say(f" {band} levels: R1 sites - R1 circle {r['level_sites_minus_circle']:+.2f} hPa; R1 sites - stations " f"{r['level_sites_minus_stations_pre1979']:+.2f} (1957-1978), {r['level_sites_minus_stations_1979on']:+.2f}" f" (1979-2025); full-period ratio R1 sites / stations {r['ratio_sites_to_stations_full']:.2f}") RES["sites"][band] = r # ---------------------------------------------------------------- 3. Eureka and Resolute BAD = set("2367") def parse_isd(fn): """Yield (file id, yyyymmdd, elevation, slp, altimeter, station pressure) per report.""" fid = os.path.basename(fn)[:12] with gzip.open(fn, "rt", encoding="latin-1") as fh: for line in fh: date = line[15:23] elev = line[46:51] s, q = line[99:104], line[104] slp_ = int(s) / 10.0 if s != "99999" and q not in BAD else None m = re.search(r"MA1(\d{5})(.)(\d{5})(.)", line[105:]) alt = stp = None if m: if m.group(1) != "99999" and m.group(2) not in BAD: alt = int(m.group(1)) / 10.0 if m.group(3) != "99999" and m.group(4) not in BAD: stp = int(m.group(3)) / 10.0 yield fid, date, elev, slp_, alt, stp def isd_summary(files, label, months_from, months_to): mon = defaultdict(list) yr_alt = defaultdict(lambda: {"alt_minus_stp": [], "alt_minus_slp": [], "elev": defaultdict(int)}) daily = defaultdict(list) for fn in files: for fid, date, elev, slp_, alt, stp in parse_isd(fn): y, m = int(date[:4]), int(date[4:6]) yr_alt[y]["elev"][elev] += 1 if slp_ is not None and stp is not None: if months_from <= y * 100 + m <= months_to: mon[(fid, y, m)].append(stp - slp_) if date[:6] in ("197612", "197701"): daily[(fid, date)].append(stp - slp_) if alt is not None and stp is not None: yr_alt[y]["alt_minus_stp"].append(alt - stp) if alt is not None and slp_ is not None: yr_alt[y]["alt_minus_slp"].append(alt - slp_) say(f" {label}: monthly mean of station minus sea-level pressure, by file") rows = [] for (fid, y, m), v in sorted(mon.items(), key=lambda k: (k[0][1], k[0][2], k[0][0])): rows.append({"file": fid, "year": y, "month": m, "n": len(v), "mean": float(np.mean(v)), "sd": float(np.std(v))}) say(f" {fid} {y}-{m:02d}: {np.mean(v):+.2f} (sd {np.std(v):.2f}, {len(v)} reports)") drows = [{"file": fid, "date": d, "n": len(v), "mean": float(np.mean(v))} for (fid, d), v in sorted(daily.items(), key=lambda k: (k[0][1], k[0][0]))] for r_ in drows: if r_["date"][4:] in ("1229", "1230", "1231", "0101", "0102", "0103"): say(f" day {r_['file']} {r_['date']}: {r_['mean']:+.2f} ({r_['n']} reports)") yrows = [] for y in sorted(yr_alt): a = yr_alt[y] yrows.append({"year": y, "elevations": dict(a["elev"]), "alt_minus_stp": float(np.mean(a["alt_minus_stp"])) if a["alt_minus_stp"] else None, "alt_minus_slp": float(np.mean(a["alt_minus_slp"])) if a["alt_minus_slp"] else None, "n_alt_stp": len(a["alt_minus_stp"])}) return rows, drows, yrows say("== 3. Eureka's reports (own parser), 1975-1978, and Resolute Bay's") eu_files = sorted(glob.glob(os.path.join(downloads, "noaa-isd", "eureka", "*.gz"))) eu_m, eu_d, eu_y = isd_summary([f for f in eu_files if re.search(r"-(197[3-9]|198[0-5])\.gz$", f)], "Eureka", 197601, 197812) for r_ in eu_y: if 1973 <= r_["year"] <= 1985: say(f" Eureka {r_['year']}: elevations {r_['elevations']}; altimeter - station " f"{r_['alt_minus_stp'] if r_['alt_minus_stp'] is None else round(r_['alt_minus_stp'], 2)}; " f"altimeter - sea level {r_['alt_minus_slp'] if r_['alt_minus_slp'] is None else round(r_['alt_minus_slp'], 2)}" f" ({r_['n_alt_stp']} reports)") re_files = sorted(glob.glob(os.path.join(downloads, "noaa-isd", "resolute", "*.gz"))) re_m, re_d, re_y = isd_summary(re_files, "Resolute Bay", 197601, 197812) for r_ in re_y: say(f" Resolute {r_['year']}: elevations {r_['elevations']}") RES["eureka_monthly"], RES["eureka_daily"], RES["eureka_yearly"] = eu_m, eu_d, eu_y RES["resolute_monthly"], RES["resolute_daily"], RES["resolute_yearly"] = re_m, re_d, re_y # the annual series of stations.py (>= 4 hours a day, >= 20 days a month, 12 months) ea = read_csv_cols(os.path.join(out, "eureka_isd_annual.csv")) ey = ea["year"].astype(int) say(" Eureka annual series, 1951-2024 (M1)") RES["eureka_trends"] = {} for name, col in (("station", "station_pressure_hPa"), ("sea_level", "sea_level_pressure_hPa")): ok = ~np.isnan(ea[col]) & (ey >= 1951) & (ey <= 2024) RES["eureka_trends"][name] = L.trend(ey[ok], ea[col][ok]) say(f" {name}: {fmt(RES['eureka_trends'][name])}") ok = ~np.isnan(ea["sea_level_pressure_hPa"]) & (ey >= 1951) & (ey <= 2024) for step in (0.2, 0.5): v = ea["sea_level_pressure_hPa"][ok] - np.where(ey[ok] >= 1977, step, 0.0) t_ = L.trend(ey[ok], v) RES["eureka_trends"][f"sea_level_minus_{step}_from_1977"] = t_ say(f" sea level with a +{step} hPa step from 1977 removed: {fmt(t_)}") ok2 = ~np.isnan(ea["station_pressure_hPa"]) & ~np.isnan(ea["sea_level_pressure_hPa"]) & (ey >= 1951) & (ey <= 2024) off_post = float(np.mean((ea["station_pressure_hPa"] - ea["sea_level_pressure_hPa"])[ok2 & (ey >= 1977)])) RES["eureka_post1977_offset"] = off_post say(f" station minus sea level, mean of 1977-2024 annual values: {off_post:+.2f} hPa") # the step against reanalysis series at Eureka, with and without a linear drift def rean_point(p): c = read_csv_cols(os.path.join(out, f"station_points_annual_{p}.csv")) return c["year"].astype(int), c["Eureka"] REAN = {"R1 sea-level pressure": (years, points["Eureka"][1]), "R1 surface pressure (2.5 deg)": rean_point("r1"), "R1 surface pressure (Gaussian)": rean_point("r1g"), "JRA-55 surface pressure": rean_point("jra55"), "20CRv3 surface pressure": rean_point("c20v3")} say(" The 1977 step in each ISD series against each reanalysis series at Eureka (exploratory).") say(" 'means' = 1977-2024 minus 1951-1976 mean of (ISD - scaled reanalysis anomalies);") say(" 'with drift' = the step term of ISD - reanalysis = a + b t + c [t >= 1977], OLS,") say(" with a 95% interval widened for lag-1 autocorrelation as in M1.") RES["eureka_steps"] = {} for sname, col in (("station", "station_pressure_hPa"), ("sea level", "sea_level_pressure_hPa")): okk = ~np.isnan(ea[col]) & (ey >= 1951) & (ey <= 2024) sy, sv = ey[okk], ea[col][okk] for rname, (ry, rv) in REAN.items(): rmap = {int(a): b for a, b in zip(ry, rv) if not np.isnan(b)} cy = np.array([y for y in sy if y in rmap]) s_ = np.array([sv[list(sy).index(y)] for y in cy]) r_ = np.array([rmap[y] for y in cy]) k = s_.mean() / r_.mean() d = (s_ - s_.mean()) - k * (r_ - r_.mean()) # ISD minus reanalysis pre, post = cy <= 1976, cy >= 1977 step_means = float(d[post].mean() - d[pre].mean()) X = np.column_stack([np.ones(len(cy)), (cy - 1977) / 10.0, post.astype(float)]) beta, *_ = np.linalg.lstsq(X, d, rcond=None) e = d - X @ beta n = len(cy) r1 = float((e[:-1] * e[1:]).sum() / (e ** 2).sum()) rr = max(r1, 0.0) neff = n * (1 - rr) / (1 + rr) dfree = neff - 3 cov = (e ** 2).sum() / dfree * np.linalg.inv(X.T @ X) if dfree > 0 else None se = float(math.sqrt(cov[2, 2])) if cov is not None else None crit = float(stats.t.ppf(0.975, dfree)) if dfree > 0 else None drift_trend = L.trend(cy, d) x = {"n": int(n), "years": [int(cy[0]), int(cy[-1])], "step_means": step_means, "step_with_drift": float(beta[2]), "drift_per_decade": float(beta[1]), "step_with_drift_lo": float(beta[2] - crit * se) if se else None, "step_with_drift_hi": float(beta[2] + crit * se) if se else None, "difference_trend": drift_trend} RES["eureka_steps"][f"ISD {sname} vs {rname}"] = x say(f" ISD {sname:9s} vs {rname:30s}: n={n} means {step_means:+.2f}; with drift " f"{x['step_with_drift']:+.2f} [{x['step_with_drift_lo']:+.2f}, {x['step_with_drift_hi']:+.2f}]; " f"ISD - reanalysis trend {fmt(drift_trend)}") # R1's ground at Eureka with netCDF4.Dataset(os.path.join(downloads, "psl-r1", "hgt.sfc.nc")) as ds: ds.set_auto_mask(False) h = np.asarray(ds.variables["hgt"][:], dtype=float) h = h.reshape((-1,) + h.shape[-2:]) hl, hn = ds.variables["lat"][:], ds.variables["lon"][:] z = float(L.apply_point(h, L.bilinear_setup(hl, hn, EUR[0], EUR[1] % 360.0))[0]) corners = [(float(hl[i]), float(hn[j]), float(h[0, i, j])) for i, j, w in L.bilinear_setup(hl, hn, EUR[0], EUR[1] % 360.0)] r1s = rean_point("r1") sel = (r1s[0] >= 1951) & (r1s[0] <= 2024) selp = (years >= 1951) & (years <= 2024) RES["r1_at_eureka"] = {"ground_height_m": z, "grid_corners": corners, "surface_pressure_mean_1951_2024": float(np.nanmean(r1s[1][sel])), "slp_mean_1951_2024": float(points["Eureka"][1][selp].mean()), "slp_trend_1951_2024": L.trend(years[selp], points["Eureka"][1][selp]), "surface_trend_1951_2024": L.trend(r1s[0][sel], r1s[1][sel])} x = RES["r1_at_eureka"] say(f" R1 at Eureka: ground {z:.0f} m (bilinear; corners {[(a, b, round(c)) for a, b, c in corners]}); " f"surface pressure {x['surface_pressure_mean_1951_2024']:.1f} hPa, sea-level pressure " f"{x['slp_mean_1951_2024']:.1f} hPa (1951-2024 means); trends: sea level {fmt(x['slp_trend_1951_2024'])}, " f"surface {fmt(x['surface_trend_1951_2024'])}") # ---------------------------------------------------------------- 4. intervals, windows, misc def pearson(u, v): u, v = np.asarray(u), np.asarray(v) return float(np.corrcoef(u, v)[0, 1]) def trend_m6(x, y): n, sxx, b, a, e, sse, _ = L._fit(x, y) r = max(pearson(e[:-1], e[1:]), 0.0) neff = n * (1 - r) / (1 + r) if neff <= 2: return {"slope": b * 10, "lo": None, "hi": None, "n": n} se = math.sqrt(sse / (neff - 2) / sxx) crit = stats.t.ppf(0.975, neff - 2) return {"slope": b * 10, "lo": (b - crit * se) * 10, "hi": (b + crit * se) * 10, "n": n} def load_bands(p): c = read_csv_cols(os.path.join(out, f"annual_bands_{p}.csv")) return c["year"].astype(int), c def window(y, v, a, b, m6=False): sel = (y >= a) & (y <= b) return trend_m6(y[sel], v[sel]) if m6 else L.trend(y[sel], v[sel]) say("== 4. Band intervals and windows, M1 (registered) against M6 (the note's)") B = {p: load_bands(p) for p in ("r1g", "jra55", "c20v3")} maxd, worst = 0.0, None RES["band_m1_m6"] = {} for p, (y, c) in B.items(): for band in ("polar", "tropical", "antarctic", "arctic"): t1 = L.trend(y, c[band]) t6 = trend_m6(y, c[band]) dlo, dhi = abs(t1["lo"] - t6["lo"]), abs(t1["hi"] - t6["hi"]) RES["band_m1_m6"][f"{p} {band}"] = {"M1": [t1["lo"], t1["hi"]], "M6": [t6["lo"], t6["hi"]]} if max(dlo, dhi) > maxd: maxd, worst = max(dlo, dhi), f"{p} {band}: M1 [{t1['lo']:+.4f}, {t1['hi']:+.4f}], M6 [{t6['lo']:+.4f}, {t6['hi']:+.4f}]" say(f" largest difference between the M1 and M6 bounds of the 12 full-record band trends: {maxd:.4f} ({worst})") RES["band_m1_m6_max"] = maxd counts = {"M1": [0, 0], "M6": [0, 0]} fixed = [] for s in range(1958, 2015 - 29 + 1): for e in range(s + 29, 2016): for meth in ("M1", "M6"): tp = [window(*B[p][:1], B[p][1]["polar"], s, e, meth == "M6") for p in B] tt = [window(*B[p][:1], B[p][1]["tropical"], s, e, meth == "M6") for p in B] if all(t["hi"] is not None and t["hi"] < 0 for t in tp): counts[meth][0] += 1 if all(t["lo"] is not None and t["lo"] > 0 for t in tt): counts[meth][1] += 1 if meth == "M1" and e == s + 29: fixed.append((s, all(t["hi"] is not None and t["hi"] < 0 for t in tp))) say(f" 435 common windows: all three polar intervals below zero M1 {counts['M1'][0]}, M6 {counts['M6'][0]}; " f"all three tropical above zero M1 {counts['M1'][1]}, M6 {counts['M6'][1]}") say(" fixed 30-year windows (M1), all three polar below zero, by first year: " + " ".join(f"{s}:{'Y' if ok_ else '-'}" for s, ok_ in fixed)) RES["windows_m1_m6"] = counts RES["fixed_30yr"] = fixed say("== 5. Other numbers") g = read_csv_cols(os.path.join(out, "annual_global_r1g_budget.csv")) gy = g["year"].astype(int) for a, b in ((1979, 2025), (1979, 2001), (1993, 2025), (2001, 2025)): t_ = window(gy, g["dry_hPa"], a, b) RES[f"r1g_dry_{a}_{b}"] = t_ say(f" R1 (Gaussian) dry air {a}-{b}: {fmt(t_, 4)}") g2 = read_csv_cols(os.path.join(out, "annual_global_r1_budget.csv")) g2y = g2["year"].astype(int) t_ = window(g2y, g2["dry_hPa"], 1979, 2025) RES["r1_dry_1979_2025"] = t_ say(f" R1 (2.5 deg) dry air 1979-2025: {fmt(t_, 4)}") y, c = B["r1g"] n, sxx, b, a, e, sse, _ = L._fit(y, c["polar"]) RES["r1g_polar_detrended_sd"] = {"ddof0": float(np.std(e)), "ddof2": float(math.sqrt(sse / (n - 2))), "fall_1948_2025": float(-b * (2025 - 1948))} say(f" R1 polar 1948-2025: fall {-b * 77:.2f} hPa over 77 years; detrended SD {np.std(e):.2f} (ddof 0), " f"{math.sqrt(sse / (n - 2)):.2f} (n-2)") y, c = B["c20v3"] ta, tn, tp = L.trend(y, c["arctic"]), L.trend(y, c["antarctic"]), L.trend(y, c["polar"]) RES["c20v3_shares"] = {"arctic": ta, "antarctic": tn, "polar": tp, "arctic_share": ta["slope"] / 2 / tp["slope"]} say(f" 20CRv3 1806-2015: Arctic {fmt(ta, 4)}, Antarctic {fmt(tn, 4)}, polar {fmt(tp, 4)}; " f"Arctic share of the polar fall {ta['slope'] / 2 / tp['slope']:.0%}") with open(os.path.join(out, "fixround_checks.json"), "w", newline="\n") as fh: json.dump(RES, fh, indent=1, default=float) with open(os.path.join(out, "fixround_checks.txt"), "w", newline="\n") as fh: fh.write("\n".join(LINES) + "\n")