Skip to content

Coordtrans

OTSO.coordtrans

coordtrans(Locations: Sequence[float], dates: Sequence, CoordIN: str = 'GEO', CoordOUT: str = 'GDZ', corenum: Optional[int] = None, Verbose: bool = True, *args, **kwargs)

Transform coordinates between different coordinate systems using OTSO.

Converts spatial coordinates between various reference frames used in space physics and geomagnetics. Supports time-dependent transformations for date-specific coordinate system orientations.

Parameters:

  • Locations (list) –

    Input coordinates as [[coord1, coord2, coord3]].

  • dates (list) –

    Date/time stamps for coordinate transformations.

  • CoordIN (str, default: 'GEO' ) –

    Input coordinate system. Options: "GEO", "GSM", "GSE", "SM", "GEI", "MAG", "SPH", "RLL", "GDZ"

  • CoordOUT (str, default: 'GDZ' ) –

    Output coordinate system. Options: "GEO", "GSM", "GSE", "SM", "GEI", "MAG", "SPH", "RLL", "GDZ"

  • corenum (int, default: None ) –

    Number of CPU cores for parallel processing.

  • Verbose (bool, default: True ) –

    Enable verbose output.

Returns:

  • list

    [coords_dataframe, summary_text] - coords_dataframe: Transformed coordinates - summary_text: Transformation summary

Examples:

    import datetime
    import OTSO

    # GEO to GSM transformation
    coord_result = OTSO.coordtrans([[10, 10, 10]], 
                                  [datetime.datetime(2023, 6, 1)],
                                  CoordIN="GEO", CoordOUT="GSM")

    # Multiple locations and times
    locs = [[1, 0, 0], [0, 1, 0]]
    times = [datetime.datetime(2023, 6, 1, h) for h in [10, 14]]
    multi_coord = OTSO.coordtrans(locs, times, "GEO", "GSM", corenum=2)

    # Access the results
    coord_df, metadata = coord_result