How to use the sgp4.cpropagation.sgp4init 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 / satfit.py View on Github external
# SGP4 mode variables
    satrec.operationmode  = False
    satrec.error          = 0

    if (gravconst == "wgs72old"):
        whichconst = earth_gravity.wgs72old
    elif (gravconst == "wgs84"):
        whichconst = earth_gravity.wgs84
    else:
        # Most popular const used by TLEs
        whichconst = earth_gravity.wgs72
    satrec.whichconst     = whichconst  # Python extension: remembers its consts

    # FIXME: Can use jdSGP4epoch here directly with no subctraction, but need to trace all uses  (like the datetime comment above)
    rtn_code = sgp4init(satrec.whichconst, satrec.operationmode, satrec.satnum, 
             satrec.jdsatepoch-2433281.5, # epoch time in days from jan 0, 1950. 0 hr
             satrec.bstar, satrec.ndot, satrec.nddot, satrec.ecco, satrec.argpo, 
             satrec.inclo, satrec.mo, satrec.no_kozai, satrec.nodeo, satrec)
    if (rtn_code is not True):
        if (satrec.error == 1):
            log.error("sgp4init error {}".format(satrec.error))
            log.error("mean elements, ecc >= 1.0 or ecc < -0.001 or a < 0.95 er")
            return False
        elif (satrec.error == 2):
            log.error("sgp4init error {}".format(satrec.error))
            log.error("mean motion less than 0.0")
            return False
        elif (satrec.error == 3):
            log.error("sgp4init error {}".format(satrec.error))
            log.error("pert elements, ecc < 0.0  or  ecc > 1.0")
            return False
github consensys-space / trusat-orbit / satfit_performance.py View on Github external
satrec.parent_tle_id = 0 # int(TLE.tle_id)

    # SGP4 mode variables
    satrec.operationmode  = u'i' # Unicode for cython
    satrec.error          = 0

    if (gravconst == "wgs72old"):
        whichconst = earth_gravity.wgs72old
    elif (gravconst == "wgs84"):
        whichconst = earth_gravity.wgs84
    else:
        # Most popular const used by TLEs
        whichconst = earth_gravity.wgs72
    # satrec.whichconst     = whichconst  # Python extension: remembers its consts
    # satrec.whichconst = gravconst
    rtn_code = sgp4init("wgs72", satrec.operationmode, satrec.satnum, 
             satrec.jdSGP4epoch, # epoch time in days from jan 0, 1950. 0 hr
             satrec.bstar, satrec.ndot, satrec.nddot, satrec.ecco, satrec.argpo, 
             satrec.inclo, satrec.mo, satrec.no_kozai, satrec.nodeo, satrec)
    if (rtn_code is not True):
        if (satrec.error == 1):
            log.error("sgp4init error {}".format(satrec.error))
            log.error("mean elements, ecc >= 1.0 or ecc < -0.001 or a < 0.95 er")
            return False
        elif (satrec.error == 2):
            log.error("sgp4init error {}".format(satrec.error))
            log.error("mean motion less than 0.0")
            return False
        elif (satrec.error == 3):
            log.error("sgp4init error {}".format(satrec.error))
            log.error("pert elements, ecc < 0.0  or  ecc > 1.0")
            return False
github consensys-space / trusat-orbit / satfit.py View on Github external
if (xmo):
        sat.mo = posradang(xmo)
    elif (ma):
        sat.mo = posradang(de2ra*ma)

    if (xno):
        sat.no_kozai = xno
    elif (nn):
        sat.no_kozai = nn * nocon

    if (bsr):
        sat.bstar = bsr
    elif (bstar):
        sat.bstar = bsr
    sgp4init(sat.whichconst, sat.operationmode, sat.satnum, sat.jdsatepoch, sat.bstar, 0, 0, sat.ecco, sat.argpo, sat.inclo, sat.mo, sat.no_kozai, sat.nodeo, sat)
    return sat