Repository navigation
0.5.1 — Align build_sites output with data_processing survivors
[0.5.1] - 2026-07-22
Fixed
-
build_sitesCMEMS mask now aligns with the run-time CW inlet
depth, not the hardcoded 1062 m default. In 0.5.0 the mask was
always sampled at1062.44 m— correct for a default single-depth
run, but silently misaligned when a user changed
SeawaterPipes.cw_inlet_lengthfrom the default. Sites valid at
the actual queried depth could be dropped (or, less commonly,
unusable sites survive) if that depth differed from 1062 m.
regional.run_regional_analysisnow forwards
cmems_verify_depth=float(inputs['length_CW_inlet'])to
load_sites/build_sites, so the mask is sampled on the same
CMEMS depth level the downstreamdownload_datawill query. -
filter_sites_by_cmems_masknow snaps candidate coordinates to
the nearest CMEMS grid centre. End-to-end validation of the 0.5.0
fix revealed that only ~11 % of mask-verified candidates were
reachingTime_series_data_*.h5(Bahamas: 2618 verified sites,
but only 290 surviveddata_processing). Root cause: OTEX's
_make_gridplaces candidates on multiples of1/12°measured
from the region bbox origin, but the CMEMS native grid has a global
half-cell offset (~9 km at the equator), so the exact(lon, lat)
lookup incmems._extract_year_datamissed almost every
candidate.filter_sites_by_cmems_masknow replaces each surviving
site's coordinates with the actual CMEMS cell centre (rounded to 3
decimals to match the downstream lookup rounding) and deduplicates
when multiple GEBCO candidates snap to the same cell. -
cmems._extract_year_datanow rounds coordinates at float64
precision instead of float32. Pre-existing bug uncovered by the
same E2E validation: the CMEMS netCDF storeslongitudeand
latitudeas float32, andnp.round(<float32>, 3)returned the
nearest float32 to X.XXX — which for values like23.833is
23.83300018310547because 23.833 has no exact float32
representation. Thesites_dictlookup key downstream promotes
that value to float64 preserving the ~1e-7 offset, while the
site-side keys — built from float64 coordinates — round cleanly to
23.833, so the two never matched. Coordinates are now upcast to
float64 before rounding so both sides align.
Together these three fixes make build_sites output the exact set
of sites data_processing will populate: no silent NaN-drop
downstream. End-to-end regression on Bahamas at defaults: 2618
mask-verified sites in → 2618 sites out (was 290 in 0.5.0).
Added
build_sitesdocstring now documents the interaction with the
formal per-site optimiser (optimizationpackage), which sweeps
depth_CWinsideDepthLimits(default 600-3000 m): optimiser
callers should either passcmems_verify_depthset to the deepest
depth the search will visit or disable the pre-filter with
cmems_verify=Falseand let the on-the-fly NaN mask handle
candidate depths individually.