# ILAMB hydrology and snow comparison

This directory preserves the reproducible workflow for comparing these two
ELM simulations on Pathfinder:

- `20260625.ERA5r025_r05_IcoswISC30E3r5.pm-cpu.20TR` (`ELM_Control`)
- `20260915.ERA5r025_r05_IcoswISC30E3r5.pm-cpu.20TR.shallowSnow`
  (`ELM_ShallowSnow`)

The model study window is 1980--2022 inclusive. Each ILAMB confrontation uses
the portion of its reference product that overlaps that window. Snow water
equivalent receives the largest score weight and is evaluated against CanSISE
(1981--2010) and CARDAMOM (2001--2021). The study also includes active-layer
thickness, permafrost, evapotranspiration, runoff, terrestrial-water-storage
anomaly, surface soil moisture, and precipitation.

In addition to the global-land analysis, the workflow reports results for
seven standardized IPCC AR6 northern reference regions: Northwest North
America (`nwn`/NWN), Northeast Canada (`nec`/NEC), Northern Europe (`neu`/NEU),
Western Siberia (`wsb`/WSB), Eastern Siberia (`esb`/ESB), Russian Far East
(`rfe`/RFE), and Russian Arctic (`rar`/RAR). ILAMB registers region keys in
lowercase; the uppercase forms are the published IPCC abbreviations. The masks
come from ILAMB's `IPCCRegions.nc` dataset.

`runtime_patch/sitecustomize.py` provides a narrowly scoped workaround for the
Cartopy 0.25.0/Matplotlib 3.11.1 global Robinson-map failure on Pathfinder. It
falls back to `set_global()` only for a global Robinson extent. The workflow
also uses the ILAMB-2-compatible `CALM.nc` active-layer product, whose site
dimension is named `data`.

On Pathfinder, reproduce and submit with:

```bash
source /projects/hpcl-cli185/proj-shared/zdr/load_ilamb_pf_sysmpi.sh
python /projects/hpcl-cli185/proj-shared/zdr/ilamb_runs/hydrology_snow_1980_2022/run_workflow.py --submit
```

The setup script validates every expected monthly model file, required ELM
variables, the two grids, and all selected ILAMB reference files before it
writes or submits anything. Generated inputs and provenance are stored beside
the scripts. Results are written under `build/`, and SLURM output goes under
`logs/`.

To inspect inputs again or summarize current results:

```bash
python inspect_ilamb_inputs.py --ilamb-root /projects/hpcl-cli185/proj-shared/zdr/ILAMB_DATA \
  /projects/hpcl-cli185/proj-shared/zdr/20260625.ERA5r025_r05_IcoswISC30E3r5.pm-cpu.20TR \
  /projects/hpcl-cli185/proj-shared/zdr/20260915.ERA5r025_r05_IcoswISC30E3r5.pm-cpu.20TR.shallowSnow
python summarize_results.py
```

Re-running without `--clean` preserves ILAMB caches and completed model-data
pairs. Add `--clean` when changing the region list so cached confrontation
files are regenerated with the new regional scalars and time series.
