NASA-Planetary-Science / sbpy

A Python package for small bodies research
https://sbpy.org/
Other
66 stars 34 forks source link

New ephemeris generation via command-line script #396

Open mkelley opened 2 weeks ago

mkelley commented 2 weeks ago

A "simple" program to show the ephemeris of an object, with options for Horizons, Minor Planet Center, and Miriade. sbpy installation now installs a script named sbpy-ephem.

Some examples:

MPC

$ sbpy-ephem mpc 2P
# requested target: 2P
# returned target: 2P
# location: 500
          date               RA         Dec       rh  delta phase solarelong  V   Proper motion Direction
                            deg         deg       AU    AU   deg     deg     mag    arcsec / h     deg   
----------------------- ----------- ----------- ----- ----- ----- ---------- ---- ------------- ---------
2024-06-27 00:00:00.000 22:46:17.90 -11:05:59.0 3.079 2.485  17.2      116.7 20.8         18.25     249.6
2024-06-28 00:00:00.000 22:45:49.30 -11:08:36.0 3.085 2.478  17.0      117.7 20.8         19.22     249.6
2024-06-29 00:00:00.000 22:45:19.10 -11:11:21.0 3.091  2.47  16.7      118.8 20.8         20.19     249.6
2024-06-30 00:00:00.000 22:44:47.50 -11:14:14.0 3.098 2.462  16.5      119.9 20.8         21.16     249.6
2024-07-01 00:00:00.000 22:44:14.40 -11:17:15.0 3.104 2.455  16.3      121.0 20.8         22.13     249.6
2024-07-02 00:00:00.000 22:43:39.80 -11:20:23.0  3.11 2.448  16.1      122.1 20.8         23.09     249.7
2024-07-03 00:00:00.000 22:43:03.80 -11:23:40.0 3.116 2.441  15.8      123.2 20.8         24.05     249.7
2024-07-04 00:00:00.000 22:42:26.20 -11:27:04.0 3.122 2.433  15.6      124.3 20.8         25.01     249.7
2024-07-05 00:00:00.000 22:41:47.20 -11:30:36.0 3.128 2.427  15.4      125.5 20.9         25.96     249.8
2024-07-06 00:00:00.000 22:41:06.60 -11:34:15.0 3.134  2.42  15.1      126.6 20.9         26.91     249.8
2024-07-07 00:00:00.000 22:40:24.70 -11:38:01.0  3.14 2.413  14.8      127.7 20.9         27.84     249.9
2024-07-08 00:00:00.000 22:39:41.20 -11:41:54.0 3.146 2.407  14.6      128.9 20.9         28.77     249.9
2024-07-09 00:00:00.000 22:38:56.40 -11:45:55.0 3.152 2.401  14.3      130.0 20.9         29.68     250.0
2024-07-10 00:00:00.000 22:38:10.10 -11:50:02.0 3.158 2.395  14.0      131.2 20.9         30.59     250.0
2024-07-11 00:00:00.000 22:37:22.40 -11:54:16.0 3.164 2.389  13.7      132.3 20.9         31.48     250.1
2024-07-12 00:00:00.000 22:36:33.30 -11:58:37.0  3.17 2.383  13.5      133.5 20.9         32.36     250.1
2024-07-13 00:00:00.000 22:35:42.80 -12:03:04.0 3.176 2.378  13.2      134.7 20.9         33.22     250.2
2024-07-14 00:00:00.000 22:34:51.00 -12:07:37.0 3.182 2.373  12.9      135.8 20.9         34.07     250.3
2024-07-15 00:00:00.000 22:33:57.80 -12:12:16.0 3.188 2.368  12.6      137.0 20.9         34.91     250.3
2024-07-16 00:00:00.000 22:33:03.40 -12:17:00.0 3.193 2.363  12.2      138.2 20.9         35.72     250.4
2024-07-17 00:00:00.000 22:32:07.60 -12:21:51.0 3.199 2.359  11.9      139.4 20.9         36.52     250.5
2024-07-18 00:00:00.000 22:31:10.60 -12:26:46.0 3.205 2.354  11.6      140.6 20.9          37.3     250.6
2024-07-19 00:00:00.000 22:30:12.40 -12:31:46.0 3.211  2.35  11.3      141.8 21.0         38.06     250.6
2024-07-20 00:00:00.000 22:29:12.90 -12:36:51.0 3.217 2.346  11.0      143.0 21.0          38.8     250.7
2024-07-21 00:00:00.000 22:28:12.30 -12:42:01.0 3.222 2.343  10.6      144.2 21.0         39.52     250.8
2024-07-22 00:00:00.000 22:27:10.50 -12:47:15.0 3.228 2.339  10.3      145.4 21.0         40.21     250.9
2024-07-23 00:00:00.000 22:26:07.60 -12:52:33.0 3.234 2.336   9.9      146.6 21.0         40.89     251.0
2024-07-24 00:00:00.000 22:25:03.70 -12:57:55.0 3.239 2.334   9.6      147.9 21.0         41.54     251.1
2024-07-25 00:00:00.000 22:23:58.60 -13:03:20.0 3.245 2.331   9.2      149.1 21.0         42.17     251.1
2024-07-26 00:00:00.000 22:22:52.60 -13:08:49.0  3.25 2.329   8.9      150.3 21.0         42.77     251.2
2024-07-27 00:00:00.000 22:21:45.60 -13:14:21.0 3.256 2.327   8.5      151.6 21.0         43.34     251.3

Horizons

$ sbpy-ephem horizons 599 --location=G37
# requested target: 599
# returned target: Jupiter (599)
# location: G37
          date              RA        Dec           rh            delta       phase  solarelong  DEC_rate  RA*cos(Dec)_rate   V      surfbright    r_rate   delta_rate elongFlag sunTargetPA velocityPA   GlxLon     GlxLat  
                           deg        deg           AU              AU         deg      deg     arcsec / h    arcsec / h     mag   mag / arcsec2   km / s     km / s                 deg        deg        deg        deg    
----------------------- ---------- ---------- -------------- ---------------- ------ ---------- ---------- ---------------- ------ ------------- --------- ----------- --------- ----------- ---------- ---------- ----------
2024-06-27 00:00:00.000 4:21:13.10 20:47:19.5 5.026064743331  5.8958247647541 5.5375    28.5102   5.364465         32.56776 -2.019         5.337 0.4656808 -11.7891027        /L     259.151    259.348  175.08982 -20.204903
2024-06-28 00:00:00.000 4:22:08.66 20:49:31.8 5.026333631077 5.88872387618099  5.668    29.2439   5.294256         32.46451 -2.021         5.338 0.4649198 -12.0964864        /L     259.275    259.431 175.212122 -20.017832
2024-06-29 00:00:00.000 4:23:04.03 20:51:42.6 5.026602747049 5.88144684311029 5.7978    29.9785   5.223888         32.35713 -2.023         5.339 0.4669296 -12.4000731        /L     259.397    259.512 175.333711 -19.831375
2024-06-30 00:00:00.000 4:23:59.23 20:53:51.6 5.026872020633 5.87399437874092 5.9267    30.7139   5.153123         32.24547 -2.024         5.339 0.4661218 -12.7053606        /L     259.518    259.594 175.454587 -19.645546
2024-07-01 00:00:00.000 4:24:54.24 20:55:58.9 5.027142287391 5.86636798991319 6.0548    31.4503   5.082601          32.1315 -2.026          5.34 0.4690259 -13.0053522        /L     259.636    259.674 175.574737 -19.460378
2024-07-02 00:00:00.000 4:25:49.06 20:58:04.5 5.027413212046 5.85856837358453 6.1821    32.1875   5.011721         32.01296 -2.028         5.341 0.4700648 -13.3057305        /L     259.754    259.755  175.69416 -19.275882
2024-07-03 00:00:00.000 4:26:43.68 21:00:08.4 5.027685156417 5.85059692711023 6.3085    32.9257   4.941132         31.89333  -2.03         5.342 0.4701914 -13.6048615        /L     259.869    259.837  175.81285 -19.092079
2024-07-04 00:00:00.000 4:27:38.09 21:02:10.6  5.02795654487 5.84245318134163 6.4339    33.6648   4.869922         31.76639 -2.032         5.343 0.4707388 -13.9020007        /L     259.983    259.917   175.9308 -18.908995
2024-07-05 00:00:00.000 4:28:32.29 21:04:11.1 5.028228410024 5.83413942555982 6.5585    34.4049   4.798935         31.63762 -2.034         5.344 0.4698848 -14.1980565        /L     260.096    259.998 176.048001 -18.726653
2024-07-06 00:00:00.000 4:29:26.27 21:06:09.9 5.028500184787 5.82565638698889 6.6821     35.146   4.727812         31.50352 -2.036         5.345 0.4714881 -14.4894401        /L     260.208    260.078 176.164442 -18.545084
2024-07-07 00:00:00.000 4:30:20.02 21:08:07.0  5.02877203208 5.81700577542532 6.8047    35.8881   4.656595         31.36554 -2.038         5.346 0.4701159  -14.781285        /L     260.318    260.159  176.28012 -18.364303
2024-07-08 00:00:00.000 4:31:13.53 21:10:02.3 5.029044484041  5.8081895072867 6.9263    36.6312   4.585714         31.22419  -2.04         5.347 0.4729083 -15.0662152        /L     260.427    260.238 176.395019 -18.184344
2024-07-09 00:00:00.000 4:32:06.80 21:11:56.0 5.029317560653 5.79920936390737 7.0468    37.3754   4.514809         31.07886 -2.043         5.348 0.4735135 -15.3506418        /L     260.535    260.318 176.509141 -18.005218
2024-07-10 00:00:00.000 4:32:59.83 21:13:47.9 5.029591647204 5.79006737557984 7.1663    38.1207   4.444469         30.93256 -2.045         5.349 0.4741871 -15.6317916        /L     260.642    260.397 176.622477 -17.826947
2024-07-11 00:00:00.000 4:33:52.60 21:15:38.2 5.029865205778 5.78076369001776 7.2848     38.867    4.37379         30.77935 -2.047          5.35 0.4743538 -15.9110917        /L     260.748    260.477 176.735022 -17.649551
2024-07-12 00:00:00.000 4:34:45.12 21:17:26.7 5.030139354767 5.77130108123675 7.4021    39.6144   4.303656         30.62497  -2.05         5.351 0.4739811 -16.1877003        /L     260.853    260.556 176.846768 -17.473055
2024-07-13 00:00:00.000 4:35:37.36 21:19:13.5 5.030413432472 5.76168054250895 7.5184    40.3629   4.233569          30.4652 -2.052         5.352 0.4756728 -16.4596137        /L     260.956    260.634 176.957706  -17.29748
2024-07-14 00:00:00.000 4:36:29.34 21:20:58.7 5.030687866952 5.75190430770834 7.6334    41.1127   4.163749         30.30282 -2.055         5.353 0.4745164 -16.7313623        /L     261.059    260.712 177.067834 -17.122844
2024-07-15 00:00:00.000 4:37:21.03 21:22:42.2 5.030962864164  5.7419741347999 7.7473    41.8636   4.094355         30.13659 -2.057         5.354 0.4776554 -16.9959233        /L     261.161     260.79 177.177137 -16.949176
2024-07-16 00:00:00.000 4:38:12.44 21:24:24.0 5.031238767117 5.73189227893661 7.8601    42.6157   4.025229         29.96748  -2.06         5.355  0.478332 -17.2599801        /L     261.262    260.867 177.285618 -16.776484
2024-07-17 00:00:00.000 4:39:03.56 21:26:04.1 5.031515838964 5.72166071428519 7.9716    43.3691   3.956821         29.79755 -2.063         5.356 0.4797947 -17.5199366        /L     261.362    260.944  177.39327 -16.604789
2024-07-18 00:00:00.000 4:39:54.39 21:27:42.6 5.031792545934  5.7112796807569 8.0819    44.1237   3.888271         29.62137 -2.065         5.357 0.4796056 -17.7791838        /L     261.461    261.021 177.500091 -16.434105
2024-07-19 00:00:00.000 4:40:44.91 21:29:19.5 5.032069869043 5.70075175006775  8.191    44.8797   3.820426         29.44434 -2.068         5.358  0.479565 -18.0350916        /L     261.559    261.098 177.606071 -16.264456
2024-07-20 00:00:00.000 4:41:35.13 21:30:54.6 5.032346981406 5.69007769610703 8.2987     45.637   3.752688         29.26181 -2.071         5.359  0.480825 -18.2873651        /L     261.656    261.174 177.711204 -16.095864
2024-07-21 00:00:00.000 4:42:25.03 21:32:28.2 5.032624437222 5.67925970873983 8.4052    46.3957   3.685407         29.07747 -2.074          5.36 0.4794497 -18.5394762        /L     261.753     261.25 177.815488 -15.928342
2024-07-22 00:00:00.000 4:43:14.62 21:34:00.1 5.032902058094 5.66829891773577 8.5104    47.1559   3.618483         28.88835 -2.077         5.361  0.482152 -18.7852526        /L     261.848    261.325 177.918909 -15.761921
2024-07-23 00:00:00.000 4:44:03.88 21:35:30.4 5.033180495393 5.65719758238131 8.6143    47.9176   3.551929         28.69682  -2.08         5.362 0.4823468  -19.031035        /L     261.943      261.4 178.021468  -15.59661
2024-07-24 00:00:00.000 4:44:52.80 21:36:59.1 5.033459890975 5.64595718801596 8.7168    48.6809   3.486014          28.5036 -2.083         5.363 0.4840287 -19.2726859        /L     262.037    261.474 178.123157 -15.432433
2024-07-25 00:00:00.000 4:45:41.40 21:38:26.2  5.03373888468 5.63457784553944 8.8179    49.4457    3.41995         28.30403 -2.087         5.364 0.4831831  -19.515058        /L      262.13    261.549 178.223975 -15.269403
2024-07-26 00:00:00.000 4:46:29.64 21:39:51.7 5.034018354818 5.62306166388198 8.9177    50.2122   3.354486         28.10253  -2.09         5.365 0.4833966 -19.7536399        /L     262.222    261.622 178.323907 -15.107554
2024-07-27 00:00:00.000 4:47:17.54 21:41:15.6 5.034297512916 5.61140928521978  9.016    50.9805   3.288993         27.89429 -2.093         5.366 0.4842766 -19.9895264        /L     262.314    261.695 178.422947 -14.946907
$ sbpy-ephem horizons 599 --id-type=smallbody --step=5
# requested target: 599
# returned target: 599 Luisa (A906 HF)
# location: 500
          date              RA        Dec           rh            delta       phase  solarelong  DEC_rate  RA*cos(Dec)_rate  H    G     V      surfbright    r_rate  delta_rate elongFlag sunTargetPA velocityPA   GlxLon     GlxLat 
                           deg        deg           AU              AU         deg      deg     arcsec / h    arcsec / h    mag        mag   mag / arcsec2   km / s    km / s                 deg        deg        deg        deg   
----------------------- ---------- ---------- -------------- ---------------- ------ ---------- ---------- ---------------- ---- ---- ------ ------------- --------- ---------- --------- ----------- ---------- ---------- ---------
2024-06-27 00:00:00.000 8:22:20.16 32:57:20.6 3.388559015636 4.25557668802168 8.0153    27.6915   -13.3895         45.70723 8.73 0.15 15.089         6.607 2.7801935 12.8864564        /T      77.289    279.536 189.440011 32.443678
2024-07-04 12:00:00.000 8:33:14.25 32:16:53.3 3.400417756138 4.30718922675732 6.8911    23.6518   -13.7796         46.03153 8.73 0.15 15.072         6.565 2.6954178 10.9281739        /T      72.646     281.06 190.849029 34.527432
2024-07-12 00:00:00.000 8:44:06.96 31:35:19.2 3.411908788799  4.3501422032977 5.8248    19.9081     -14.12         46.20596 8.73 0.15  15.05         6.523 2.6103759  8.8966039        /T      65.921    282.559 192.290548 36.632611
2024-07-19 12:00:00.000 8:54:56.25 30:52:48.0 3.423031000113 4.38422338636672 4.8792    16.6441   -14.4066         46.24708 8.73 0.15 15.025         6.482 2.5250873  6.8370866        /T      56.055    284.027 193.767548 38.750812
2024-07-27 00:00:00.000 9:05:40.62 30:09:28.8 3.433783356436 4.40934472492811 4.1562    14.1817   -14.6426         46.20211 8.73 0.15 15.005         6.451   2.43957   4.754834        /T      41.829    285.462 195.284526 40.875153

Miriade

$ sbpy-ephem miriade 24
# requested target: 24
# returned target: Themis
# location: 500
          date              RA        Dec         delta      phase  solarelong   DEC_rate      V    RAcosD_rate   delta_rate 
                           deg        deg           AU        deg      deg     arcsec / min   mag   arcsec / min    km / s   
----------------------- ---------- ---------- -------------- ------ ---------- ------------ ------- ------------ ------------
2024-06-27 00:00:00.000 6:49:23.23 23:27:21.1     3.86560396   2.07       5.82    -0.084888  12.710       1.0117    1.0718077
2024-06-28 00:00:00.000 6:51:09.11 23:25:16.7    3.866159918   1.88       5.28    -0.087961  12.690       1.0122    0.8533221
2024-06-29 00:00:00.000 6:52:55.02 23:23:07.8    3.866589514   1.69       4.73    -0.091034  12.680       1.0126      0.63422
2024-06-30 00:00:00.000 6:54:40.94 23:20:54.5    3.866892384    1.5       4.19    -0.094104  12.660        1.013    0.4144873
2024-07-01 00:00:00.000 6:56:26.87 23:18:36.8    3.867068171    1.3       3.65    -0.097171  12.640       1.0134    0.1941567
2024-07-02 00:00:00.000 6:58:12.80 23:16:14.6    3.867116551   1.11       3.11     -0.10023  12.630       1.0137   -0.0266962
2024-07-03 00:00:00.000 6:59:58.74 23:13:48.1    3.867037252   0.92       2.57     -0.10329  12.610        1.014   -0.2479595
2024-07-04 00:00:00.000 7:01:44.67 23:11:17.2    3.866830077   0.73       2.04     -0.10634  12.590       1.0142   -0.4694949
2024-07-05 00:00:00.000 7:03:30.59 23:08:41.9    3.866494912   0.55       1.52     -0.10938  12.560       1.0144   -0.6911492
2024-07-06 00:00:00.000 7:05:16.48 23:06:02.2    3.866031733   0.37       1.02     -0.11242  12.540       1.0145   -0.9127672
2024-07-07 00:00:00.000 7:07:02.36 23:03:18.1    3.865440605   0.22       0.61     -0.11544  12.520       1.0146   -1.1342032
2024-07-08 00:00:00.000 7:08:48.20 23:00:29.7     3.86472167   0.19       0.55     -0.11845  12.510       1.0146   -1.3553297
2024-07-09 00:00:00.000 7:10:34.00 22:57:37.0    3.863875139   0.32       0.91     -0.12145  12.530       1.0146   -1.5760413
2024-07-10 00:00:00.000 7:12:19.77 22:54:39.9    3.862901276   0.49       1.39     -0.12444  12.550       1.0146   -1.7962557
2024-07-11 00:00:00.000 7:14:05.48 22:51:38.6    3.861800388   0.68       1.91     -0.12742  12.570       1.0145   -2.0159102
2024-07-12 00:00:00.000 7:15:51.15 22:48:33.0    3.860572812   0.87       2.44     -0.13038  12.590       1.0143   -2.2349573
2024-07-13 00:00:00.000 7:17:36.75 22:45:23.1    3.859218909   1.06       2.97     -0.13333  12.610       1.0141   -2.4533606
2024-07-14 00:00:00.000 7:19:22.29 22:42:09.0    3.857739061   1.25       3.51     -0.13627  12.630       1.0139   -2.6710909
2024-07-15 00:00:00.000 7:21:07.77 22:38:50.6    3.856133664   1.44       4.05     -0.13919  12.640       1.0136   -2.8881249
2024-07-16 00:00:00.000 7:22:53.17 22:35:28.1    3.854403124   1.64       4.59      -0.1421  12.660       1.0133   -3.1044461
2024-07-17 00:00:00.000 7:24:38.49 22:32:01.4    3.852547856   1.83       5.13       -0.145  12.670        1.013   -3.3200487
2024-07-18 00:00:00.000 7:26:23.74 22:28:30.5    3.850568273   2.02       5.68     -0.14787  12.680       1.0126   -3.5349442
2024-07-19 00:00:00.000 7:28:08.90 22:24:55.5    3.848464773   2.22       6.22     -0.15074  12.700       1.0123   -3.7491708
2024-07-20 00:00:00.000 7:29:53.98 22:21:16.4    3.846237724   2.41       6.76     -0.15359  12.710       1.0118   -3.9628015
2024-07-21 00:00:00.000 7:31:38.96 22:17:33.2    3.843887438    2.6        7.3     -0.15642  12.720       1.0114     -4.17595
2024-07-22 00:00:00.000 7:33:23.86 22:13:45.9    3.841414153    2.8       7.85     -0.15925  12.730        1.011   -4.3887682
2024-07-23 00:00:00.000 7:35:08.65 22:09:54.5    3.838818009   2.99       8.39     -0.16205  12.740       1.0105   -4.6014333
2024-07-24 00:00:00.000 7:36:53.35 22:05:59.2    3.836099042   3.18       8.94     -0.16485  12.750         1.01   -4.8141257
2024-07-25 00:00:00.000 7:38:37.95 22:01:59.8    3.833257188   3.38       9.48     -0.16763  12.760       1.0095   -5.0270024
2024-07-26 00:00:00.000 7:40:22.44 21:57:56.4    3.830292307   3.57      10.03     -0.17039  12.770       1.0089   -5.2401753
2024-07-27 00:00:00.000 7:42:06.82 21:53:49.1    3.827204208   3.76      10.57     -0.17313  12.780       1.0083   -5.4536996
pep8speaks commented 2 weeks ago

Hello @mkelley! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 41:80: E501 line too long (98 > 79 characters)

Line 949:80: E501 line too long (80 > 79 characters) Line 990:80: E501 line too long (80 > 79 characters)

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 6.17284% with 76 lines in your changes missing coverage. Please review.

Project coverage is 57.39%. Comparing base (1315915) to head (fce55ec).

Files Patch % Lines
sbpy/data/ephem.py 6.17% 76 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #396 +/- ## =========================================== - Coverage 77.52% 57.39% -20.14% =========================================== Files 81 79 -2 Lines 7096 7137 +41 =========================================== - Hits 5501 4096 -1405 - Misses 1595 3041 +1446 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.