Skip to content

Calculate geo coords from omm

el_paso.processing.calculate_geo_coords_from_omm

calculate_geo_coords_from_omm

Calculate GEO coordinates (x, y, z) in kilometers from an OMM orbital element set.

Parameters:

Name Type Description Default
omm_line dict[str, str]

Dictionary containing the OMM (Orbit Mean-Elements Message) orbital element data for the satellite, as consumed by skyfield.api.EarthSatellite.from_omm.

required
target_times list[datetime]

UTC datetimes at which to evaluate the satellite position.

required

Returns:

Type Description
Variable

ep.Variable: The GEO coordinate variable (x, y, z) in kilometers, evaluated at target_times.

Source code in el_paso/processing/calculate_geo_coords_from_file.py
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
def calculate_geo_coords_from_omm(
    omm_line: dict[str,str],
    target_times: list[datetime],
) -> ep.Variable:
    """Calculate GEO coordinates (x, y, z) in kilometers from an OMM orbital element set.

    Args:
        omm_line (dict[str, str]): Dictionary containing the OMM (Orbit Mean-Elements Message)
            orbital element data for the satellite, as consumed by
            `skyfield.api.EarthSatellite.from_omm`.
        target_times (list[datetime]): UTC datetimes at which to evaluate the satellite position.

    Returns:
        ep.Variable: The GEO coordinate variable (x, y, z) in kilometers, evaluated at `target_times`.
    """
    timescale = sf_api.load.timescale()
    geo_coordinates: list[NDArray[np.float64]] = []

    satellite = sf_api.EarthSatellite.from_omm(timescale, omm_line)

    for t in target_times:
        geocentric = satellite.at(timescale.from_datetime(t))
        geo_coordinates.append(geocentric.itrf_xyz().km)

    result = np.asarray(geo_coordinates, dtype=np.float64)

    if np.isnan(result).any():
        nan_indices = np.where(np.isnan(result).any(axis=1))[0]
        logger.warning(
            f"NaN values found in GEO coordinates at indices: {', '.join(str(i) for i in nan_indices)}. "
            "Check the CSV file at these indices."
        )

    xgeo_var = ep.Variable(data=result, original_unit=u.km)
    xgeo_var.metadata.add_processing_note("Created from OMM CSV file.")

    return xgeo_var