INNER CODE UNIT · Python

_detect_temperature_kind

QianyeSu/Skyborn · src/skyborn/calc/GPI/core.py:70

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]
    except KeyError as exc:
        raise ValueError(
            f"Unsupported temperature dimensions: {temp_ndim}. Expected 1, 3, or 4 dimensions."
        ) from exc


def _normalize_outflow_source(outflow_source: str) -> int:
    """Map the public outflow-source string to the Fortran flag."""
    try:
        return _OUTFLOW_SOURCE_FLAGS[outflow_source]
    except KeyError as exc:
        raise ValueError(
            f"Invalid outflow_source={outflow_source!r}; expected 'cape_star' or 'cape_env'."

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…