# HyperRrs real-matchup benchmark: frozen files This folder holds the frozen test sets, training sets, validation splits, native-grid block caches and sensor band operators of the HyperRrs per-pixel spectral reconstruction benchmark. Every array was copied from the benchmark's own loaders and checked bitwise against them (`checks.json`). You can train and score every method from these files alone. You do not need the PACE store and you do not need to redraw any random numbers. ## Task A **cell** is one 1 km cell observed by a multispectral ocean-colour sensor and by PACE OCI: a global 1 km equal-area bin in which the sensor and PACE observations are at most 3 h apart. The input `X` is the sensor's Level-2 remote-sensing reflectance Rrs (sr⁻¹) in its K bands. The target `Y` is the PACE OCI Level-2 AOP V3.2 Rrs on the 172-band OCI grid (346–719 nm, `wavelength_nm`). NaN marks an invalid target band. A method predicts the 172-band spectrum from `X`. The benchmark metric is the spectral angle (SAM, degrees) over the finite target bands, averaged over cells, with 95 % intervals from resampling scenes. | sensor key | sensor | K | input bands | |---|---|---|---| | `MODISA` | MODIS-Aqua (L2 OC R2022.0) | 10 | Rrs_412 … Rrs_678 | | `VIIRSN` | VIIRS Suomi NPP (L2 OC R2022.0) | 5 | Rrs_410 … Rrs_671 | | `VIIRSJ1` | VIIRS NOAA-20 (L2 OC R2022.0) | 5 | Rrs_411 … Rrs_667 | ## Counts | sensor | test cells | test scenes | training rows | training scenes | validation rows | validation scenes | |---|---|---|---|---|---|---| | MODISA | 770,275 | 1,621 | 1,215,861 | 1,327 | 180,426 | 199 | | VIIRSN | 925,086 | 1,864 | 1,545,369 | 1,569 | 234,002 | 235 | | VIIRSJ1 | 946,266 | 1,908 | 1,582,363 | 1,607 | 237,391 | 241 | The validation rows are a subset of the training rows. `checks.json` lists every file's array shapes and sha256. ## Splits and leakage controls - **MODIS-A / VIIRS.** Each scene is one PACE granule paired with the sensor's granules. A scene's PACE week is `(date - 2024-01-01).days // 7`. Test scenes are in odd weeks and training scenes in even weeks. A test scene contributes at most 500 complete cells, drawn with one `numpy.random.default_rng(0)` that runs over all pair files in sorted order. The draw is already applied here. - **Validation split (all sensors).** Training scenes are first merged into split groups. Two scenes join one group when they share a bitwise-identical (X, Y) row. Then 15 % of the groups (`default_rng(0)` permutation, `round(0.15 × n_groups)` groups) form the validation set. `is_val` stores the result. `split_group` is stored so you can redraw the split identically. The protocol tunes on train \ val, then refits the chosen configuration on all training rows. ## Files All `.npz` files are written with `numpy.savez_compressed` and contain no pickled objects (`np.load(path)` works with the default `allow_pickle=False`). Every per-cell array has one row per cell. `scene` indexes the `scene_*` arrays. ### `test/.npz`: per-pixel test sets Rows are in the benchmark's test order, and stored predictions index the cells in this order. | key | dtype, shape | meaning | |---|---|---| | `X` | float32 (n, K) | sensor Rrs input | | `Y` | float32 (n, 172) | PACE V3.2 Rrs target; always complete (all 172 bands valid) | | `scene` | int32 (n,) | scene index | | `lat`, `lon` | float32 (n,) | cell centre (degrees) | | `band_centres_nm` | float64 (K,) | the band centres passed to every method | | `input_bands` | str (K,) | band names, column order of `X` | | `wavelength_nm` | float32 (172,) | PACE OCI band centres | | `scene_name` | str (S,) | pair-file stem `_` | | `scene_week` | int32 (S,) | PACE week | The test files also have the following keys: | key | dtype, shape | meaning | |---|---|---| | `row` | int32 (n,) | row of the cell in its scene's pair file (aligned-matchup release) | | `dt_s` | float32 (n,) | sensor minus PACE observation time (s) | | `bin_id` | int64 (n,) | global 1 km equal-area bin id | | `scene_pair_file` | str (S,) | pair-file name | | `scene_pace_granule_time` | str (S,) | PACE granule start time, UTC (`YYYYMMDDTHHMMSS`) | ### `train/.npz`: training sets | key | dtype, shape | meaning | |---|---|---| | `X`, `Y` | float32 | input and complete 172-band V3.2 target (every training row has all 172 bands valid) | | `scene` | int32 (n,) | scene index into `scene_name` | | `split_group` | int64 (n,) | split group after duplicate-row merging | | `is_val` | bool (n,) | validation row | | `n_dup_rows` | int64 () | rows whose (X, Y) occurs more than once | | `scene_name` | str (S,) | as in the test files | | `wavelength_nm` | float32 (172,) | PACE OCI band centres | ### `blocks/_{test,train}.npz`: native-grid 4 × 4 blocks (spatial analysis) Each block is 4 × 4 adjacent PACE pixels on the native V3.2 swath grid, and the cache keeps a block only when all 16 of its cells are usable. Each block occupies 16 contiguous rows (row-major). Blocks come from odd-week (test) or even-week (train) scenes, with at most 50 blocks per scene drawn with `default_rng(0)`. The arrays are the block caches' arrays, unchanged: | key | meaning | |---|---| | `X`, `Y32` | input and V3.2 target | | `row`, `col` | the cell's PACE pixel (granule line, pixel) | | `lat`, `lon` | cell position | | `scene` | scene index | | `block` | block index | | other keys | as described in `_.README.json` (`fields`) | The release adds the following keys: | key | file | meaning | |---|---|---| | `scene_name` | all | per scene index | | `band_centres_nm` | test | band centres | | `split_group`, `is_val`, `n_dup_rows` | train | the validation split, as for the per-pixel training sets | `__scenes.csv` gives per-scene draw statistics. ### `srf/.npz`: band operators (simulated-input control) | key | meaning | |---|---| | `W` | float64 (K, 172) band operator on the PACE grid; each row sums to 1 | | `bands` | band names | | `centroid_nm` | `W @ wavelength_nm` | The simulated sensor input of a PACE spectrum `Y` is `X_sim = (Y in float64) @ W.T`, cast to float32. Band k is NaN where `Y` is non-finite at any band with `W[k, b] != 0`. `SOURCES.json` cites the agency spectral responses that `W` was integrated from. Rows computed this way are **simulated** inputs. The benchmark uses them only as a labelled control, and they are never test inputs. ## Reading the files ```python import numpy as np z = np.load('test/MODISA.npz') X, Y, G, centres = z['X'], z['Y'], z['scene'], z['band_centres_nm'] t = np.load('train/MODISA.npz') fit_rows, val_rows = ~t['is_val'], t['is_val'] ``` ## Verification Each frozen array was compared bitwise (same dtype, shape and bytes) with a fresh run of the benchmark loaders on the original sources: the test-set builder, the training split, the block-cache readers and the simulated-input operator. `checks.json` records the result of each comparison together with the counts and sha256 of every file. ## Attribution - PACE OCI Level-2 AOP V3.2, MODIS-Aqua and VIIRS Level-2 OC R2022.0: NASA Ocean Biology Distributed Active Archive Center (OB.DAAC). - Sensor spectral responses: see `srf/SOURCES.json`.