diff --git a/CHANGES.rst b/CHANGES.rst index 183e31438..840bd3ec2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,15 @@ +0.6.0 (unreleased) +================== + +New Features +------------ + +sbpy.data.ephem +^^^^^^^^^^^^^^^ + +- New command-line script: ``sbpy-ephem``. + + 0.5.0 (2024-08-28) ================== diff --git a/docs/sbpy/data/ephem.rst b/docs/sbpy/data/ephem.rst index 01eb52bc6..9f50801d3 100644 --- a/docs/sbpy/data/ephem.rst +++ b/docs/sbpy/data/ephem.rst @@ -309,4 +309,43 @@ Telescope: The properties computed by pyoorb and listed in the resulting table are defined in the `pyoorb documentation `_. Note that this function -requires pyoorb to be installed, which is not a requirement for `sbpy`. \ No newline at end of file +requires pyoorb to be installed, which is not a requirement for `sbpy`. + + +Executable scripts +------------------ + +Ephemerides may be generated from the command line using the ``sbpy-ephem`` +script installed during sbpy's installation. The script supports ephemeris +generation from Horizons, the Minor Planet Center, and Miriade. + +For example, to display the ephemeris of comet 2P/Encke from the Minor Planet +Center: + +.. code:: bash + + $ 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-08-17 00:00:00.000 21:55:57.10 -15:12:47.0 3.368 2.356 0.9 177.1 21.1 47.72 253.7 + 2024-08-18 00:00:00.000 21:54:41.20 -15:18:06.0 3.373 2.361 0.7 177.5 21.1 47.54 253.9 + 2024-08-19 00:00:00.000 21:53:25.60 -15:23:21.0 3.378 2.367 0.8 177.4 21.1 47.32 254.0 + 2024-08-20 00:00:00.000 21:52:10.30 -15:28:32.0 3.383 2.372 1.0 176.7 21.2 47.07 254.1 + 2024-08-21 00:00:00.000 21:50:55.30 -15:33:38.0 3.388 2.378 1.3 175.8 21.2 46.79 254.3 + 2024-08-22 00:00:00.000 21:49:40.70 -15:38:40.0 3.393 2.385 1.6 174.7 21.2 46.47 254.4 + 2024-08-23 00:00:00.000 21:48:26.50 -15:43:37.0 3.398 2.391 1.9 173.5 21.3 46.13 254.6 + 2024-08-24 00:00:00.000 21:47:12.90 -15:48:29.0 3.403 2.398 2.3 172.3 21.3 45.75 254.7 + 2024-08-25 00:00:00.000 21:45:59.80 -15:53:16.0 3.408 2.406 2.6 171.1 21.3 45.34 254.9 + 2024-08-26 00:00:00.000 21:44:47.30 -15:57:57.0 3.413 2.413 3.0 169.9 21.4 44.9 255.0 + 2024-08-27 00:00:00.000 21:43:35.40 -16:02:33.0 3.418 2.421 3.3 168.7 21.4 44.44 255.2 + 2024-08-28 00:00:00.000 21:42:24.30 -16:07:04.0 3.423 2.43 3.7 167.4 21.4 43.94 255.3 + 2024-08-29 00:00:00.000 21:41:13.90 -16:11:28.0 3.427 2.438 4.0 166.2 21.5 43.41 255.5 + 2024-08-30 00:00:00.000 21:40:04.30 -16:15:47.0 3.432 2.447 4.4 165.0 21.5 42.86 255.6 + ... + +A limited number of input parameters are supported. Run with the ``--help`` +option for more details. \ No newline at end of file diff --git a/sbpy/data/__init__.py b/sbpy/data/__init__.py index 68aa6d44e..0a5a471b2 100644 --- a/sbpy/data/__init__.py +++ b/sbpy/data/__init__.py @@ -48,8 +48,19 @@ class Conf: fieldnames_info = [ # General { - "description": "Target Identifier", - "fieldnames": ["targetname", "id", "Object"], + "description": "Target Name", + "fieldnames": [ + "targetname", + "Targetname", + "target", + "Target", + "name", + "Name", + "id", + "ID", + "Object", + "object", + ], "provenance": ["orbit", "ephem", "obs", "phys"], "dimension": None, }, @@ -61,13 +72,7 @@ class Conf: }, { "description": "Target Number", - "fieldnames": ["number"], - "provenance": ["orbit", "ephem", "obs", "phys"], - "dimension": None, - }, - { - "description": "Target Name", - "fieldnames": ["name"], + "fieldnames": ["number", "target number"], "provenance": ["orbit", "ephem", "obs", "phys"], "dimension": None, }, diff --git a/sbpy/data/ephem.py b/sbpy/data/ephem.py index 2328cd3db..d6300acb5 100644 --- a/sbpy/data/ephem.py +++ b/sbpy/data/ephem.py @@ -1,15 +1,22 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst """ ====================== -sbpy data.Ephem Module +sbpy.data.ephem Module ====================== -Class for storing and querying ephemerides +Class for storing and querying ephemerides. + +Ephemerides may be generated by this module via the ``sbpy-ephem`` command line script. created on June 04, 2017 + """ + import os +import enum +import argparse from warnings import warn +from typing import Any, Dict, List, Optional, Set, Union import numpy as np from numpy import ndarray, hstack, iterable @@ -24,12 +31,12 @@ from astroquery.mpc import MPC from astroquery.imcce import Miriade from astroquery.exceptions import InvalidQueryError -except ImportError: +except ImportError: # pragma: no cover pass try: import pyoorb -except ImportError: +except ImportError: # pragma: no cover pass from ..bib import cite @@ -38,7 +45,7 @@ from .orbit import Orbit, OpenOrbError from ..utils.decorators import requires -__all__ = ['Ephem'] +__all__ = ["Ephem"] __doctest_requires__ = { @@ -47,15 +54,31 @@ } +# include one entry for every supported ephemeris service +class EphemerisService(enum.Enum): + horizons = "horizons" + mpc = "mpc" + miriade = "miriade" + oorb = "oorb" + + def __str__(self): + return self.value + + class Ephem(DataClass): """Class for querying, manipulating, and calculating ephemerides""" @classmethod @requires("astroquery") - @cite({'data source': '1996DPS....28.2504G', - 'software: astroquery': '2019AJ....157...98G'}) - def from_horizons(cls, targetids, id_type='smallbody', - epochs=None, location='500', **kwargs): + @cite( + { + "data source": "1996DPS....28.2504G", + "software: astroquery": "2019AJ....157...98G", + } + ) + def from_horizons( + cls, targetids, id_type="smallbody", epochs=None, location="500", **kwargs + ): """Load target ephemerides from `JPL Horizons `_ using `astroquery.jplhorizons.HorizonsClass.ephemerides` @@ -186,8 +209,9 @@ def from_horizons(cls, targetids, id_type='smallbody', 'lat': location.lat.deg, 'elevation': location.height.to('km')} - # append ephemerides table for each targetid + # append ephemerides table for each targetid, collect all URLs all_eph = None + urls = [] for targetid in targetids: # load ephemerides using astroquery.jplhorizons @@ -201,6 +225,8 @@ def from_horizons(cls, targetids, id_type='smallbody', 'The following query was attempted: {:s}').format( str(e), obj.uri)) + urls.append(obj.uri) + if _sorted: # restore user's original order eph = eph[_unsort] @@ -424,7 +450,7 @@ def from_mpc(cls, targetids, epochs=None, location='500', ra_format=None, else: raise ValueError('Invalid `epochs` parameter') - # append ephemerides table for each targetid + # append ephemerides table for each targetid and collect URLs all_eph = None for targetid in targetids: try: @@ -473,12 +499,12 @@ def from_mpc(cls, targetids, epochs=None, location='500', ra_format=None, @classmethod @requires("astroquery") - @cite({'data source': 'http://vo.imcce.fr/webservices/miriade/', + @cite({'data source': 'https://vo.imcce.fr/webservices/miriade/', 'software: astroquery': '2019AJ....157...98G'}) def from_miriade(cls, targetids, objtype='asteroid', epochs=None, location='500', **kwargs): """Load target ephemerides from - `IMCCE Miriade `_ using + `IMCCE Miriade `_ using `astroquery.imcce.MiriadeClass.get_ephemerides` Parameters @@ -525,7 +551,7 @@ def from_miriade(cls, targetids, objtype='asteroid', * For detailed explanations of the queried fields, refer to `astroquery.imcce.MiriadeClass.get_ephemerides` and the `Miriade documentation - `_. + `_. * By default, all properties are provided in the J2000.0 reference system. Different settings can be chosen using additional keyword arguments as used by @@ -863,3 +889,303 @@ def from_oo(cls, orbit, epochs=None, location='500', scope='full', ephem.table.remove_column('MJD') return ephem + + +class EphemerisCLI: + """Command-line interface for ephemeris generation. + + Use this class via the commaline-line script ``sbpy-ephem``. + + + Parameters + ---------- + argv : list of str, optional + Parse command line parameters from this list, rather than sys.argv. + + """ + + @requires("astroquery") + def __init__(self, argv: Optional[List[str]] = None) -> None: + self.args: argparse.Namespace = self.parse_args(argv) + self.epochs: Dict[str, Any] = self._format_epochs(self.args) + + self.eph: Ephem + if self.args.service == EphemerisService.mpc: + self.eph = self.mpc() + elif self.args.service == EphemerisService.horizons: + self.eph = self.horizons() + elif self.args.service == EphemerisService.miriade: + self.eph = self.miriade() + + self.eph: Ephem = self._format_eph(self.eph) + + @classmethod + def run(cls): # pragma: no cover + """Command-line script entry point.""" + cli = cls() + print( + f"""# requested target: {cli.args.target} +# returned target: {cli.eph.meta['target']} +# location: {cli.args.location}""" + ) + cli.eph.table.pprint_all() + + @staticmethod + def parse_args(argv: Optional[List[str]] = None) -> argparse.Namespace: + """Parse command-line arguments. + + Parameters + ---------- + argv : list of str, optional + Parse command line parameters from this list, rather than sys.argv. + + """ + + today: Time = Time(Time.now().iso[:10]) + + parser: argparse.ArgumentParser = argparse.ArgumentParser() + # names in choices must have entries in `EphemerisService` + parser.add_argument( + "service", + type=EphemerisService, + choices=list(EphemerisService), + help="online service to use for ephemeris", + ) + parser.add_argument( + "target", + ) + parser.add_argument( + "--location", + "-l", + default="500", + help="observer location", + ) + parser.add_argument( + "--start", + default=today, + type=Time, + help="start time, default today (UTC)", + ) + parser.add_argument( + "--step", + default="1 d", + type=u.Quantity, + help="ephemeris step size with units", + ) + + stop_number_mutex = parser.add_mutually_exclusive_group() + stop_number_mutex.add_argument( + "--stop", + "--end", + type=Time, + help="stop time (UTC)", + ) + stop_number_mutex.add_argument( + "--number", + "-n", + type=int, + help="number of time steps", + ) + + parser.add_argument( + "--radec", + "-r", + default="hmsdms", + choices=("hmsdms", "deg"), + help="RA, Dec coordinate format", + ) + + horizons: argparse._ArgumentGroup = parser.add_argument_group( + "JPL Horizons options" + ) + horizons.add_argument( + "--id-type", + "-i", + default=None, + choices=( + "smallbody", + "designation", + "name", + "asteroid_name", + "comet_name", + ), + help=( + "target identifer type; automatically set to 'designation' for " + "target names that appear to be a cometary designation" + ), + ) + horizons.add_argument( + "--quantities", + "-q", + default="1,3,9,19,20,23,24,27,33", + help="table quantities to return as a comma-separated list of integers (default: 1,3,9,19,20,23,24,27,33)", + ) + + miriade: argparse._ArgumentGroup = parser.add_argument_group( + "IMCCE Miriade options" + ) + miriade.add_argument( + "--type", + "-t", + default="asteroid", + choices=( + "asteroid", + "comet", + "dwarf planet", + "planet", + "satellite", + ), + help="target identifer type", + ) + + return parser.parse_args(argv) + + @staticmethod + def _format_epochs(args) -> Dict[str, Any]: + """Format the epochs dictionary.""" + + epochs: dict = { + "start": args.start, + "step": args.step, + "stop": args.stop, + } + defined_attributes: Set[str] = { + k + for k in ["start", "stop", "step", "number"] + if getattr(args, k) is not None + } + + def given(*attributes): + return set(attributes) == defined_attributes + + # start and step are always defined by parse_args + if given("start", "step"): + # default is 60 steps + epochs["stop"] = epochs["start"] + 60 * epochs["step"] + elif given("start", "step", "number"): + epochs["stop"] = epochs["start"] + args.number * epochs["step"] + + return epochs + + def mpc(self) -> Ephem: + """Get ephemeris from the Minor Planet Center.""" + + eph = Ephem.from_mpc( + self.args.target, + epochs=self.epochs, + location=self.args.location, + ) + return eph + + def horizons(self) -> Ephem: + """Get ephemeris from Horizons.""" + + from .names import Names, TargetNameParseError + + # comet specific options: always avoid multiple fragment matches, always + # return closest apparition + closest_apparition: bool = False + no_fragments: bool = False + id_type: Union[str, None] = self.args.id_type + try: + Names.parse_comet(self.args.target) + jd_mid = np.mean((self.epochs["start"].jd, self.epochs["stop"].jd)) + closest_apparition = f"<{jd_mid:.0f}" + no_fragments = True + id_type = "designation" if id_type is None else id_type + except TargetNameParseError: + pass + + eph = Ephem.from_horizons( + self.args.target, + id_type=id_type, + closest_apparition=closest_apparition, + no_fragments=no_fragments, + epochs=self.epochs, + location=self.args.location, + quantities=self.args.quantities, + ) + + # simplify output + eph["epoch"].format = "iso" + eph["ra"] = eph["ra"].unmasked + eph["dec"] = eph["dec"].unmasked + for k in ["M1", "k1", "solar_presence", "lunar_presence"]: + if k in eph.table.colnames: + del eph.table[k] + + return eph + + def miriade(self) -> Ephem: + """Get ephemeris from Miriade.""" + + eph = Ephem.from_miriade( + self.args.target, + objtype=self.args.type, + epochs=self.epochs, + location=self.args.location, + coordtype=1, + ) + + # simplify output + eph["epoch"].format = "iso" + + for k in eph.field_names: + if hasattr(eph[k], "unmasked"): + eph[k] = eph[k].unmasked + + return eph + + def _format_eph(self, eph: Ephem) -> Ephem: + # convert RA and Dec to Angle in units of degree + eph["ra"] = Angle(eph["ra"], eph["ra"].unit).to("deg") + eph["dec"] = Angle(eph["dec"], eph["dec"].unit).to("deg") + + if self.args.radec == "hmsdms": + eph["ra"].info.format = lambda x: x.to_string( + sep=":", precision=2, unit="hourangle" + ) + eph["dec"].info.format = lambda x: x.to_string(sep=":", precision=1) + else: + eph["ra"].info.format = lambda x: x.to_string( + unit="deg", decimal=True, precision=5 + ) + eph["dec"].info.format = lambda x: x.to_string( + unit="deg", decimal=True, precision=5 + ) + + # normalize output for most common columns + first_fields: List[str] = [ + "target", + "date", + "RA", + "Dec", + "rh", + "delta", + "phase", + "solarelong", + "DEC_rate", + "RA*cos(Dec)_rate", + ] + + k: str + translated: str + for k in first_fields: + if k not in eph: + continue + translated = eph._translate_columns(k)[0] + eph.table.rename_column(translated, k) + + # re-order + fields: List[str] = eph.field_names + for k in reversed(first_fields): + if k not in fields: + continue + fields.insert(0, fields.pop(fields.index(k))) + + eph = eph[fields] + target = eph["target"][0] + del eph.table["target"] + eph.table.meta["target"] = target + + return eph diff --git a/sbpy/data/tests/data/TestEphemerisCLI-2p-horizons.txt b/sbpy/data/tests/data/TestEphemerisCLI-2p-horizons.txt new file mode 100644 index 000000000..84661e236 --- /dev/null +++ b/sbpy/data/tests/data/TestEphemerisCLI-2p-horizons.txt @@ -0,0 +1,294 @@ +API VERSION: 1.2 +API SOURCE: NASA/JPL Horizons API + +******************************************************************************* +JPL/HORIZONS 2P/Encke 2024-Sep-02 08:00:31 +Rec #:90000091 (+COV) Soln.date: 2024-Aug-26_10:56:41 # obs: 556 (2018-2024) + +IAU76/J2000 helio. ecliptic osc. elements (au, days, deg., period=Julian yrs): + + EPOCH= 2459752.5 ! 2022-Jun-22.0000000 (TDB) RMSW= n.a. + EC= .8485141889848308 QR= .3362300806790429 TP= 2460239.0189482248 + OM= 334.3120522286535 W= 187.0124965530834 IN= 11.50170416921873 + A= 2.219548342025076 MA= 214.9870056150526 ADIST= 4.10286660337111 + PER= 3.3067785736152 N= .298062377 ANGMOM= .013561606 + DAN= 3.93787 DDN= .33739 L= 161.1850899 + B= -1.3949208 MOID= .168138 TP= 2023-Oct-21.5189482248 + +Comet physical (GM= km^3/s^2; RAD= km): + GM= n.a. RAD= 2.4 + M1= 15.6 M2= n.a. k1= 4.5 k2= n.a. PHCOF= n.a. +Comet non-gravitational force model (AMRAT=m^2/kg;A1-A3=au/d^2;DT=days;R0=au): + AMRAT= 0. DT= 0. + A1= 3.368033468723E-10 A2= 8.548115729354E-12 A3= 0. + Standard model: + ALN= .1112620426 NK= 4.6142 NM= 2.15 NN= 5.093 R0= 2.808 + +COMET comments +1: soln ref.= JPL#K232/4, data arc: 2018-11-05 to 2024-08-18 +2: k1=4.5; +******************************************************************************* + + +******************************************************************************* +Ephemeris / API_USER Mon Sep 2 08:00:31 2024 Pasadena, USA / Horizons +******************************************************************************* +Target body name: 2P/Encke {source: JPL#K232/4} +Center body name: Earth (399) {source: DE441} +Center-site name: GEOCENTRIC +******************************************************************************* +Start time : A.D. 2024-Aug-16 00:00:00.0000 UT +Stop time : A.D. 2024-Oct-15 00:00:00.0000 UT +Step-size : 1440 minutes +******************************************************************************* +Target pole/equ : undefined +Target radii : 2.4 km +Center geodetic : 0.0, 0.0, -6378.137 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 0.0, 0.0, 0.0 {E-lon(deg),Dxy(km),Dz(km)} +Center pole/equ : ITRF93 {East-longitude positive} +Center radii : 6378.137, 6378.137, 6356.752 km {Equator_a, b, pole_c} +Target primary : Sun +Vis. interferer : MOON (R_eq= 1737.400) km {source: DE441} +Rel. light bend : Sun {source: DE441} +Rel. lght bnd GM: 1.3271E+11 km^3/s^2 +Small-body perts: Yes {source: SB441-N16} +Atmos refraction: NO (AIRLESS) +RA format : DEG +Time format : BOTH +Calendar mode : Mixed Julian/Gregorian +EOP file : eop.240829.p241122 +EOP coverage : DATA-BASED 1962-JAN-20 TO 2024-AUG-29. PREDICTS-> 2024-NOV-21 +Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s +Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) +Table cut-offs 2: Solar elongation ( 0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) +Table cut-offs 3: RA/DEC angular rate ( 0.0=NO ) +Table format : Comma Separated Values (spreadsheet) +******************************************************************************* +Initial IAU76/J2000 heliocentric ecliptic osculating elements (au, days, deg.): + EPOCH= 2459752.5 ! 2022-Jun-22.0000000 (TDB) RMSW= n.a. + EC= .8485141889848308 QR= .3362300806790429 TP= 2460239.0189482248 + OM= 334.3120522286535 W= 187.0124965530834 IN= 11.50170416921873 + Equivalent ICRF heliocentric cartesian coordinates (au, au/d): + X= 3.886668467170212E+00 Y=-9.188393246574216E-01 Z=-2.098903569670719E-01 + VX=-9.846074938312395E-04 VY= 3.120416928338697E-03 VZ= 1.988497527345202E-03 +Comet physical (GM= km^3/s^2; RAD= km): + GM= n.a. RAD= 2.4 + M1= 15.6 M2= n.a. k1= 4.5 k2= n.a. PHCOF= n.a. +Comet non-gravitational force model (AMRAT=m^2/kg;A1-A3=au/d^2;DT=days;R0=au): + AMRAT= 0. DT= 0. + A1= 3.368033468723E-10 A2= 8.548115729354E-12 A3= 0. + Standard model: + ALN= .1112620426 NK= 4.6142 NM= 2.15 NN= 5.093 R0= 2.808 +******************************************************************************************************************************************************************************************************************************************** + Date__(UT)__HR:MN, Date_________JDUT, , , R.A._(ICRF), DEC_(ICRF), dRA*cosD, d(DEC)/dt, T-mag, N-mag, r, rdot, delta, deldot, S-O-T,/r, S-T-O, PsAng, PsAMV, GlxLon, GlxLat, +******************************************************************************************************************************************************************************************************************************************** +$$SOE + 2024-Aug-16 00:00, 2460538.500000000, , , 329.30474, -15.12338, -45.9107, -13.5742, 19.827, n.a., 3.362689434345, 8.8625509, 2.35165022935209, 7.7914783, 176.1737,/L, 1.1540, 290.572, 237.575, 40.373744,-47.873291, + 2024-Aug-17 00:00, 2460539.500000000, , , 328.98787, -15.21298, -45.7974, -13.4254, 19.834, n.a., 3.367797212379, 8.8257359, 2.35631688615317, 8.3691715, 177.0443,/L, 0.8899, 306.748, 237.776, 40.067975,-47.629799, + 2024-Aug-18 00:00, 2460540.500000000, , , 328.67178, -15.30155, -45.6512, -13.2664, 19.842, n.a., 3.372883747218, 8.7890194, 2.36131704455975, 8.9463448, 177.5296,/L, 0.7414, 332.189, 237.975, 39.766426,-47.386178, + 2024-Aug-19 00:00, 2460541.500000000, , , 328.35667, -15.38902, -45.4728, -13.0977, 19.850, n.a., 3.377949095643, 8.7524007, 2.36665032393581, 9.5227309, 177.4051,/T, 0.7757, 1.325, 238.170, 39.469241,-47.142623, + 2024-Aug-20 00:00, 2460542.500000000, , , 328.04277, -15.47533, -45.2628, -12.9198, 19.858, n.a., 3.382993313982, 8.7158789, 2.37231620908038, 10.0981297, 176.7412,/T, 0.9716, 22.924, 238.363, 39.176553,-46.899328, + 2024-Aug-21 00:00, 2460543.500000000, , , 327.73031, -15.56043, -45.0217, -12.7332, 19.866, n.a., 3.388016458114, 8.6794533, 2.37831408460100, 10.6723897, 175.7868,/T, 1.2539, 36.043, 238.552, 38.888486,-46.656486, + 2024-Aug-22 00:00, 2460544.500000000, , , 327.41949, -15.64425, -44.7499, -12.5382, 19.875, n.a., 3.393018583468, 8.6431232, 2.38464325373495, 11.2453738, 174.6977,/T, 1.5752, 44.092, 238.738, 38.605153,-46.414286, + 2024-Aug-23 00:00, 2460545.500000000, , , 327.11054, -15.72675, -44.4476, -12.3351, 19.884, n.a., 3.397999745033, 8.6068877, 2.39130293467752, 11.8169183, 173.5427,/T, 1.9145, 49.363, 238.921, 38.326659,-46.172919, + 2024-Aug-24 00:00, 2460546.500000000, , , 326.80367, -15.80786, -44.1151, -12.1243, 19.893, n.a., 3.402959997362, 8.5707461, 2.39829223520000, 12.3868005, 172.3527,/T, 2.2624, 53.039, 239.101, 38.053104,-45.932573, + 2024-Aug-25 00:00, 2460547.500000000, , , 326.49908, -15.88755, -43.7527, -11.9058, 19.902, n.a., 3.407899394576, 8.5346977, 2.40561011380958, 12.9547255, 171.1428,/T, 2.6141, 55.740, 239.278, 37.784581,-45.693437, + 2024-Aug-26 00:00, 2460548.500000000, , , 326.19699, -15.96575, -43.3605, -11.6801, 19.912, n.a., 3.412817990372, 8.4987416, 2.41325533858522, 13.5203308, 169.9211,/T, 2.9670, 57.807, 239.452, 37.521178,-45.455699, + 2024-Aug-27 00:00, 2460549.500000000, , , 325.89761, -16.04242, -42.9389, -11.4474, 19.922, n.a., 3.417715838026, 8.4628773, 2.42122645250697, 14.0832026, 168.6925,/T, 3.3195, 59.443, 239.623, 37.262978,-45.219546, + 2024-Aug-28 00:00, 2460550.500000000, , , 325.60114, -16.11753, -42.4885, -11.2081, 19.932, n.a., 3.422592990400, 8.4271039, 2.42952174934040, 14.6428948, 167.4599,/T, 3.6706, 60.773, 239.790, 37.010058,-44.985161, + 2024-Aug-29 00:00, 2460551.500000000, , , 325.30778, -16.19101, -42.0098, -10.9625, 19.943, n.a., 3.427449499947, 8.3914207, 2.43813926003474, 15.1989457, 166.2253,/T, 4.0196, 61.878, 239.954, 36.762487,-44.752727, + 2024-Aug-30 00:00, 2460552.500000000, , , 325.01774, -16.26285, -41.5036, -10.7109, 19.953, n.a., 3.432285418714, 8.3558271, 2.44707674750675, 15.7508906, 164.9902,/T, 4.3660, 62.813, 240.115, 36.520330,-44.522421, + 2024-Aug-31 00:00, 2460553.500000000, , , 324.73121, -16.33298, -40.9707, -10.4539, 19.964, n.a., 3.437100798347, 8.3203222, 2.45633170736155, 16.2982697, 163.7555,/T, 4.7091, 63.617, 240.272, 36.283644,-44.294419, + 2024-Sep-01 00:00, 2460554.500000000, , , 324.44837, -16.40139, -40.4119, -10.1918, 19.975, n.a., 3.441895690095, 8.2849056, 2.46590137268890, 16.8406345, 162.5221,/T, 5.0489, 64.317, 240.426, 36.052478,-44.068889, + 2024-Sep-02 00:00, 2460555.500000000, , , 324.16941, -16.46804, -39.8283, -9.92505, 19.987, n.a., 3.446670144816, 8.2495763, 2.47578272183622, 17.3775520, 161.2906,/T, 5.3848, 64.934, 240.577, 35.826876,-43.845996, + 2024-Sep-03 00:00, 2460556.500000000, , , 323.89449, -16.53290, -39.2209, -9.65417, 19.998, n.a., 3.451424212974, 8.2143338, 2.48597248859938, 17.9086090, 160.0614,/T, 5.7167, 65.483, 240.725, 35.606872,-43.625899, + 2024-Sep-04 00:00, 2460557.500000000, , , 323.62379, -16.59595, -38.5908, -9.37960, 20.010, n.a., 3.456157944652, 8.1791775, 2.49646717448255, 18.4334148, 158.8351,/T, 6.0443, 65.976, 240.869, 35.392496,-43.408751, + 2024-Sep-05 00:00, 2460558.500000000, , , 323.35746, -16.65716, -37.9391, -9.10179, 20.022, n.a., 3.460871389545, 8.1441065, 2.50726306262885, 18.9516041, 157.6119,/T, 6.3674, 66.422, 241.010, 35.183770,-43.194698, + 2024-Sep-06 00:00, 2460559.500000000, , , 323.09567, -16.71651, -37.2670, -8.82122, 20.035, n.a., 3.465564596972, 8.1091203, 2.51835623286801, 19.4628384, 156.3921,/T, 6.6859, 66.828, 241.148, 34.980708,-42.983881, + 2024-Sep-07 00:00, 2460560.500000000, , , 322.83853, -16.77399, -36.5757, -8.53834, 20.047, n.a., 3.470237615869, 8.0742182, 2.52974257722419, 19.9668059, 155.1761,/T, 6.9995, 67.200, 241.282, 34.783319,-42.776431, + 2024-Sep-08 00:00, 2460561.500000000, , , 322.58621, -16.82958, -35.8665, -8.25361, 20.060, n.a., 3.474890494800, 8.0393995, 2.54141781528446, 20.4632210, 153.9640,/T, 7.3082, 67.542, 241.413, 34.591605,-42.572476, + 2024-Sep-09 00:00, 2460562.500000000, , , 322.33881, -16.88327, -35.1405, -7.96746, 20.072, n.a., 3.479523281952, 8.0046637, 2.55337750908490, 20.9518236, 152.7561,/T, 7.6117, 67.859, 241.540, 34.405561,-42.372133, + 2024-Sep-10 00:00, 2460563.500000000, , , 322.09646, -16.93506, -34.3990, -7.68032, 20.085, n.a., 3.484136025138, 7.9700099, 2.56561707760337, 21.4323785, 151.5525,/T, 7.9100, 68.153, 241.664, 34.225178,-42.175515, + 2024-Sep-11 00:00, 2460564.500000000, , , 321.85927, -16.98493, -33.6432, -7.39261, 20.099, n.a., 3.488728771801, 7.9354377, 2.57813181150516, 21.9046770, 150.3533,/T, 8.2029, 68.427, 241.785, 34.050440,-41.982725, + 2024-Sep-12 00:00, 2460565.500000000, , , 321.62733, -17.03290, -32.8744, -7.10473, 20.112, n.a., 3.493301569013, 7.9009463, 2.59091688939235, 22.3685407, 149.1588,/T, 8.4904, 68.683, 241.902, 33.881326,-41.793859, + 2024-Sep-13 00:00, 2460566.500000000, , , 321.40074, -17.07895, -32.0938, -6.81710, 20.125, n.a., 3.497854463477, 7.8665352, 2.60396739733102, 22.8238290, 147.9691,/T, 8.7723, 68.924, 242.016, 33.717809,-41.609008, + 2024-Sep-14 00:00, 2460567.500000000, , , 321.17958, -17.12309, -31.3027, -6.53008, 20.139, n.a., 3.502387501528, 7.8322036, 2.61727835361104, 23.2704498, 146.7841,/T, 9.0486, 69.150, 242.127, 33.559859,-41.428253, + 2024-Sep-15 00:00, 2460568.500000000, , , 320.96392, -17.16533, -30.5023, -6.24406, 20.153, n.a., 3.506900729137, 7.7979510, 2.63084474006346, 23.7083707, 145.6041,/T, 9.3192, 69.363, 242.234, 33.407438,-41.251668, + 2024-Sep-16 00:00, 2460569.500000000, , , 320.75383, -17.20568, -29.6937, -5.95936, 20.167, n.a., 3.511394191910, 7.7637767, 2.64466153923797, 24.1376273, 144.4291,/T, 9.5841, 69.564, 242.338, 33.260508,-41.079319, + 2024-Sep-17 00:00, 2460570.500000000, , , 320.54937, -17.24414, -28.8781, -5.67626, 20.181, n.a., 3.515867935091, 7.7296802, 2.65872377309445, 24.5583186, 143.2591,/T, 9.8431, 69.755, 242.438, 33.119023,-40.911268, + 2024-Sep-18 00:00, 2460571.500000000, , , 320.35059, -17.28073, -28.0562, -5.39500, 20.195, n.a., 3.520322003567, 7.6956607, 2.67302653461664, 24.9705862, 142.0941,/T, 10.0963, 69.935, 242.536, 32.982937,-40.747568, + 2024-Sep-19 00:00, 2460572.500000000, , , 320.15753, -17.31545, -27.2288, -5.11570, 20.209, n.a., 3.524756441867, 7.6617178, 2.68756500170856, 25.3745752, 140.9343,/T, 10.3437, 70.106, 242.630, 32.852201,-40.588269, + 2024-Sep-20 00:00, 2460573.500000000, , , 319.97023, -17.34833, -26.3964, -4.83843, 20.223, n.a., 3.529171294169, 7.6278507, 2.70233442604059, 25.7703888, 139.7795,/T, 10.5851, 70.269, 242.720, 32.726768,-40.433415, + 2024-Sep-21 00:00, 2460574.500000000, , , 319.78873, -17.37937, -25.5593, -4.56322, 20.238, n.a., 3.533566604305, 7.5940590, 2.71733009824313, 26.1580548, 138.6299,/T, 10.8205, 70.424, 242.808, 32.606588,-40.283048, + 2024-Sep-22 00:00, 2460575.500000000, , , 319.61307, -17.40860, -24.7181, -4.29006, 20.252, n.a., 3.537942415765, 7.5603419, 2.73254730016307, 26.5375157, 137.4854,/T, 11.0500, 70.571, 242.892, 32.491615,-40.137207, + 2024-Sep-23 00:00, 2460576.500000000, , , 319.44328, -17.43602, -23.8731, -4.01895, 20.267, n.a., 3.542298771701, 7.5266990, 2.74798125861797, 26.9086423, 136.3460,/T, 11.2734, 70.711, 242.973, 32.381804,-39.995928, + 2024-Sep-24 00:00, 2460577.500000000, , , 319.27938, -17.46165, -23.0247, -3.74992, 20.282, n.a., 3.546635714933, 7.4931297, 2.76362711148269, 27.2712604, 135.2119,/T, 11.4909, 70.845, 243.051, 32.277108,-39.859242, + 2024-Sep-25 00:00, 2460578.500000000, , , 319.12140, -17.48550, -22.1737, -3.48301, 20.296, n.a., 3.550953287952, 7.4596334, 2.77947988976684, 27.6251783, 134.0829,/T, 11.7023, 70.972, 243.126, 32.177483,-39.727178, + 2024-Sep-26 00:00, 2460579.500000000, , , 318.96936, -17.50759, -21.3205, -3.21827, 20.311, n.a., 3.555251532925, 7.4262095, 2.79553451343772, 27.9702058, 132.9591,/T, 11.9076, 71.093, 243.197, 32.082884,-39.599762, + 2024-Sep-27 00:00, 2460580.500000000, , , 318.82327, -17.52793, -20.4659, -2.95580, 20.326, n.a., 3.559530491695, 7.3928575, 2.81178579623575, 28.3061663, 131.8406,/T, 12.1069, 71.209, 243.266, 31.993266,-39.477013, + 2024-Sep-28 00:00, 2460581.500000000, , , 318.68315, -17.54654, -19.6105, -2.69566, 20.341, n.a., 3.563790205787, 7.3595768, 2.82822845498139, 28.6329014, 130.7273,/T, 12.3002, 71.319, 243.331, 31.908581,-39.358948, + 2024-Sep-29 00:00, 2460582.500000000, , , 318.54900, -17.56343, -18.7551, -2.43796, 20.356, n.a., 3.568030716411, 7.3263669, 2.84485712033785, 28.9502711, 129.6192,/T, 12.4873, 71.424, 243.393, 31.828784,-39.245578, + 2024-Sep-30 00:00, 2460583.500000000, , , 318.42082, -17.57861, -17.9002, -2.18277, 20.371, n.a., 3.572252064459, 7.2932272, 2.86166634752825, 29.2581538, 128.5164,/T, 12.6684, 71.525, 243.452, 31.753825,-39.136910, + 2024-Oct-01 00:00, 2460584.500000000, , , 318.29861, -17.59212, -17.0467, -1.93018, 20.386, n.a., 3.576454290517, 7.2601573, 2.87865062660956, 29.5564455, 127.4189,/T, 12.8435, 71.620, 243.508, 31.683656,-39.032948, + 2024-Oct-02 00:00, 2460585.500000000, , , 318.18236, -17.60396, -16.1951, -1.68027, 20.402, n.a., 3.580637434858, 7.2271565, 2.89580439250246, 29.8450594, 126.3266,/T, 13.0125, 71.711, 243.562, 31.618228,-38.933688, + 2024-Oct-03 00:00, 2460586.500000000, , , 318.07205, -17.61416, -15.3461, -1.43313, 20.417, n.a., 3.584801537451, 7.1942244, 2.91312203515841, 30.1239267, 125.2396,/T, 13.1755, 71.798, 243.612, 31.557488,-38.839127, + 2024-Oct-04 00:00, 2460587.500000000, , , 317.96766, -17.62272, -14.5004, -1.18883, 20.432, n.a., 3.588946637960, 7.1613604, 2.93059791015383, 30.3929972, 124.1579,/T, 13.3326, 71.881, 243.659, 31.501386,-38.749253, + 2024-Oct-05 00:00, 2460588.500000000, , , 317.86917, -17.62968, -13.6587, -0.94745, 20.447, n.a., 3.593072775750, 7.1285640, 2.94822634978532, 30.6522407, 123.0814,/T, 13.4836, 71.959, 243.704, 31.449869,-38.664052, + 2024-Oct-06 00:00, 2460589.500000000, , , 317.77655, -17.63504, -12.8214, -0.70905, 20.463, n.a., 3.597179989884, 7.0958347, 2.96600167454008, 30.9016466, 122.0101,/T, 13.6287, 72.034, 243.745, 31.402884,-38.583507, + 2024-Oct-07 00:00, 2460590.500000000, , , 317.68978, -17.63884, -11.9892, -0.47371, 20.478, n.a., 3.601268319129, 7.0631720, 2.98391820474236, 31.1412249, 120.9441,/T, 13.7680, 72.105, 243.784, 31.360376,-38.507595, + 2024-Oct-08 00:00, 2460591.500000000, , , 317.60880, -17.64109, -11.1627, -0.24149, 20.493, n.a., 3.605337801956, 7.0305754, 3.00197027229463, 31.3710058, 119.8832,/T, 13.9013, 72.172, 243.820, 31.322290,-38.436292, + 2024-Oct-09 00:00, 2460592.500000000, , , 317.53359, -17.64181, -10.3425, -0.01243, 20.509, n.a., 3.609388476546, 6.9980444, 3.02015223273410, 31.5910412, 118.8275,/T, 14.0289, 72.236, 243.853, 31.288571,-38.369567, + 2024-Oct-10 00:00, 2460593.500000000, , , 317.46410, -17.64102, -9.52890, 0.213405, 20.524, n.a., 3.613420380787, 6.9655784, 3.03845847824449, 31.8014068, 117.7768,/T, 14.1507, 72.296, 243.883, 31.259162,-38.307390, + 2024-Oct-11 00:00, 2460594.500000000, , , 317.40027, -17.63875, -8.72255, 0.435966, 20.539, n.a., 3.617433552280, 6.9331771, 3.05688345266062, 32.0022066, 116.7313,/T, 14.2668, 72.353, 243.911, 31.234007,-38.249723, + 2024-Oct-12 00:00, 2460595.500000000, , , 317.34207, -17.63501, -7.92389, 0.655211, 20.554, n.a., 3.621428028337, 6.9008398, 3.07542166965788, 32.1935796, 115.6908,/T, 14.3772, 72.407, 243.936, 31.213048,-38.196529, + 2024-Oct-13 00:00, 2460596.500000000, , , 317.28942, -17.62983, -7.13332, 0.871104, 20.570, n.a., 3.625403845987, 6.8685662, 3.09406773488878, 32.3757064, 114.6552,/T, 14.4820, 72.458, 243.959, 31.196226,-38.147766, + 2024-Oct-14 00:00, 2460597.500000000, , , 317.24228, -17.62324, -6.35119, 1.083629, 20.585, n.a., 3.629361041977, 6.8363557, 3.11281637140458, 32.5488131, 113.6246,/T, 14.5812, 72.505, 243.979, 31.183485,-38.103390, + 2024-Oct-15 00:00, 2460598.500000000, , , 317.20058, -17.61525, -5.57775, 1.292795, 20.600, n.a., 3.633299652770, 6.8042079, 3.13166244504940, 32.7131663, 112.5988,/T, 14.6750, 72.550, 243.997, 31.174766,-38.063355, +$$EOE +******************************************************************************************************************************************************************************************************************************************** +Column meaning: + +TIME + + Times PRIOR to 1962 are UT1, a mean-solar time closely related to the +prior but now-deprecated GMT. Times AFTER 1962 are in UTC, the current +civil or "wall-clock" time-scale. UTC is kept within 0.9 seconds of UT1 +using integer leap-seconds for 1972 and later years. + + Conversion from the internal Barycentric Dynamical Time (TDB) of solar +system dynamics to the non-uniform civil UT time-scale requested for output +has not been determined for UTC times after the next July or January 1st. +Therefore, the last known leap-second is used as a constant over future +intervals. + + Time tags refer to the UT time-scale conversion from TDB on Earth +regardless of observer location within the solar system, although clock +rates may differ due to the local gravity field and no analog to "UT" +may be defined for that location. + + Any 'b' symbol in the 1st-column denotes a B.C. date. First-column blank +(" ") denotes an A.D. date. + +CALENDAR SYSTEM + + Mixed calendar mode was active such that calendar dates after AD 1582-Oct-15 +(if any) are in the modern Gregorian system. Dates prior to 1582-Oct-5 (if any) +are in the Julian calendar system, which is automatically extended for dates +prior to its adoption on 45-Jan-1 BC. The Julian calendar is useful for +matching historical dates. The Gregorian calendar more accurately corresponds +to the Earth's orbital motion and seasons. A "Gregorian-only" calendar mode is +available if such physical events are the primary interest. + + NOTE: "n.a." in output means quantity "not available" at the print-time. + + 'R.A._(ICRF), DEC_(ICRF),' = + Astrometric right ascension and declination of the target center with +respect to the observing site (coordinate origin) in the reference frame of +the planetary ephemeris (ICRF). Compensated for down-leg light-time delay +aberration. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees, sdd.fffff{ffff} + + 'dRA*cosD, d(DEC)/dt,' = + The angular rate of change in aparent RA and DEC of the target. This is +with respect to the non-inertial IAU76/80 Earth true equator and equinox +of-date reference frame. d(RA)/dt is multiplied by the cosine of declination +to provide a linear rate in the plane-of-sky. Units: ARCSECONDS PER HOUR + + 'T-mag, N-mag,' = + Comets' apparent visual total magnitude ("T-mag") and nuclear magnitude +("N-mag") using the standard IAU model: + + T-mag= M1 + 5*log10(delta) + k1*log10(r) + N-mag= M2 + 5*log10(delta) + k2*log10(r) + phcof*beta + + Units: MAGNITUDES + + 'r, rdot,' = + The Sun's apparent range ("r", light-time aberrated) and range-rate ("rdot") +relative to the target center, as seen by the observer. A positive "rdot" means +the target center was moving away from the Sun, negative means moving toward +the Sun. Units: AU and KM/S + + 'delta, deldot,' = + Apparent range ("delta", light-time aberrated) and range-rate ("delta-dot") +of the target center relative to the observer. A positive "deldot" means the +target center is moving away from the observer, negative indicates movement +toward the observer. Units: AU and KM/S + + 'S-O-T,/r,' = + Sun-Observer-Target apparent SOLAR ELONGATION ANGLE seen from the observers' +location at print-time. + + The '/r' column provides a code indicating the targets' apparent position +relative to the Sun in the observers' sky, as described below: + + Case A: For an observing location on the surface of a rotating body, that +body rotational sense is considered: + + /T indicates target TRAILS Sun (evening sky: rises and sets AFTER Sun) + /L indicates target LEADS Sun (morning sky: rises and sets BEFORE Sun) + + Case B: For an observing point that does not have a rotational model (such +as a spacecraft), the "leading" and "trailing" condition is defined by the +observers' heliocentric ORBITAL motion: + + * If continuing in the observers' current direction of heliocentric + motion would encounter the targets' apparent longitude first, followed + by the Sun's, the target LEADS the Sun as seen by the observer. + + * If the Sun's apparent longitude would be encountered first, followed + by the targets', the target TRAILS the Sun. + + Two other codes can be output: + /* indicates observer is Sun-centered (undefined) + /? Target is aligned with Sun center (no lead or trail) + + The S-O-T solar elongation angle is numerically the minimum separation +angle of the Sun and target in the sky in any direction. It does NOT indicate +the amount of separation in the leading or trailing directions, which would +be defined along the equator of a spherical coordinate system. + + Units: DEGREES + + 'S-T-O,' = + The Sun-Target-Observer angle; the interior vertex angle at target center +formed by a vector from the target to the apparent center of the Sun (at +reflection time on the target) and the apparent vector from target to the +observer at print-time. Slightly different from true PHASE ANGLE (requestable +separately) at the few arcsecond level in that it includes stellar aberration +on the down-leg from target to observer. Units: DEGREES + + 'PsAng, PsAMV,' = + The position angles of the extended Sun-to-target radius vector ("PsAng") +and the negative of the targets' heliocentric velocity vector ("PsAMV"), as +seen in the observers' plane-of-sky, measured counter-clockwise (east) from +reference-frame north-pole. Primarily intended for ACTIVE COMETS, "PsAng" +is an indicator of the comets' gas-tail orientation in the sky (being in the +anti-sunward direction) while "PsAMV" is an indicator of dust-tail orientation. +Units: DEGREES + + 'GlxLon, GlxLat,' = + Observer-centered Galactic System II (post WW II) longitude and latitude +of the target centers' apparent position, with light-time, gravitational +deflection of light, and stellar aberrations. Units: DEGREES + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/hrzn_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Author : Jon.D.Giorgini@jpl.nasa.gov + +******************************************************************************************************************************************************************************************************************************************** diff --git a/sbpy/data/tests/data/TestEphemerisCLI-2p-miriade.txt b/sbpy/data/tests/data/TestEphemerisCLI-2p-miriade.txt new file mode 100644 index 000000000..88da4d40f --- /dev/null +++ b/sbpy/data/tests/data/TestEphemerisCLI-2p-miriade.txt @@ -0,0 +1,123 @@ + + + + + + +Miriade - Positional ephemeris + +Positional ephemeris + + + + + + + + + + + + + +Name or designation of the target + + +Julian day (UTC) + + +Right ascension of target centre + + +Declination of target centre + + +Distance from observer + + +Apparent visual magnitude + + +Phase angle + + +Solar elongation + + +Rate of change of target center RA (multiplied by the cosine of the declination) + + +Rate of change of target center DE + + +Rate of change of target distance from observer + + + +2P 2460538.5000000000021 57 13.24921-15 07 24.0954 2.351652518 19.85 1.15176.18-0.76545E+00-0.22522E+00 7.7912170 +2P 2460539.5000000000021 55 57.20239-15 12 46.6437 2.356319023 19.86 0.89177.05-0.76356E+00-0.22273E+00 8.3689102 +2P 2460540.5000000000021 54 41.33882-15 18 5.4862 2.361319030 19.86 0.74177.53-0.76112E+00-0.22007E+00 8.9460836 +2P 2460541.5000000000021 53 25.71289-15 23 20.3861 2.366652158 19.87 0.78177.40-0.75815E+00-0.21725E+00 9.5224699 +2P 2460542.5000000000021 52 10.37805-15 28 31.1187 2.372317893 19.88 0.98176.73-0.75464E+00-0.21429E+00 10.0978690 +2P 2460543.5000000000021 50 55.38688-15 33 37.4701 2.378315617 19.89 1.26175.78-0.75062E+00-0.21117E+00 10.6721296 +2P 2460544.5000000000021 49 40.79134-15 38 39.2364 2.384644636 19.90 1.58174.69-0.74609E+00-0.20792E+00 11.2451144 +2P 2460545.5000000000021 48 26.64285-15 43 36.2216 2.391304167 19.91 1.92173.53-0.74105E+00-0.20453E+00 11.8166596 +2P 2460546.5000000000021 47 12.99256-15 48 28.2368 2.398293318 19.92 2.27172.34-0.73550E+00-0.20101E+00 12.3865427 +2P 2460547.5000000000021 45 59.89134-15 53 15.0990 2.405611047 19.93 2.62171.13-0.72945E+00-0.19737E+00 12.9544687 +2P 2460548.5000000000021 44 47.38972-15 57 56.6318 2.413256124 19.94 2.97169.91-0.72291E+00-0.19361E+00 13.5200752 +2P 2460549.5000000000021 43 35.53778-16 02 32.6654 2.421227090 19.95 3.33168.68-0.71588E+00-0.18974E+00 14.0829483 +2P 2460550.5000000000021 42 24.38497-16 07 3.0371 2.429522240 19.96 3.68167.45-0.70837E+00-0.18575E+00 14.6426419 +2P 2460551.5000000000021 41 13.97986-16 11 27.5930 2.438139604 19.97 4.03166.21-0.70039E+00-0.18166E+00 15.1986944 +2P 2460552.5000000000021 40 4.36999-16 15 46.1879 2.447076947 19.98 4.37164.98-0.69195E+00-0.17747E+00 15.7506409 +2P 2460553.5000000000021 38 55.60170-16 19 58.6863 2.456331763 19.99 4.72163.74-0.68306E+00-0.17319E+00 16.2980217 +2P 2460554.5000000000021 37 47.71991-16 24 4.9628 2.465901285 20.00 5.06162.51-0.67374E+00-0.16883E+00 16.8403884 +2P 2460555.5000000000021 36 40.76807-16 28 4.9027 2.475782492 20.01 5.39161.28-0.66401E+00-0.16439E+00 17.3773079 +2P 2460556.5000000000021 35 34.78795-16 31 58.4023 2.485972118 20.03 5.72160.05-0.65388E+00-0.15989E+00 17.9083669 +2P 2460557.5000000000021 34 29.81959-16 35 45.3685 2.496466664 20.04 6.05158.82-0.64337E+00-0.15532E+00 18.4331748 +2P 2460558.5000000000021 33 25.90116-16 39 25.7199 2.507262414 20.05 6.37157.60-0.63250E+00-0.15070E+00 18.9513665 +2P 2460559.5000000000021 32 23.06895-16 42 59.3858 2.518355447 20.06 6.69156.38-0.62129E+00-0.14604E+00 19.4626031 +2P 2460560.5000000000021 31 21.35726-16 46 26.3067 2.529741656 20.08 7.01155.17-0.60977E+00-0.14133E+00 19.9665730 +2P 2460561.5000000000021 30 20.79839-16 49 46.4339 2.541416760 20.09 7.32153.95-0.59794E+00-0.13660E+00 20.4629906 +2P 2460562.5000000000021 29 21.42260-16 52 59.7294 2.553376321 20.10 7.62152.75-0.58583E+00-0.13185E+00 20.9515957 +2P 2460563.5000000000021 28 23.25810-16 56 6.1654 2.565615758 20.11 7.92151.54-0.57347E+00-0.12707E+00 21.4321532 +2P 2460564.5000000000021 27 26.33102-16 59 5.7242 2.578130362 20.13 8.21150.34-0.56086E+00-0.12229E+00 21.9044544 +2P 2460565.5000000000021 26 30.66540-17 01 58.3980 2.590915312 20.14 8.50149.15-0.54804E+00-0.11751E+00 22.3683207 +2P 2460566.5000000000021 25 36.28317-17 04 44.1886 2.603965693 20.16 8.78147.96-0.53503E+00-0.11274E+00 22.8236118 +2P 2460567.5000000000021 24 43.20413-17 07 23.1072 2.617276525 20.17 9.06146.77-0.52183E+00-0.10797E+00 23.2702355 +2P 2460568.5000000000021 23 51.44601-17 09 55.1739 2.630842788 20.18 9.33145.59-0.50849E+00-0.10322E+00 23.7081593 +2P 2460569.5000000000021 23 1.02449-17 12 20.4176 2.644659465 20.20 9.59144.42-0.49501E+00-0.98493E-01 24.1374188 +2P 2460570.5000000000021 22 11.95339-17 14 38.8743 2.658721579 20.21 9.85143.25-0.48140E+00-0.93794E-01 24.5581131 +2P 2460571.5000000000021 21 24.24489-17 16 50.5863 2.673024223 20.23 10.10142.08-0.46770E+00-0.89126E-01 24.9703837 +2P 2460572.5000000000021 20 37.90983-17 18 55.5999 2.687562573 20.24 10.35140.92-0.45390E+00-0.84491E-01 25.3743757 +2P 2460573.5000000000021 19 52.95799-17 20 53.9641 2.702331883 20.26 10.59139.77-0.44002E+00-0.79890E-01 25.7701923 +2P 2460574.5000000000021 19 9.39836-17 22 45.7286 2.717327442 20.27 10.83138.62-0.42606E+00-0.75325E-01 26.1578614 +2P 2460575.5000000000021 18 27.23922-17 24 30.9433 2.732544533 20.28 11.06137.48-0.41204E+00-0.70793E-01 26.5373254 +2P 2460576.5000000000021 17 46.48812-17 26 9.6579 2.747978382 20.30 11.28136.34-0.39795E+00-0.66296E-01 26.9084551 +2P 2460577.5000000000021 17 7.15185-17 27 41.9222 2.763624127 20.31 11.50135.20-0.38380E+00-0.61835E-01 27.2710764 +2P 2460578.5000000000021 16 29.23622-17 29 7.7870 2.779476800 20.33 11.71134.07-0.36961E+00-0.57408E-01 27.6249973 +2P 2460579.5000000000021 15 52.74605-17 30 27.3043 2.795531320 20.34 11.91132.95-0.35539E+00-0.53019E-01 27.9700279 +2P 2460580.5000000000021 15 17.68502-17 31 40.5276 2.811782500 20.36 12.11131.83-0.34114E+00-0.48667E-01 28.3059916 +2P 2460581.5000000000021 14 44.05561-17 32 47.5126 2.828225059 20.38 12.31130.72-0.32687E+00-0.44354E-01 28.6327298 +2P 2460582.5000000000021 14 11.85916-17 33 48.3169 2.844853625 20.39 12.49129.61-0.31261E+00-0.40083E-01 28.9501026 +2P 2460583.5000000000021 13 41.09576-17 34 43.0000 2.861662756 20.41 12.67128.51-0.29836E+00-0.35853E-01 29.2579885 +2P 2460584.5000000000021 13 11.76434-17 35 31.6237 2.878646940 20.42 12.85127.41-0.28412E+00-0.31667E-01 29.5562833 +2P 2460585.5000000000021 12 43.86264-17 36 14.2516 2.895800613 20.44 13.02126.32-0.26992E+00-0.27526E-01 29.8449003 +2P 2460586.5000000000021 12 17.38724-17 36 50.9492 2.913118164 20.45 13.18125.23-0.25577E+00-0.23431E-01 30.1237707 +2P 2460587.5000000000021 11 52.33358-17 37 21.7840 2.930593949 20.47 13.34124.15-0.24167E+00-0.19383E-01 30.3928443 +2P 2460588.5000000000021 11 28.69597-17 37 46.8251 2.948222301 20.48 13.49123.07-0.22763E+00-0.15384E-01 30.6520908 +2P 2460589.5000000000021 11 6.46766-17 38 6.1434 2.965997540 20.50 13.63122.00-0.21367E+00-0.11435E-01 30.9014998 +2P 2460590.5000000000021 10 45.64084-17 38 19.8113 2.983913986 20.51 13.77120.94-0.19980E+00-0.75365E-02 31.1410811 +2P 2460591.5000000000021 10 26.20670-17 38 27.9029 3.001965971 20.53 13.91119.88-0.18602E+00-0.36900E-02 31.3708650 +2P 2460592.5000000000021 10 8.15546-17 38 30.4933 3.020147851 20.55 14.03118.82-0.17234E+00 0.10375E-03 31.5909034 +2P 2460593.5000000000021 09 51.47641-17 38 27.6592 3.038454017 20.56 14.16117.77-0.15878E+00 0.38439E-02 31.8012719 +2P 2460594.5000000000021 09 36.15795-17 38 19.4783 3.056878914 20.58 14.27116.72-0.14533E+00 0.75297E-02 32.0020747 +2P 2460595.5000000000021 09 22.18766-17 38 6.0294 3.075417055 20.59 14.38115.68-0.13202E+00 0.11160E-01 32.1934506 +2P 2460596.5000000000021 09 9.55234-17 37 47.3925 3.094063047 20.61 14.49114.65-0.11883E+00 0.14735E-01 32.3755803 +2P 2460597.5000000000021 08 58.23811-17 37 23.6479 3.112811611 20.62 14.59113.62-0.10579E+00 0.18254E-01 32.5486899 +2P 2460598.5000000000021 08 48.23056-17 36 54.8761 3.131657614 20.64 14.68112.59-0.92899E-01 0.21717E-01 32.7130459 + + + + + + diff --git a/sbpy/data/tests/data/TestEphemerisCLI-2p-mpc.txt b/sbpy/data/tests/data/TestEphemerisCLI-2p-mpc.txt new file mode 100644 index 000000000..f645a1d47 --- /dev/null +++ b/sbpy/data/tests/data/TestEphemerisCLI-2p-mpc.txt @@ -0,0 +1,111 @@ + + + + + Minor Planet Ephemeris Service: Query Results + + +

Minor Planet Ephemeris Service: Query Results

+ Below are the results of your request from the Minor Planet Center's + Minor Planet Ephemeris Service. +

+ Newly designated objects may take up to 1 day to show up in this service. +

+

+ Orbits and ephemerides of unnumbered NEOs are up-to-date. Other orbits are in + the process of being refreshed. +

+

+ The current system is not completely reliable in the case of objects + with very-close approaches with the Earth. +

We are working on a completely new system, + but for the time being we encourage the users to double check + the results with other ephemeris generators when the object is very close to + Earth. +

+ Ephemerides are for + the geocenter. +


+ 2P/Encke +

Perturbed ephemeris below is based on + unperturbed elements from +MPEC 2024-R10. +

+

+0002P
+Date       UT      R.A. (J2000) Decl.    Delta     r     El.    Ph.   m1     Sky Motion
+            h m s                                                            "/hr     P.A.
+2024 08 16 000000 21 57 13.1 -15 07 25   2.352   3.363  176.2   1.1  21.2   47.87    253.6
+2024 08 17 000000 21 55 57.1 -15 12 47   2.356   3.368  177.1   0.9  21.1   47.72    253.7
+2024 08 18 000000 21 54 41.2 -15 18 06   2.361   3.373  177.5   0.7  21.1   47.54    253.9
+2024 08 19 000000 21 53 25.6 -15 23 21   2.367   3.378  177.4   0.8  21.1   47.32    254.0
+2024 08 20 000000 21 52 10.3 -15 28 32   2.372   3.383  176.7   1.0  21.2   47.07    254.1
+2024 08 21 000000 21 50 55.3 -15 33 38   2.378   3.388  175.8   1.3  21.2   46.79    254.3
+2024 08 22 000000 21 49 40.7 -15 38 40   2.385   3.393  174.7   1.6  21.2   46.47    254.4
+2024 08 23 000000 21 48 26.5 -15 43 37   2.391   3.398  173.5   1.9  21.3   46.13    254.6
+2024 08 24 000000 21 47 12.9 -15 48 29   2.398   3.403  172.3   2.3  21.3   45.75    254.7
+2024 08 25 000000 21 45 59.8 -15 53 16   2.406   3.408  171.1   2.6  21.3   45.34    254.9
+2024 08 26 000000 21 44 47.3 -15 57 57   2.413   3.413  169.9   3.0  21.4   44.90    255.0
+2024 08 27 000000 21 43 35.4 -16 02 33   2.421   3.418  168.7   3.3  21.4   44.44    255.2
+2024 08 28 000000 21 42 24.3 -16 07 04   2.430   3.423  167.4   3.7  21.4   43.94    255.3
+2024 08 29 000000 21 41 13.9 -16 11 28   2.438   3.427  166.2   4.0  21.5   43.41    255.5
+2024 08 30 000000 21 40 04.3 -16 15 47   2.447   3.432  165.0   4.4  21.5   42.86    255.6
+2024 08 31 000000 21 38 55.5 -16 19 59   2.456   3.437  163.7   4.7  21.5   42.28    255.8
+2024 09 01 000000 21 37 47.6 -16 24 06   2.466   3.442  162.5   5.1  21.5   41.67    255.9
+2024 09 02 000000 21 36 40.7 -16 28 05   2.476   3.447  161.3   5.4  21.5   41.04    256.1
+2024 09 03 000000 21 35 34.7 -16 31 59   2.486   3.451  160.0   5.7  21.5   40.39    256.3
+2024 09 04 000000 21 34 29.7 -16 35 46   2.496   3.456  158.8   6.1  21.6   39.71    256.4
+2024 09 05 000000 21 33 25.8 -16 39 26   2.507   3.461  157.6   6.4  21.6   39.01    256.6
+2024 09 06 000000 21 32 23.0 -16 43 00   2.518   3.466  156.4   6.7  21.6   38.29    256.8
+2024 09 07 000000 21 31 21.3 -16 46 27   2.530   3.470  155.2   7.0  21.6   37.56    257.0
+2024 09 08 000000 21 30 20.7 -16 49 47   2.541   3.475  154.0   7.3  21.6   36.80    257.1
+2024 09 09 000000 21 29 21.3 -16 53 00   2.553   3.480  152.7   7.6  21.7   36.03    257.3
+2024 09 10 000000 21 28 23.2 -16 56 07   2.566   3.484  151.5   7.9  21.7   35.24    257.5
+2024 09 11 000000 21 27 26.2 -16 59 06   2.578   3.489  150.3   8.2  21.7   34.44    257.7
+2024 09 12 000000 21 26 30.6 -17 01 59   2.591   3.493  149.1   8.5  21.7   33.63    257.9
+2024 09 13 000000 21 25 36.2 -17 04 45   2.604   3.498  148.0   8.8  21.7   32.81    258.1
+2024 09 14 000000 21 24 43.1 -17 07 24   2.617   3.502  146.8   9.1  21.8   31.97    258.3
+2024 09 15 000000 21 23 51.4 -17 09 56   2.631   3.507  145.6   9.3  21.8   31.13    258.5
+2024 09 16 000000 21 23 00.9 -17 12 21   2.645   3.511  144.4   9.6  21.8   30.28    258.7
+2024 09 17 000000 21 22 11.9 -17 14 39   2.659   3.516  143.2   9.8  21.8   29.43    259.0
+2024 09 18 000000 21 21 24.2 -17 16 51   2.673   3.520  142.1  10.1  21.8   28.57    259.2
+2024 09 19 000000 21 20 37.8 -17 18 56   2.688   3.525  140.9  10.3  21.9   27.70    259.5
+2024 09 20 000000 21 19 52.9 -17 20 54   2.702   3.529  139.8  10.6  21.9   26.83    259.7
+2024 09 21 000000 21 19 09.3 -17 22 46   2.717   3.534  138.6  10.8  21.9   25.96    260.0
+2024 09 22 000000 21 18 27.2 -17 24 31   2.733   3.538  137.5  11.1  21.9   25.08    260.3
+2024 09 23 000000 21 17 46.4 -17 26 10   2.748   3.542  136.3  11.3  21.9   24.21    260.5
+2024 09 24 000000 21 17 07.1 -17 27 42   2.764   3.547  135.2  11.5  22.0   23.33    260.8
+2024 09 25 000000 21 16 29.2 -17 29 08   2.779   3.551  134.1  11.7  22.0   22.44    261.2
+2024 09 26 000000 21 15 52.7 -17 30 28   2.796   3.555  132.9  11.9  22.0   21.56    261.5
+2024 09 27 000000 21 15 17.6 -17 31 41   2.812   3.560  131.8  12.1  22.0   20.68    261.9
+2024 09 28 000000 21 14 44.0 -17 32 48   2.828   3.564  130.7  12.3  22.0   19.79    262.3
+2024 09 29 000000 21 14 11.8 -17 33 49   2.845   3.568  129.6  12.5  22.1   18.91    262.7
+2024 09 30 000000 21 13 41.0 -17 34 43   2.862   3.572  128.5  12.7  22.1   18.03    263.1
+2024 10 01 000000 21 13 11.7 -17 35 32   2.879   3.576  127.4  12.8  22.1   17.15    263.6
+2024 10 02 000000 21 12 43.8 -17 36 15   2.896   3.581  126.3  13.0  22.1   16.28    264.2
+2024 10 03 000000 21 12 17.3 -17 36 51   2.913   3.585  125.2  13.2  22.1   15.41    264.8
+2024 10 04 000000 21 11 52.3 -17 37 22   2.931   3.589  124.1  13.3  22.2   14.55    265.4
+2024 10 05 000000 21 11 28.6 -17 37 47   2.948   3.593  123.1  13.5  22.2   13.69    266.1
+2024 10 06 000000 21 11 06.4 -17 38 06   2.966   3.597  122.0  13.6  22.2   12.84    266.9
+2024 10 07 000000 21 10 45.6 -17 38 20   2.984   3.601  120.9  13.8  22.2   12.00    267.8
+2024 10 08 000000 21 10 26.1 -17 38 28   3.002   3.605  119.9  13.9  22.2   11.16    268.9
+2024 10 09 000000 21 10 08.1 -17 38 31   3.020   3.609  118.8  14.0  22.3   10.34    270.0
+2024 10 10 000000 21 09 51.4 -17 38 28   3.038   3.613  117.8  14.2  22.3    9.53    271.4
+2024 10 11 000000 21 09 36.1 -17 38 20   3.057   3.617  116.7  14.3  22.3    8.73    273.0
+2024 10 12 000000 21 09 22.1 -17 38 06   3.075   3.621  115.7  14.4  22.3    7.95    274.8
+2024 10 13 000000 21 09 09.5 -17 37 48   3.094   3.625  114.6  14.5  22.3    7.19    277.1
+2024 10 14 000000 21 08 58.2 -17 37 24   3.113   3.629  113.6  14.6  22.4    6.44    279.8
+2024 10 15 000000 21 08 48.2 -17 36 55   3.132   3.633  112.6  14.7  22.4    5.72    283.2
+
+


+ These calculations have been performed on the + Tamkin + Foundation Computing Network. +


+

+ Valid HTML 4.01! +

+ + diff --git a/sbpy/data/tests/data/TestEphemerisCLI-c1995o1-horizons.txt b/sbpy/data/tests/data/TestEphemerisCLI-c1995o1-horizons.txt new file mode 100644 index 000000000..884bd5108 --- /dev/null +++ b/sbpy/data/tests/data/TestEphemerisCLI-c1995o1-horizons.txt @@ -0,0 +1,283 @@ +API VERSION: 1.2 +API SOURCE: NASA/JPL Horizons API + +******************************************************************************* +JPL/HORIZONS Hale-Bopp (C/1995 O1) 2024-Aug-16 13:11:45 +Rec #:90002212 (+COV) Soln.date: 2022-Aug-01_01:56:46 # obs: 66 (1993-2022) + +IAU76/J2000 helio. ecliptic osc. elements (au, days, deg., period=Julian yrs): + + EPOCH= 2459837.5 ! 2022-Sep-15.0000000 (TDB) RMSW= n.a. + EC= .9949810027633206 QR= .890537663547794 TP= 2450537.1349071441 + OM= 282.7334213961641 W= 130.4146670659176 IN= 89.28759424740302 + A= 177.4333839117583 MA= 3.878386339423163 ADIST= 353.9762301599687 + PER= 2363.5304681429 N= .000417014 ANGMOM= .02292857 + DAN= 5.00538 DDN= 1.07996 L= 101.8968625 + B= 49.580132 MOID= .0878151 TP= 1997-Mar-29.6349071441 + +Comet physical (GM= km^3/s^2; RAD= km): + GM= n.a. RAD= 30. + M1= 4.8 M2= n.a. k1= 4. k2= n.a. PHCOF= n.a. +COMET comments +1: soln ref.= JPL#226, data arc: 1993-04-27 to 2022-07-09 +2: k1=4.; +******************************************************************************* + + +******************************************************************************* +Ephemeris / API_USER Fri Aug 16 13:11:45 2024 Pasadena, USA / Horizons +******************************************************************************* +Target body name: Hale-Bopp (C/1995 O1) {source: JPL#226} +Center body name: Earth (399) {source: DE441} +Center-site name: GEOCENTRIC +******************************************************************************* +Start time : A.D. 2024-Aug-16 00:00:00.0000 UT +Stop time : A.D. 2024-Oct-15 00:00:00.0000 UT +Step-size : 1440 minutes +******************************************************************************* +Target pole/equ : undefined +Target radii : 30. km +Center geodetic : 0.0, 0.0, -6378.137 {E-lon(deg),Lat(deg),Alt(km)} +Center cylindric: 0.0, 0.0, 0.0 {E-lon(deg),Dxy(km),Dz(km)} +Center pole/equ : ITRF93 {East-longitude positive} +Center radii : 6378.137, 6378.137, 6356.752 km {Equator_a, b, pole_c} +Target primary : Sun +Vis. interferer : MOON (R_eq= 1737.400) km {source: DE441} +Rel. light bend : Sun {source: DE441} +Rel. lght bnd GM: 1.3271E+11 km^3/s^2 +Small-body perts: Yes {source: SB441-N16} +Atmos refraction: NO (AIRLESS) +RA format : DEG +Time format : BOTH +Calendar mode : Mixed Julian/Gregorian +EOP file : eop.240815.p241108 +EOP coverage : DATA-BASED 1962-JAN-20 TO 2024-AUG-15. PREDICTS-> 2024-NOV-07 +Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s +Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) +Table cut-offs 2: Solar elongation ( 0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) +Table cut-offs 3: RA/DEC angular rate ( 0.0=NO ) +Table format : Comma Separated Values (spreadsheet) +******************************************************************************* +Initial IAU76/J2000 heliocentric ecliptic osculating elements (au, days, deg.): + EPOCH= 2459837.5 ! 2022-Sep-15.0000000 (TDB) RMSW= n.a. + EC= .9949810027633206 QR= .890537663547794 TP= 2450537.1349071441 + OM= 282.7334213961641 W= 130.4146670659176 IN= 89.28759424740302 + Equivalent ICRF heliocentric cartesian coordinates (au, au/d): + X= 3.907631452214869E+00 Y=-1.373895334060347E+00 Z=-4.624358508575312E+01 + VX= 3.778244409519935E-04 VY=-5.803173067116371E-04 VZ=-3.255716412104052E-03 +Comet physical (GM= km^3/s^2; RAD= km): + GM= n.a. RAD= 30. + M1= 4.8 M2= n.a. k1= 4. k2= n.a. PHCOF= n.a. +******************************************************************************************************************************************************************************************************************************************** + Date__(UT)__HR:MN, Date_________JDUT, , , R.A._(ICRF), DEC_(ICRF), dRA*cosD, d(DEC)/dt, T-mag, N-mag, r, rdot, delta, deldot, S-O-T,/r, S-T-O, PsAng, PsAMV, GlxLon, GlxLat, +******************************************************************************************************************************************************************************************************************************************** +$$SOE + 2024-Aug-16 00:00, 2460538.500000000, , , 339.94076, -85.76646, -2.77385, -0.95007, 19.974, n.a., 48.70398705476, 5.5481506, 48.3840175329577, 14.3142929, 107.8545,/L, 1.1334, 345.385, 125.938, 305.601288,-30.660941, + 2024-Aug-17 00:00, 2460539.500000000, , , 339.68838, -85.77237, -2.78898, -0.89086, 19.974, n.a., 48.70719116755, 5.5479480, 48.3923308961369, 14.4742785, 107.5528,/L, 1.1350, 346.601, 126.285, 305.615209,-30.645503, + 2024-Aug-18 00:00, 2460540.500000000, , , 339.43441, -85.77787, -2.80292, -0.83127, 19.975, n.a., 48.71039516167, 5.5477455, 48.4007359344561, 14.6317701, 107.2462,/L, 1.1366, 347.815, 126.633, 305.629399,-30.630285, + 2024-Aug-19 00:00, 2460541.500000000, , , 339.17897, -85.78297, -2.81568, -0.77129, 19.975, n.a., 48.71359903713, 5.5475429, 48.4092312233878, 14.7868250, 106.9346,/L, 1.1382, 349.028, 126.982, 305.643857,-30.615293, + 2024-Aug-20 00:00, 2460542.500000000, , , 338.92218, -85.78767, -2.82727, -0.71097, 19.976, n.a., 48.71680279399, 5.5473404, 48.4178153742781, 14.9395076, 106.6182,/L, 1.1398, 350.239, 127.330, 305.658577,-30.600529, + 2024-Aug-21 00:00, 2460543.500000000, , , 338.66419, -85.79196, -2.83768, -0.65029, 19.976, n.a., 48.72000643227, 5.5471379, 48.4264870339100, 15.0898732, 106.2971,/L, 1.1414, 351.449, 127.679, 305.673556,-30.585998, + 2024-Aug-22 00:00, 2460544.500000000, , , 338.40511, -85.79584, -2.84691, -0.58926, 19.977, n.a., 48.72320995201, 5.5469354, 48.4352448737881, 15.2379494, 105.9713,/L, 1.1430, 352.656, 128.027, 305.688790,-30.571703, + 2024-Aug-23 00:00, 2460545.500000000, , , 338.14510, -85.79931, -2.85492, -0.52790, 19.977, n.a., 48.72641335325, 5.5467329, 48.4440875702588, 15.3837240, 105.6409,/L, 1.1446, 353.862, 128.376, 305.704276,-30.557649, + 2024-Aug-24 00:00, 2460546.500000000, , , 337.88427, -85.80236, -2.86171, -0.46621, 19.978, n.a., 48.72961663603, 5.5465305, 48.4530137800802, 15.5271418, 105.3061,/L, 1.1461, 355.065, 128.723, 305.720009,-30.543838, + 2024-Aug-25 00:00, 2460547.500000000, , , 337.62278, -85.80500, -2.86724, -0.40423, 19.978, n.a., 48.73281980038, 5.5463281, 48.4620221173881, 15.6681122, 104.9669,/L, 1.1477, 356.267, 129.071, 305.735987,-30.530276, + 2024-Aug-26 00:00, 2460548.500000000, , , 337.36077, -85.80723, -2.87149, -0.34197, 19.979, n.a., 48.73602284634, 5.5461257, 48.4711111365470, 15.8065210, 104.6235,/L, 1.1492, 357.466, 129.417, 305.752205,-30.516965, + 2024-Aug-27 00:00, 2460549.500000000, , , 337.09838, -85.80903, -2.87443, -0.27948, 19.979, n.a., 48.73922577397, 5.5459233, 48.4802793224628, 15.9422438, 104.2758,/L, 1.1507, 358.662, 129.763, 305.768658,-30.503911, + 2024-Aug-28 00:00, 2460550.500000000, , , 336.83575, -85.81041, -2.87604, -0.21679, 19.980, n.a., 48.74242858331, 5.5457210, 48.4895250874486, 16.0751550, 103.9241,/L, 1.1521, 359.857, 130.107, 305.785344,-30.491118, + 2024-Aug-29 00:00, 2460551.500000000, , , 336.57305, -85.81138, -2.87631, -0.15395, 19.980, n.a., 48.74563127441, 5.5455187, 48.4988467726150, 16.2051343, 103.5684,/T, 1.1536, 1.049, 130.450, 305.802257,-30.478588, + 2024-Aug-30 00:00, 2460552.500000000, , , 336.31042, -85.81192, -2.87522, -0.09099, 19.981, n.a., 48.74883384734, 5.5453165, 48.5082426518212, 16.3320694, 103.2088,/T, 1.1550, 2.238, 130.792, 305.819393,-30.466328, + 2024-Aug-31 00:00, 2460553.500000000, , , 336.04801, -85.81203, -2.87277, -0.02797, 19.981, n.a., 48.75203630214, 5.5451143, 48.5177109368424, 16.4558577, 102.8454,/T, 1.1563, 3.424, 131.132, 305.836747,-30.454340, + 2024-Sep-01 00:00, 2460554.500000000, , , 335.78598, -85.81173, -2.86895, 0.035077, 19.982, n.a., 48.75523863888, 5.5449122, 48.5272497830553, 16.5764066, 102.4784,/T, 1.1577, 4.608, 131.470, 305.854314,-30.442628, + 2024-Sep-02 00:00, 2460555.500000000, , , 335.52448, -85.81100, -2.86376, 0.098099, 19.983, n.a., 48.75844085763, 5.5447101, 48.5368572953757, 16.6936341, 102.1078,/T, 1.1590, 5.789, 131.806, 305.872090,-30.431197, + 2024-Sep-03 00:00, 2460556.500000000, , , 335.26366, -85.80985, -2.85720, 0.161051, 19.983, n.a., 48.76164295846, 5.5445081, 48.5465315343617, 16.8074686, 101.7337,/T, 1.1602, 6.967, 132.140, 305.890069,-30.420049, + 2024-Sep-04 00:00, 2460557.500000000, , , 335.00367, -85.80828, -2.84928, 0.223886, 19.984, n.a., 48.76484494143, 5.5443061, 48.5562705223968, 16.9178494, 101.3563,/T, 1.1614, 8.141, 132.471, 305.908245,-30.409188, + 2024-Sep-05 00:00, 2460558.500000000, , , 334.74467, -85.80629, -2.84001, 0.286561, 19.984, n.a., 48.76804680662, 5.5441042, 48.5660722497966, 17.0247260, 100.9757,/T, 1.1626, 9.312, 132.800, 305.926615,-30.398617, + 2024-Sep-06 00:00, 2460559.500000000, , , 334.48680, -85.80389, -2.82939, 0.349028, 19.985, n.a., 48.77124855410, 5.5439024, 48.5759346806325, 17.1280580, 100.5919,/T, 1.1638, 10.480, 133.127, 305.945172,-30.388340, + 2024-Sep-07 00:00, 2460560.500000000, , , 334.23021, -85.80106, -2.81745, 0.411245, 19.985, n.a., 48.77445018395, 5.5437006, 48.5858557580899, 17.2278134, 100.2051,/T, 1.1648, 11.645, 133.450, 305.963910,-30.378360, + 2024-Sep-08 00:00, 2460561.500000000, , , 333.97504, -85.79782, -2.80420, 0.473167, 19.986, n.a., 48.77765169624, 5.5434989, 48.5958334092954, 17.3239683, 99.8154,/T, 1.1659, 12.806, 133.770, 305.982826,-30.368679, + 2024-Sep-09 00:00, 2460562.500000000, , , 333.72143, -85.79417, -2.78965, 0.534752, 19.986, n.a., 48.78085309104, 5.5432972, 48.6058655497306, 17.4165062, 99.4229,/T, 1.1669, 13.964, 134.088, 306.001912,-30.359301, + 2024-Sep-10 00:00, 2460563.500000000, , , 333.46954, -85.79011, -2.77383, 0.595961, 19.987, n.a., 48.78405436842, 5.5430956, 48.6159500875566, 17.5054185, 99.0277,/T, 1.1678, 15.117, 134.401, 306.021163,-30.350227, + 2024-Sep-11 00:00, 2460564.500000000, , , 333.21948, -85.78564, -2.75675, 0.656754, 19.988, n.a., 48.78725552845, 5.5428940, 48.6260849283667, 17.5907052, 98.6298,/T, 1.1687, 16.268, 134.712, 306.040574,-30.341461, + 2024-Sep-12 00:00, 2460565.500000000, , , 332.97139, -85.78077, -2.73846, 0.717094, 19.988, n.a., 48.79045657120, 5.5426925, 48.6362679809981, 17.6723780, 98.2295,/T, 1.1695, 17.414, 135.018, 306.060139,-30.333004, + 2024-Sep-13 00:00, 2460566.500000000, , , 332.72541, -85.77550, -2.71896, 0.776949, 19.989, n.a., 48.79365749673, 5.5424910, 48.6464971649951, 17.7504629, 97.8267,/T, 1.1703, 18.557, 135.321, 306.079853,-30.324858, + 2024-Sep-14 00:00, 2460567.500000000, , , 332.48166, -85.76983, -2.69830, 0.836289, 19.989, n.a., 48.79685830508, 5.5422895, 48.6567704199900, 17.8250038, 97.4216,/T, 1.1711, 19.696, 135.620, 306.099710,-30.317026, + 2024-Sep-15 00:00, 2460568.500000000, , , 332.24025, -85.76377, -2.67651, 0.895091, 19.990, n.a., 48.80005899632, 5.5420881, 48.6670857164922, 17.8960637, 97.0144,/T, 1.1717, 20.831, 135.914, 306.119704,-30.309510, + 2024-Sep-16 00:00, 2460569.500000000, , , 332.00131, -85.75732, -2.65361, 0.953341, 19.990, n.a., 48.80325957049, 5.5418867, 48.6774410662775, 17.9637215, 96.6050,/T, 1.1724, 21.962, 136.204, 306.139830,-30.302310, + 2024-Sep-17 00:00, 2460570.500000000, , , 331.76494, -85.75049, -2.62963, 1.011031, 19.991, n.a., 48.80646002763, 5.5416853, 48.6878345290444, 18.0280619, 96.1936,/T, 1.1729, 23.089, 136.490, 306.160083,-30.295430, + 2024-Sep-18 00:00, 2460571.500000000, , , 331.53126, -85.74327, -2.60460, 1.068160, 19.992, n.a., 48.80966036778, 5.5414839, 48.6982642111620, 18.0891585, 95.7803,/T, 1.1734, 24.213, 136.772, 306.180458,-30.288869, + 2024-Sep-19 00:00, 2460572.500000000, , , 331.30037, -85.73567, -2.57852, 1.124726, 19.992, n.a., 48.81286059098, 5.5412824, 48.7087282534616, 18.1470540, 95.3651,/T, 1.1739, 25.332, 137.048, 306.200948,-30.282631, + 2024-Sep-20 00:00, 2460573.500000000, , , 331.07237, -85.72771, -2.55142, 1.180728, 19.993, n.a., 48.81606069726, 5.5410810, 48.7192248086170, 18.2017451, 94.9482,/T, 1.1743, 26.448, 137.320, 306.221551,-30.276716, + 2024-Sep-21 00:00, 2460574.500000000, , , 330.84737, -85.71937, -2.52328, 1.236155, 19.993, n.a., 48.81926068666, 5.5408796, 48.7297520131740, 18.2531799, 94.5296,/T, 1.1746, 27.560, 137.587, 306.242259,-30.271126, + 2024-Sep-22 00:00, 2460575.500000000, , , 330.62545, -85.71067, -2.49411, 1.290990, 19.994, n.a., 48.82246055921, 5.5406782, 48.7403079617142, 18.3012674, 94.1095,/T, 1.1749, 28.667, 137.849, 306.263069,-30.265864, + 2024-Sep-23 00:00, 2460576.500000000, , , 330.40673, -85.70160, -2.46391, 1.345210, 19.995, n.a., 48.82566031494, 5.5404768, 48.7508906892172, 18.3458952, 93.6878,/T, 1.1751, 29.772, 138.106, 306.283974,-30.260930, + 2024-Sep-24 00:00, 2460577.500000000, , , 330.19129, -85.69218, -2.43268, 1.398785, 19.995, n.a., 48.82885995389, 5.5402754, 48.7614981636654, 18.3869464, 93.2648,/T, 1.1752, 30.872, 138.358, 306.304970,-30.256328, + 2024-Sep-25 00:00, 2460578.500000000, , , 329.97923, -85.68241, -2.40044, 1.451686, 19.996, n.a., 48.83205947610, 5.5400739, 48.7721282871823, 18.4243112, 92.8404,/T, 1.1753, 31.968, 138.604, 306.326051,-30.252058, + 2024-Sep-26 00:00, 2460579.500000000, , , 329.77063, -85.67229, -2.36720, 1.503882, 19.996, n.a., 48.83525888161, 5.5398725, 48.7827789023065, 18.4578935, 92.4149,/T, 1.1753, 33.061, 138.844, 306.347212,-30.248123, + 2024-Sep-27 00:00, 2460580.500000000, , , 329.56559, -85.66183, -2.33298, 1.555342, 19.997, n.a., 48.83845817045, 5.5396711, 48.7934478002502, 18.4876118, 91.9883,/T, 1.1753, 34.150, 139.079, 306.368446,-30.244523, + 2024-Sep-28 00:00, 2460581.500000000, , , 329.36419, -85.65103, -2.29779, 1.606036, 19.997, n.a., 48.84165734269, 5.5394697, 48.8041327291393, 18.5133981, 91.5607,/T, 1.1752, 35.235, 139.309, 306.389747,-30.241262, + 2024-Sep-29 00:00, 2460582.500000000, , , 329.16651, -85.63990, -2.26167, 1.655936, 19.998, n.a., 48.84485639835, 5.5392683, 48.8148314013761, 18.5351963, 91.1323,/T, 1.1750, 36.316, 139.532, 306.411110,-30.238339, + 2024-Sep-30 00:00, 2460583.500000000, , , 328.97261, -85.62844, -2.22463, 1.705015, 19.999, n.a., 48.84805533749, 5.5390669, 48.8255415000383, 18.5529607, 90.7030,/T, 1.1748, 37.393, 139.750, 306.432529,-30.235756, + 2024-Oct-01 00:00, 2460584.500000000, , , 328.78259, -85.61666, -2.18671, 1.753245, 19.999, n.a., 48.85125416015, 5.5388655, 48.8362606845982, 18.5666553, 90.2731,/T, 1.1745, 38.467, 139.961, 306.453998,-30.233515, + 2024-Oct-02 00:00, 2460585.500000000, , , 328.59649, -85.60457, -2.14793, 1.800601, 20.000, n.a., 48.85445286639, 5.5386641, 48.8469865963240, 18.5762531, 89.8427,/T, 1.1741, 39.537, 140.166, 306.475509,-30.231616, + 2024-Oct-03 00:00, 2460586.500000000, , , 328.41439, -85.59217, -2.10833, 1.847060, 20.000, n.a., 48.85765145626, 5.5384628, 48.8577168636373, 18.5817365, 89.4118,/T, 1.1736, 40.603, 140.366, 306.497058,-30.230059, + 2024-Oct-04 00:00, 2460587.500000000, , , 328.23634, -85.57946, -2.06794, 1.892598, 20.001, n.a., 48.86084992982, 5.5382614, 48.8684491075486, 18.5830974, 88.9806,/T, 1.1731, 41.666, 140.558, 306.518637,-30.228846, + 2024-Oct-05 00:00, 2460588.500000000, , , 328.06240, -85.56646, -2.02679, 1.937196, 20.002, n.a., 48.86404828711, 5.5380601, 48.8791809471527, 18.5803374, 88.5491,/T, 1.1725, 42.725, 140.745, 306.540240,-30.227977, + 2024-Oct-06 00:00, 2460589.500000000, , , 327.89261, -85.55318, -1.98493, 1.980833, 20.002, n.a., 48.86724652819, 5.5378588, 48.8899100050949, 18.5734672, 88.1176,/T, 1.1719, 43.780, 140.925, 306.561862,-30.227453, + 2024-Oct-07 00:00, 2460590.500000000, , , 327.72702, -85.53960, -1.94238, 2.023495, 20.003, n.a., 48.87044465313, 5.5376576, 48.9006339129425, 18.5625068, 87.6860,/T, 1.1711, 44.832, 141.099, 306.583496,-30.227272, + 2024-Oct-08 00:00, 2460591.500000000, , , 327.56567, -85.52576, -1.89918, 2.065166, 20.003, n.a., 48.87364266197, 5.5374563, 48.9113503165065, 18.5474857, 87.2545,/T, 1.1704, 45.880, 141.266, 306.605135,-30.227436, + 2024-Oct-09 00:00, 2460592.500000000, , , 327.40859, -85.51164, -1.85539, 2.105837, 20.004, n.a., 48.87684055478, 5.5372551, 48.9220568813085, 18.5284428, 86.8233,/T, 1.1695, 46.925, 141.426, 306.626773,-30.227943, + 2024-Oct-10 00:00, 2460593.500000000, , , 327.25582, -85.49726, -1.81102, 2.145497, 20.005, n.a., 48.88003833162, 5.5370539, 48.9327512985250, 18.5054282, 86.3923,/T, 1.1686, 47.966, 141.580, 306.648404,-30.228794, + 2024-Oct-11 00:00, 2460594.500000000, , , 327.10737, -85.48262, -1.76612, 2.184144, 20.005, n.a., 48.88323599254, 5.5368527, 48.9434312917552, 18.4785044, 85.9618,/T, 1.1676, 49.004, 141.727, 306.670023,-30.229989, + 2024-Oct-12 00:00, 2460595.500000000, , , 326.96328, -85.46774, -1.72073, 2.221776, 20.006, n.a., 48.88643353760, 5.5366516, 48.9540946247641, 18.4477482, 85.5319,/T, 1.1666, 50.039, 141.868, 306.691622,-30.231525, + 2024-Oct-13 00:00, 2460596.500000000, , , 326.82356, -85.45261, -1.67489, 2.258399, 20.006, n.a., 48.88963096687, 5.5364505, 48.9647391097999, 18.4132506, 85.1026,/T, 1.1654, 51.071, 142.002, 306.713196,-30.233403, + 2024-Oct-14 00:00, 2460597.500000000, , , 326.68822, -85.43725, -1.62863, 2.294021, 20.007, n.a., 48.89282828039, 5.5362494, 48.9753626151231, 18.3751135, 84.6740,/T, 1.1643, 52.099, 142.129, 306.734739,-30.235622, + 2024-Oct-15 00:00, 2460598.500000000, , , 326.55727, -85.42166, -1.58197, 2.328660, 20.007, n.a., 48.89602547824, 5.5360484, 48.9859630691605, 18.3334414, 84.2462,/T, 1.1630, 53.125, 142.249, 306.756245,-30.238180, +$$EOE +******************************************************************************************************************************************************************************************************************************************** +Column meaning: + +TIME + + Times PRIOR to 1962 are UT1, a mean-solar time closely related to the +prior but now-deprecated GMT. Times AFTER 1962 are in UTC, the current +civil or "wall-clock" time-scale. UTC is kept within 0.9 seconds of UT1 +using integer leap-seconds for 1972 and later years. + + Conversion from the internal Barycentric Dynamical Time (TDB) of solar +system dynamics to the non-uniform civil UT time-scale requested for output +has not been determined for UTC times after the next July or January 1st. +Therefore, the last known leap-second is used as a constant over future +intervals. + + Time tags refer to the UT time-scale conversion from TDB on Earth +regardless of observer location within the solar system, although clock +rates may differ due to the local gravity field and no analog to "UT" +may be defined for that location. + + Any 'b' symbol in the 1st-column denotes a B.C. date. First-column blank +(" ") denotes an A.D. date. + +CALENDAR SYSTEM + + Mixed calendar mode was active such that calendar dates after AD 1582-Oct-15 +(if any) are in the modern Gregorian system. Dates prior to 1582-Oct-5 (if any) +are in the Julian calendar system, which is automatically extended for dates +prior to its adoption on 45-Jan-1 BC. The Julian calendar is useful for +matching historical dates. The Gregorian calendar more accurately corresponds +to the Earth's orbital motion and seasons. A "Gregorian-only" calendar mode is +available if such physical events are the primary interest. + + NOTE: "n.a." in output means quantity "not available" at the print-time. + + 'R.A._(ICRF), DEC_(ICRF),' = + Astrometric right ascension and declination of the target center with +respect to the observing site (coordinate origin) in the reference frame of +the planetary ephemeris (ICRF). Compensated for down-leg light-time delay +aberration. + + Units: RA in decimal degrees, ddd.fffff{ffff} + DEC in decimal degrees, sdd.fffff{ffff} + + 'dRA*cosD, d(DEC)/dt,' = + The angular rate of change in aparent RA and DEC of the target. This is +with respect to the non-inertial IAU76/80 Earth true equator and equinox +of-date reference frame. d(RA)/dt is multiplied by the cosine of declination +to provide a linear rate in the plane-of-sky. Units: ARCSECONDS PER HOUR + + 'T-mag, N-mag,' = + Comets' apparent visual total magnitude ("T-mag") and nuclear magnitude +("N-mag") using the standard IAU model: + + T-mag= M1 + 5*log10(delta) + k1*log10(r) + N-mag= M2 + 5*log10(delta) + k2*log10(r) + phcof*beta + + Units: MAGNITUDES + + 'r, rdot,' = + The Sun's apparent range ("r", light-time aberrated) and range-rate ("rdot") +relative to the target center, as seen by the observer. A positive "rdot" means +the target center was moving away from the Sun, negative means moving toward +the Sun. Units: AU and KM/S + + 'delta, deldot,' = + Apparent range ("delta", light-time aberrated) and range-rate ("delta-dot") +of the target center relative to the observer. A positive "deldot" means the +target center is moving away from the observer, negative indicates movement +toward the observer. Units: AU and KM/S + + 'S-O-T,/r,' = + Sun-Observer-Target apparent SOLAR ELONGATION ANGLE seen from the observers' +location at print-time. + + The '/r' column provides a code indicating the targets' apparent position +relative to the Sun in the observers' sky, as described below: + + Case A: For an observing location on the surface of a rotating body, that +body rotational sense is considered: + + /T indicates target TRAILS Sun (evening sky: rises and sets AFTER Sun) + /L indicates target LEADS Sun (morning sky: rises and sets BEFORE Sun) + + Case B: For an observing point that does not have a rotational model (such +as a spacecraft), the "leading" and "trailing" condition is defined by the +observers' heliocentric ORBITAL motion: + + * If continuing in the observers' current direction of heliocentric + motion would encounter the targets' apparent longitude first, followed + by the Sun's, the target LEADS the Sun as seen by the observer. + + * If the Sun's apparent longitude would be encountered first, followed + by the targets', the target TRAILS the Sun. + + Two other codes can be output: + /* indicates observer is Sun-centered (undefined) + /? Target is aligned with Sun center (no lead or trail) + + The S-O-T solar elongation angle is numerically the minimum separation +angle of the Sun and target in the sky in any direction. It does NOT indicate +the amount of separation in the leading or trailing directions, which would +be defined along the equator of a spherical coordinate system. + + Units: DEGREES + + 'S-T-O,' = + The Sun-Target-Observer angle; the interior vertex angle at target center +formed by a vector from the target to the apparent center of the Sun (at +reflection time on the target) and the apparent vector from target to the +observer at print-time. Slightly different from true PHASE ANGLE (requestable +separately) at the few arcsecond level in that it includes stellar aberration +on the down-leg from target to observer. Units: DEGREES + + 'PsAng, PsAMV,' = + The position angles of the extended Sun-to-target radius vector ("PsAng") +and the negative of the targets' heliocentric velocity vector ("PsAMV"), as +seen in the observers' plane-of-sky, measured counter-clockwise (east) from +reference-frame north-pole. Primarily intended for ACTIVE COMETS, "PsAng" +is an indicator of the comets' gas-tail orientation in the sky (being in the +anti-sunward direction) while "PsAMV" is an indicator of dust-tail orientation. +Units: DEGREES + + 'GlxLon, GlxLat,' = + Observer-centered Galactic System II (post WW II) longitude and latitude +of the target centers' apparent position, with light-time, gravitational +deflection of light, and stellar aberrations. Units: DEGREES + +Computations by ... + + Solar System Dynamics Group, Horizons On-Line Ephemeris System + 4800 Oak Grove Drive, Jet Propulsion Laboratory + Pasadena, CA 91109 USA + + General site: https://ssd.jpl.nasa.gov/ + Mailing list: https://ssd.jpl.nasa.gov/email_list.html + System news : https://ssd.jpl.nasa.gov/horizons/news.html + User Guide : https://ssd.jpl.nasa.gov/horizons/manual.html + Connect : browser https://ssd.jpl.nasa.gov/horizons/app.html#/x + API https://ssd-api.jpl.nasa.gov/doc/horizons.html + command-line telnet ssd.jpl.nasa.gov 6775 + e-mail/batch https://ssd.jpl.nasa.gov/ftp/ssd/hrzn_batch.txt + scripts https://ssd.jpl.nasa.gov/ftp/ssd/SCRIPTS + Author : Jon.D.Giorgini@jpl.nasa.gov + +******************************************************************************************************************************************************************************************************************************************** diff --git a/sbpy/data/tests/test_ephem.py b/sbpy/data/tests/test_ephem.py index 9c33dd72c..fbd9b68f8 100644 --- a/sbpy/data/tests/test_ephem.py +++ b/sbpy/data/tests/test_ephem.py @@ -1,35 +1,131 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst +import os import pytest +from urllib.parse import urlencode +from types import SimpleNamespace import astropy.units as u from astropy.time import Time -from ... import exceptions as sbe +try: + import astroquery + from astroquery.utils.mocks import MockResponse + from astroquery.query import BaseQuery +except ImportError: # pragma: no cover + astroquery = None + + from ... import bib -from .. import Ephem, Orbit +from ..orbit import Orbit +from ..ephem import Ephem, EphemerisCLI # retreived from Horizons on 23 Apr 2020 CERES = { - 'targetname': '1 Ceres', - 'H': u.Quantity(3.4, 'mag'), - 'G': 0.12, - 'e': 0.07741102040801928, - 'q': u.Quantity(2.55375156, 'au'), - 'incl': u.Quantity(10.58910839, 'deg'), - 'Omega': u.Quantity(80.29081558, 'deg'), - 'w': u.Quantity(73.7435117, 'deg'), - 'n': u.Quantity(0.21401711, 'deg / d'), - 'M': u.Quantity(154.70418799, 'deg'), - 'nu': u.Quantity(158.18663933, 'deg'), - 'a': u.Quantity(2.76802739, 'AU'), - 'Q': u.Quantity(2.98230321, 'AU'), - 'P': u.Quantity(1682.10848349, 'd'), - 'epoch': Time(2458963.26397076, scale='tdb', format='jd'), - 'Tp': Time(2458240.40500675, scale='tdb', format='jd') + "targetname": "1 Ceres", + "H": u.Quantity(3.4, "mag"), + "G": 0.12, + "e": 0.07741102040801928, + "q": u.Quantity(2.55375156, "au"), + "incl": u.Quantity(10.58910839, "deg"), + "Omega": u.Quantity(80.29081558, "deg"), + "w": u.Quantity(73.7435117, "deg"), + "n": u.Quantity(0.21401711, "deg / d"), + "M": u.Quantity(154.70418799, "deg"), + "nu": u.Quantity(158.18663933, "deg"), + "a": u.Quantity(2.76802739, "AU"), + "Q": u.Quantity(2.98230321, "AU"), + "P": u.Quantity(1682.10848349, "d"), + "epoch": Time(2458963.26397076, scale="tdb", format="jd"), + "Tp": Time(2458240.40500675, scale="tdb", format="jd"), } +def data_path(filename): + data_dir = os.path.join(os.path.dirname(__file__), "data") + return os.path.join(data_dir, filename) + + +def nonremote_request(self, request_type, url, **kwargs): + """monkeypatch replacement astroquery request function""" + + params = urlencode(kwargs.get("params", {})) + data = urlencode(kwargs.get("data", {})) + + key = (("URL", url), ("params", params), ("data", data)) + + # URL to name translation, files should be saved to the ./data directory. To + # add a new test URL-file pair, design the test as usual below and run the + # test with the --remote-data and --capture=tee-sys parameters. The error + # should give enough info to formulate the key. + # curl "URL" -o file.txt + # curl "URL" --data "DATA" -o file.txt + files = { + ( + ("URL", "https://ssd.jpl.nasa.gov/api/horizons.api"), + ( + "params", + "format=text&EPHEM_TYPE=OBSERVER&QUANTITIES=%271%2C3%2C9%2C19%2C20%2C23%2C24%2C27%2C33%27&COMMAND=%22DES%3DC%2F1995+O1%3B+CAP%3C2460568%3B+NOFRAG%3B%22&SOLAR_ELONG=%220%2C180%22&LHA_CUTOFF=0&CSV_FORMAT=YES&CAL_FORMAT=BOTH&ANG_FORMAT=DEG&APPARENT=AIRLESS&REF_SYSTEM=ICRF&EXTRA_PREC=NO&CENTER=%27500%27&START_TIME=%222024-08-16+00%3A00%3A00.000%22&STOP_TIME=%222024-10-15+00%3A00%3A00.000%22&STEP_SIZE=%221d%22&SKIP_DAYLT=NO", + ), + ("data", ""), + ): "TestEphemerisCLI-c1995o1-horizons.txt", + ( + ("URL", "https://ssd.jpl.nasa.gov/api/horizons.api"), + ( + "params", + "format=text&EPHEM_TYPE=OBSERVER&QUANTITIES=%271%2C3%2C9%2C19%2C20%2C23%2C24%2C27%2C33%27&COMMAND=%22DES%3D2P%3B+CAP%3C2460568%3B+NOFRAG%3B%22&SOLAR_ELONG=%220%2C180%22&LHA_CUTOFF=0&CSV_FORMAT=YES&CAL_FORMAT=BOTH&ANG_FORMAT=DEG&APPARENT=AIRLESS&REF_SYSTEM=ICRF&EXTRA_PREC=NO&CENTER=%27500%27&START_TIME=%222024-08-16+00%3A00%3A00.000%22&STOP_TIME=%222024-10-15+00%3A00%3A00.000%22&STEP_SIZE=%221d%22&SKIP_DAYLT=NO", + ), + ("data", ""), + ): "TestEphemerisCLI-2p-horizons.txt", + ( + ("URL", "https://cgi.minorplanetcenter.net/cgi-bin/mpeph2.cgi"), + ("params", ""), + ( + "data", + "ty=e&TextArea=2P&uto=0&igd=n&ibh=n&fp=y&adir=N&tit=&bu=&c=500&d=2024-08-16+000000&i=1&u=d&l=61&raty=a&s=t&m=h", + ), + ): "TestEphemerisCLI-2p-mpc.txt", + ( + ("URL", "http://vo.imcce.fr/webservices/miriade/ephemcc_query.php"), + ( + "params", + "-name=2P&-type=Comet&-ep=2460538.5&-step=1.000000d&-nbd=61.0&-observer=500&-output=--jul&-tscale=UTC&-theory=INPOP&-teph=1&-tcoor=1&-rplane=1&-oscelem=ASTORB&-mime=votable", + ), + ("data", ""), + ): "TestEphemerisCLI-2p-miriade.txt", + } + + try: + fn = files[key] + except KeyError: # pragma: no cover + # printing this out helps with debugging + print("url:", url + (("?" + params) if len(params) > 0 else "")) + print("data:", data) + print("files key:", key) + raise KeyError("Request does not have corresponding mocked data") + + with open(data_path(fn), "rb") as inf: + response = MockResponse(content=inf.read(), url=url) + + # for MPC module + response.request = SimpleNamespace(body=data) + + return response + + +# use a pytest fixture to create a dummy 'requests.get' function, +# that mocks (monkeypatches) the actual 'requests.get' function: +@pytest.fixture +def patch_request(request): + if astroquery is None: + return None + + mp = request.getfixturevalue("monkeypatch") + + mp.setattr(BaseQuery, "_request", nonremote_request) + return mp + + class TestEphemFromOorb: def test_units(self): pytest.importorskip("pyoorb") @@ -37,44 +133,134 @@ def test_units(self): orbit1 = Orbit.from_dict(CERES) eph1 = Ephem.from_oo(orbit1) - orbit2 = Orbit.from_dict({ - 'targetname': orbit1['targetname'][0], - 'a': orbit1['a'].value[0] * u.au, - 'e': orbit1['e'][0], - 'i': orbit1['i'].value[0] * u.deg, - 'w': orbit1['w'].value[0] * u.deg, - 'Omega': orbit1['Omega'].value[0] * u.deg, - 'epoch': Time(orbit1['epoch'][0], format='jd'), - 'M': orbit1['M'].value[0] * u.deg, - 'H': orbit1['H'].value[0] * u.mag, - 'G': orbit1['G'][0] - }) + orbit2 = Orbit.from_dict( + { + "targetname": orbit1["targetname"][0], + "a": orbit1["a"].value[0] * u.au, + "e": orbit1["e"][0], + "i": orbit1["i"].value[0] * u.deg, + "w": orbit1["w"].value[0] * u.deg, + "Omega": orbit1["Omega"].value[0] * u.deg, + "epoch": Time(orbit1["epoch"][0], format="jd"), + "M": orbit1["M"].value[0] * u.deg, + "H": orbit1["H"].value[0] * u.mag, + "G": orbit1["G"][0], + } + ) eph2 = Ephem.from_oo(orbit2) - for k in ['ra', 'dec', 'RA*cos(Dec)_rate', 'dec_rate', 'alpha', 'r', - 'delta', 'V', 'hlon', 'hlat', 'EL']: + for k in [ + "ra", + "dec", + "RA*cos(Dec)_rate", + "dec_rate", + "alpha", + "r", + "delta", + "V", + "hlon", + "hlat", + "EL", + ]: assert u.isclose(eph1[k], eph2[k]) def test_basic(self): pytest.importorskip("pyoorb") orbit = Orbit.from_dict(CERES) - oo_ephem = Ephem.from_oo(orbit, scope='basic') - assert 'dec_rate' not in oo_ephem.field_names + oo_ephem = Ephem.from_oo(orbit, scope="basic") + assert "dec_rate" not in oo_ephem.field_names def test_timescale(self): pytest.importorskip("pyoorb") orbit = Orbit.from_dict(CERES) epoch = Time.now() - oo_ephem = Ephem.from_oo(orbit, epochs=epoch, scope='basic') - assert oo_ephem['epoch'].scale == epoch.scale + oo_ephem = Ephem.from_oo(orbit, epochs=epoch, scope="basic") + assert oo_ephem["epoch"].scale == epoch.scale def test_bib(self): pytest.importorskip("pyoorb") with bib.Tracking(): orbit = Orbit.from_dict(CERES) - oo_ephem = Ephem.from_oo(orbit, scope='basic') - assert 'sbpy.data.ephem.Ephem.from_oo' in bib.show() + oo_ephem = Ephem.from_oo(orbit, scope="basic") + assert "sbpy.data.ephem.Ephem.from_oo" in bib.show() bib.reset() + + +class TestEphemCLI: + def test_format_epochs(self): + """EphemerisCLI.parse_args will always have start and step. Test + number, stop, and neither.""" + + epochs = { + "start": Time("2024-07-23"), + "step": u.Quantity(5, "day"), + } + epochs["stop"] = epochs["start"] + 10 * epochs["step"] + + # test stop + args = SimpleNamespace( + start=epochs["start"], step=epochs["step"], number=None, stop=epochs["stop"] + ) + + result = EphemerisCLI._format_epochs(args) + for k in epochs.keys(): + assert result[k] == epochs[k] + + # test number + args = SimpleNamespace( + start=epochs["start"], step=epochs["step"], number=10, stop=None + ) + + result = EphemerisCLI._format_epochs(args) + for k in epochs.keys(): + assert result[k] == epochs[k] + + # no number, no stop --> number = 60 + args = SimpleNamespace( + start=epochs["start"], step=epochs["step"], number=None, stop=None + ) + + result = EphemerisCLI._format_epochs(args) + epochs["stop"] = epochs["start"] + 60 * epochs["step"] + for k in epochs.keys(): + assert result[k] == epochs[k] + + def test_radec_format(self, patch_request): + """Test RA Dec formatting options.""" + + pytest.importorskip("astroquery") + + cli = EphemerisCLI( + ["horizons", "C/1995 O1", "--start=2024-08-16", "--radec=deg"] + ) + + row = str(cli.eph.table[0]).splitlines()[-1].split() + assert row[2] == "339.94076" + assert row[3] == "-85.76646" + + cli = EphemerisCLI( + ["horizons", "C/1995 O1", "--start=2024-08-16", "--radec=hmsdms"] + ) + row = str(cli.eph.table[0]).splitlines()[-1].split() + assert row[2] == "22:39:45.78" + assert row[3] == "-85:45:59.3" + + @pytest.mark.parametrize( + "service, target", + [("horizons", "2P/Encke"), ("mpc", "2P"), ("miriade", "2P")], + ) + def test_comet(self, service, target, patch_request): + """Test services with a comet designation""" + + pytest.importorskip("astroquery") + + cmd = f"{service} 2P --start=2024-08-16" + if service == "miriade": + cmd += " --type=comet" + cli = EphemerisCLI(cmd.split()) + + assert cli.eph["date"][0].iso == "2024-08-16 00:00:00.000" + assert cli.eph.meta["target"] == target diff --git a/sbpy/data/tests/test_ephem_remote.py b/sbpy/data/tests/test_ephem_remote.py index 71a06766c..e4b6fdf02 100644 --- a/sbpy/data/tests/test_ephem_remote.py +++ b/sbpy/data/tests/test_ephem_remote.py @@ -1,7 +1,6 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest -from numpy import abs import warnings from numpy.testing import assert_allclose @@ -12,7 +11,9 @@ from astropy.tests.helper import assert_quantity_allclose from ... import bib -from .. import Ephem, Orbit, QueryError +from ..core import QueryError +from ..ephem import Ephem, EphemerisCLI +from ..orbit import Orbit pytest.importorskip("astroquery") @@ -426,3 +427,23 @@ def test_by_comparison(self): u.isclose(horizons_ephem['hlon'][0], oo_ephem['hlon'][0]) u.isclose(horizons_ephem['hlat'][0], oo_ephem['hlat'][0]) u.isclose(horizons_ephem['EL'][0], oo_ephem['EL'][0]) + + +@pytest.mark.remote_data() +class TestEphemCLI: + @pytest.mark.parametrize("service", ("horizons", "mpc", "miriade")) + def test_services(self, service): + """Spot check results from the services.""" + cli = EphemerisCLI( + f"{service} ceres --start=2024-01-01 --step=3d --stop=2024-01-31".split() + ) + assert len(cli.eph) == 11 + assert cli.eph["date"][0].iso == "2024-01-01 00:00:00.000" + assert cli.eph["date"][-1].iso == "2024-01-31 00:00:00.000" + + cli = EphemerisCLI( + f"{service} ceres --start=2024-01-01 --step=3d --number=10".split() + ) + assert len(cli.eph) == 11 + assert cli.eph["date"][0].iso == "2024-01-01 00:00:00.000" + assert cli.eph["date"][-1].iso == "2024-01-31 00:00:00.000" diff --git a/setup.cfg b/setup.cfg index 7e3cca17d..91fc6c434 100644 --- a/setup.cfg +++ b/setup.cfg @@ -72,6 +72,9 @@ docs = ginga.rv.plugins = cometaryenhancements = sbpy.ginga_plugins:setup_cometaryenhancements +console_scripts = + sbpy-ephem = sbpy.data.ephem:EphemerisCLI.run + [tool:pytest] minversion = 7.0 testpaths = "sbpy" "docs"