INNER CODE UNIT · Python
_postprocess_results
QianyeSu/Skyborn · src/skyborn/calc/GPI/core.py:57
def _postprocess_results(min_pressure, max_wind):
"""Convert UNDEF values to NaN in results."""
min_pressure = np.where(np.isclose(min_pressure, UNDEF), np.nan, min_pressure)
max_wind = np.where(np.isclose(max_wind, UNDEF), np.nan, max_wind)
return min_pressure, max_wind
def _postprocess_scalar(value: Union[float, np.floating]) -> float:
"""Convert scalar UNDEF output to NaN."""
value = float(value)
return np.nan if np.isclose(value, UNDEF) else value
def _detect_temperature_kind(temperature: Any) -> str:
"""Map thermodynamic input dimensionality to the supported API kind."""
temp_ndim = np.ndim(temperature)
try:
return _TEMPERATURE_KIND_BY_NDIM[temp_ndim]