question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Strange error during propagation using sgp4_array

See original GitHub issue

Hi Brandon First of all, great library!

I have the following problem (in versions 2.12 and 2.16) and I don’t seem to be able to find a solution for it: sgp4_array throws some NaNs at time 2459026.2 whereas sgp4 does not.

Here is a working example that I found.

from sgp4.api import Satrec, jday
import numpy as np

tle = (
    "1 44160U 19006AX  20162.79712247 +.00816806 +19088-3 +34711-2 0  9997",
    "2 44160 095.2472 272.0808 0216413 032.6694 328.7739 15.58006382062511"
)

s = Satrec.twoline2rv(*tle)

jd0, jd1 = jday(2020, 6, 10, 19, 7, 51.381408)

Here is the part for sgp4, which works as expected if you run it:

for i in range(0, 50):
    r = s.sgp4(jd0+i, jd1)
    print(i, r[0], np.linalg.norm(r[1]), r[1])

And here using sgp4_array:

jd0_ = jd0 + np.arange(0, 50, dtype="f")
jd1_ = np.ones_like(jd0_) * jd1
res = s.sgp4_array(jd0_, jd1_)
ier = res[0]
r = res[1]
v = res[2]
for i in range(len(ier)):
    print(i, jd0_[i] + jd1_[i], ier[i], r[i], v[i])

which yields:

0 2459011.2 0 [ 2.41464418e+02 -6.64590746e+03 -9.37349881e-04] [-0.71720095  0.07212463  7.78138163]
1 2459012.2 0 [   15.03351833  6027.73284644 -3390.25230116] [ 0.77844336 -3.6607103  -6.50959084]
2 2459013.2 0 [ -377.07198181 -2826.33161405  6005.14918003] [-0.74454705  7.00476588  3.35620303]
3 2459014.2 0 [  713.26199209 -1398.96601871 -6596.62261048] [ 0.39554425 -7.42643673  1.77509584]
4 2459015.2 0 [-812.07032448 6133.95588683 2928.11093856] [ 0.32314368  3.39799364 -6.76611198]
5 2459016.2 0 [  283.86827906 -5757.08079769  3252.33603352] [-1.00843474  3.75610953  6.79958794]
6 2459017.2 0 [  636.67442201  -125.60519267 -6726.66503702] [ 0.83879049 -7.60551209  0.36376957]
7 2459018.2 0 [-974.5974261  6641.97494784 1343.34308475] [ 0.47602838  1.6133775  -7.37717825]
8 2459019.2 0 [ -327.85325328 -1881.15256086  6397.04807578] [-1.2398994   7.31677442  2.21843553]
9 2459020.2 0 [ 1114.44467976 -6353.52536393 -1407.6566936 ] [-0.43957567 -1.73643171  7.62815489]
10 2459021.2 0 [  688.99011615  -418.90939529 -6636.08980865] [ 1.21001573 -7.5926442   0.73137065]
11 2459022.2 0 [ -594.46126229  5363.24756229 -4083.1575965 ] [ 1.38096894 -4.51862535 -5.99049808]
12 2459023.2 0 [-1342.69683985  6628.66687018   486.75886791] [ 0.57768626  0.66032168 -7.55960087]
13 2459024.2 0 [-1505.65682385  5722.9420058   3265.55435086] [-0.16961905  3.77357815 -6.62302689]
14 2459025.2 0 [-1544.65886896  5264.33269643  3911.40748805] [-0.42613438  4.49864644 -6.15839203]
15 2459026.2 0 [nan nan nan] [nan nan nan]
16 2459027.2 0 [nan nan nan] [nan nan nan]
17 2459028.2 0 [           nan  1629.73053961 -6359.26714453] [        nan -7.30785055 -1.71837043]
18 2459029.2 0 [ 1830.86002598 -6116.31950075 -1211.36493712] [-0.27242591 -1.6447351   7.69790257]
19 2459030.2 0 [-1217.10693282  2134.17843527  6130.69042289] [-1.80142179  6.99452779 -2.73978104]
20 2459031.2 0 [  415.81175295   653.71934763 -6426.14143211] [ 2.36881928 -7.47994795 -0.53940074]
21 2459032.2 0 [-933.97608025  972.58220555 6397.59652987] [-2.23826422  7.30730719 -1.39034781]
22 2459033.2 0 [ 2100.3959201  -5417.40160538 -2678.09076348] [ 0.46061982 -3.39534964  7.14922145]
23 2459034.2 0 [  -73.40993402  1881.99639952 -6096.93392467] [ 2.73384426 -7.10778407 -2.16512776]
24 2459035.2 6 [-1260.63037181  4538.03783856 -4287.29405378] [ 2.37166984 -4.88132249 -5.76033957]
25 2459036.2 6 [ -449.3236561   2622.83077916 -5715.49135764] [ 2.89530936 -6.6768767  -3.232872  ]
26 2459037.2 6 [ 2259.53093091 -4812.09284893 -3289.99918448] [ 1.0144526  -4.18615237  6.75142538]
27 2459038.2 6 [-1423.49775387  2031.02535631  5770.20555676] [-2.56387682  6.8606897  -3.04606812]
28 2459039.2 6 [ 2344.47321672 -4638.22520069 -3302.79592151] [ 1.17409842 -4.25893347  6.74553816]
29 2459040.2 6 [ -119.61572571  1582.19771137 -5885.02581612] [ 3.39151538 -7.09062735 -1.95217819]
30 2459041.2 6 [  331.71510733   591.80969861 -5995.17916219] [ 3.48217555 -7.3377898  -0.52306885]
31 2459042.2 6 [ 2566.91618932 -5402.9400998    488.12194128] [-0.9425547   0.2425601   8.09309346]
32 2459043.2 6 [-2419.07007367  5155.33312615 -1621.47614793] [ 1.6713446  -1.72512795 -7.8527453 ]
33 2459044.2 6 [-2102.27613075  3157.38677818  4472.16623278] [-2.46876391  5.8075733  -5.28247854]
34 2459045.2 6 [-2764.7477027   5017.49192579   676.2090556 ] [ 0.21310201  1.1986892  -8.22718653]
35 2459046.2 6 [ 2684.85009962 -4375.26876465 -2435.73400242] [ 1.15837161 -3.50793088  7.51834434]
36 2459047.2 6 [   -8.41152467  1027.48213038 -5481.28392598] [ 4.25781663 -7.17334209 -1.35522187]
37 2459048.2 6 [ 2472.64414183 -3566.8460297  -3365.71481695] [ 2.15239042 -4.83436008  6.67257159]
38 2459049.2 6 [-2832.04167605  4417.15356683  1212.18217604] [-0.35928872  2.05602928 -8.3523955 ]
39 2459050.2 6 [-2830.8138051   4266.09738206  1272.76281745] [-0.4729579   2.19371765 -8.40371125]
40 2459051.2 6 [ 2621.09805586 -3579.18983068 -2650.23358753] [ 1.89396784 -4.16807436  7.48959022]
41 2459052.2 6 [ 1986.80969801 -2294.17509988 -4030.39849466] [ 3.56962523 -6.1838674   5.27220465]
42 2459053.2 6 [-1312.61798841  1155.72800504  4582.79954527] [-4.57779313  7.11187117 -3.09588977]
43 2459054.2 6 [-1338.0608939   1174.44953571  4426.28061058] [-4.69842052  7.10502408 -3.29357285]
44 2459055.2 6 [ 2373.44146937 -2783.62864033 -2862.29783253] [ 2.85649023 -5.00594776  7.24109556]
45 2459056.2 1 [0.00000000e+000 6.90385107e-310 3.95252517e-321] [0.00000000e+000 2.08928597e-076 1.69759663e-313]
46 2459057.2 1 [9.88131292e-324 9.88131292e-324 6.57818695e-313] [1.90979621e-313 1.21223444e-099 6.95333864e-310]
47 2459058.2 1 [4.94065646e-324 6.95333864e-310 6.90370111e-310] [8.09244594e-153 1.17847856e-047 8.98330940e-096]
48 2459059.2 1 [6.90385569e-310 9.88131292e-324 5.41495948e-321] [6.95333864e-310 6.95333864e-310 7.10600469e-038]
49 2459060.2 1 [1.48219694e-323 6.36598737e-314 6.95314361e-310] [8.48798317e-314 2.12199579e-313 3.32903893e-090]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
daluarcommented, Feb 18, 2021

Wow! This was quick Thank you 😉

0reactions
brandon-rhodescommented, Feb 17, 2021

First of all, great library!

Oh, and: thanks for the kinds words! I’m glad you’re enjoying it.

I have just started the release of 2.17 that makes this fix available. Hopefully the build will complete within the next half-hour or so, making the fix available for all users.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Site not found - DreamHost Knowledge Base
Once the DNS propagates, the 'Site Not Found' error message should no longer appear. Using Passenger WSGI enabled. This problem, or one like...
Read more >
Fix email delivery issues for error code 550 5.4.1 in Exchange ...
Learn how to fix email issues for error code 5.4.1 in Exchange Online ... take up to 72 hours for DNS changes to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found