#!/bin/sh
# Download every IRI objective-probability chart (figure3) and plume chart (figure4) as SVG, 2002-2026.
# URL month is 0-based: /2018/5 = Mid-Jun 2018. Saved as raw/f3|f4/YYYY-MM.svg (1-based month). ~25 MB each set.
# Months not yet issued return the latest issue (dropped later by title); a few requests return HTTP 500 (retry).
cd "${ROOT:-/work/enso-objective}"; mkdir -p raw/f3 raw/f4
for y in $(seq 2002 2026); do for m in $(seq 0 11); do echo "$y $m"; done; done |
  xargs -P8 -n2 sh -c 'for f in 3 4; do o=raw/f$f/$0-$(printf %02d $(($1+1))).svg; [ -s $o ] && head -c 5 $o | grep -q "<?xml" || curl -sL -m 60 -o $o "https://ensoforecast.iri.columbia.edu/figure${f}_plot/$0/$1"; done'
# RONI (for the index sensitivity): https://www.cpc.ncep.noaa.gov/data/indices/RONI.ascii.txt -> raw/roni/
