How to use the sgp4.ext.rv2coe function in sgp4

To help you get started, we’ve selected a few sgp4 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github consensys-space / trusat-orbit / tests / test_tle_util.py View on Github external
satA = copy.deepcopy(sat0)    
    satA = satfit.delta_el(satA,xincl=satA.im,xnodeo=satA.Om,ec=satA.em,omegao=satA.om,xmo=satA.mm,xno=satA.no_kozai,bsr=sat1.bstar, jdsatepoch=sat0.jdsatepoch)
    satA = satfit.delta_t(satA,sat0.jdsatepoch)

    # satB : Elements created from sat1 mean elements after propagating to TLE0 epoch
    satB = copy.deepcopy(sat1)    
    satB = satfit.delta_el(satB,xincl=satB.im,xnodeo=satB.Om,ec=satB.em,omegao=satB.om,xmo=satB.mm,xno=satB.no_kozai,bsr=sat1.bstar, jdsatepoch=sat0.jdsatepoch)
    # satB.jdsatepoch = sat0.jdsatepoch 
    # satB.jdSGP4epoch = satB.jdsatepoch - 2433281.5
    # satB.epoch_datetime = satfit.jday_to_datetime(satB.jdsatepoch)
    satB = satfit.delta_t(satB,sat0.jdsatepoch)


    # satr : Elements created from rv2coe from sat1x r,v vectors TLE0 epoch
    satr = copy.deepcopy(sat1)    
    (p, a, ecc, incl, omega, argp, nu, m, arglat, truelon, lonper) = rv2coe(satr.rr_km, satr.vv_kmpersec, satr.whichconst.mu)
    # satx = satfit.delta_el(sat1,xincl=sat1.inclo,xnodeo=sat1.nodeo,ec=sat1.ecco,omegao=sat1.argpo,xmo=sat1.mo,xno=sat1.no_kozai,bsr=sat1.bstar)
    mean_motion = sqrt(satr.whichconst.mu/(pow(a,3)))*60.0 # radians per minute
    satr = satfit.delta_el(satr,xincl=incl,xnodeo=omega,ec=ecc,omegao=argp,xmo=m,xno=mean_motion,bsr=satr.bstar, jdsatepoch=sat0.jdsatepoch)
    # satr.jdsatepoch = sat0.jdsatepoch 
    # satr.jdSGP4epoch = satr.jdsatepoch - 2433281.5
    # satr.epoch_datetime = satfit.jday_to_datetime(satr.jdsatepoch)
    satr = satfit.delta_t(satr,sat0.jdsatepoch)


    print()
    print("sat1: Original elements back-propagated to perigee (epoch of sat0)")
    print("sat2 : Elements regressed to perigee by satfit.py TLE0 epoch")
    print("sat0 : Elements regressed to perigee by satfit.cpp TLE0 epoch")
    print("satA : Elements created from sat0 mean elements after propagating to TLE0 epoch")
    print("satB : Elements created from sat1 mean elements after propagating to TLE0 epoch")
    print("satr : Elements created from rv2coe from sat1x r,v vectors TLE0 epoch")
github brandon-rhodes / python-sgp4 / sgp4 / tests.py View on Github external
def format_long_line(satrec, tsince, mu, r, v):
    """Long line, using the same format string that testcpp.cpp uses."""

    short = format_short_line(tsince, r, v).strip('\n')

    jd = satrec.jdsatepoch + satrec.jdsatepochF + tsince / 1440.0
    year, mon, day, hr, minute, sec = invjday(jd)

    (p, a, ecc, incl, node, argp, nu, m, arglat, truelon, lonper
     ) = rv2coe(r, v, mu)

    return short + (
        ' %14.6f %8.6f %10.5f %10.5f %10.5f %10.5f %10.5f'
        ' %5i%3i%3i %2i:%2i:%9.6f\n'
    ) % (
        a, ecc, incl*rad, node*rad, argp*rad, nu*rad,
        m*rad, year, mon, day, hr, minute, sec,
    )