satellogic / orbit-predictor

Python library to propagate satellite orbits.
MIT License
140 stars 43 forks source link

J2 predictor yields passes that don't match the specified LTAN #119

Open fisadev opened 3 years ago

fisadev commented 3 years ago

If I create a J2 predictor with LTAN 22:30 (so LTDN 10:30), and then request passes over the target at lat:0 lon:0, with off nadir close to 0 degrees (max elevation greater than 89.5), I would expect to see passes with TCA at 22:30 or 10:30. But I get passes at 22:40 and 10:40 instead:

from datetime import datetime, timedelta

from orbit_predictor.predictors.numerical import J2Predictor
from orbit_predictor.locations import Location
from orbit_predictor.predictors.pass_iterators import SmartLocationPredictor

start = datetime.now()

# LTDN = 10:30, we add 12 hours to compute from LTAN
pred = J2Predictor.sun_synchronous(
    alt_km=470,
    ecc=0.001,
    ltan_h=10.5 + 12,
    ta_deg=0,
    date=start,
)

target = Location("center", 0, 0, 0)

passes = list(pred.passes_over(
    target, 
    start,
    aos_at_dg=45,
    max_elevation_gt=89.5,
    limit_date=start + timedelta(days=365),
    location_predictor_class=SmartLocationPredictor, 
    tolerance_s=1e-3,
))

print("TCA | days after start | off nadir")
for pass_ in passes:
    print(
        pass_.max_elevation_date, 
        (pass_.max_elevation_date - start).days,
        pass_.off_nadir_deg, 
        sep=' | ',
    )

outputs:

TCA | days after start | off nadir
2021-02-11 22:40:54.811966 | 23 | 0.09343809745045528
2021-09-10 10:40:51.711328 | 233 | -0.26910660672500436
2021-11-22 22:41:00.570154 | 307 | -0.23366980504172796

Maybe I'm doing something wrong, or it's something related to the geometry of coordinates and the orbit, that I ignore.