hipscatalog_gen.utils._validate_and_normalize_radec

_validate_and_normalize_radec(ddf_like, ra_col, dec_col, log_fn)[source]

Validate RA/DEC ranges and normalize RA into [0, 360] if needed.

Supports both plain Dask DataFrames and LSDB catalogs.

Rules:
  • DEC must be within [-90, +90] degrees (up to a small epsilon).

  • RA must be either:
    • [0, 360] degrees → kept as is, or

    • [-180, 180] degrees → shifted to [0, 360] via (RA + 360) % 360.

  • Any other range raises ValueError.

Parameters:
  • ddf_like (Any) – Dask-like collection or LSDB catalog.

  • ra_col (str) – RA column name.

  • dec_col (str) – DEC column name.

  • log_fn (Callable[[str, bool], None]) – Logger callable receiving (message, always_flag).

Returns:

The same collection, possibly with RA normalized.

Raises:

ValueError – If RA/DEC ranges are unsupported or non-finite.

Return type:

Any