Description
Several scalar / array inputs to reproject helpers are not finite-checked. NaN and Inf values pass through, producing silently wrong output instead of a clean error.
| Site |
Bad input |
itrf_transform(epoch=NaN/Inf) (_itrf.py:235) |
NaN -> dt = obs - epoch is NaN -> all-NaN output. Inf -> overflow garbage. |
geoid_height(lon=NaN/Inf, lat=NaN/Inf) (_vertical.py:178) |
Index math (int(col_f) with % w) wraps NaN/Inf into bogus indices, returning a plausible-looking finite N. |
ellipsoidal_to_orthometric / orthometric_to_ellipsoidal / depth_to_ellipsoidal / ellipsoidal_to_depth |
Inherit the geoid_height NaN/Inf bug. |
_detect_nodata(nodata=Inf) (_crs_utils.py:113) |
nodata=Inf accepted; np.full(..., Inf) outputs break downstream np.isnan checks. |
Expected behavior
Each scalar input is finite-checked at the API boundary. Latitude is also bounded to [-90, 90]. nodata=Inf is rejected (NaN remains the legitimate sentinel for missing data).
Proposed fix
itrf_transform: if not np.isfinite(epoch): raise ValueError(...) plus non-empty src/tgt strings.
geoid_height: enforce np.isfinite(lon).all() and np.isfinite(lat).all() plus (-90 <= lat <= 90).all(). The four conversion helpers inherit the fix.
_detect_nodata: after float(nodata) reject +/-Inf (NaN is still allowed as the canonical sentinel).
Description
Several scalar / array inputs to reproject helpers are not finite-checked. NaN and Inf values pass through, producing silently wrong output instead of a clean error.
itrf_transform(epoch=NaN/Inf)(_itrf.py:235)geoid_height(lon=NaN/Inf, lat=NaN/Inf)(_vertical.py:178)int(col_f)with% w) wraps NaN/Inf into bogus indices, returning a plausible-looking finite N.ellipsoidal_to_orthometric/orthometric_to_ellipsoidal/depth_to_ellipsoidal/ellipsoidal_to_depth_detect_nodata(nodata=Inf)(_crs_utils.py:113)nodata=Infaccepted;np.full(..., Inf)outputs break downstreamnp.isnanchecks.Expected behavior
Each scalar input is finite-checked at the API boundary. Latitude is also bounded to
[-90, 90].nodata=Infis rejected (NaN remains the legitimate sentinel for missing data).Proposed fix
itrf_transform:if not np.isfinite(epoch): raise ValueError(...)plus non-emptysrc/tgtstrings.geoid_height: enforcenp.isfinite(lon).all()andnp.isfinite(lat).all()plus(-90 <= lat <= 90).all(). The four conversion helpers inherit the fix._detect_nodata: afterfloat(nodata)reject+/-Inf(NaN is still allowed as the canonical sentinel).