query.fetch_orb

query.fetch_orb(
    output='orb.parq',
    update_output=False,
    server='jplsbdb',
    fields='simple',
    drop_impacted=True,
    drop_unreliable=True,
    kind2bools=True,
    neo2bool=True,
    pha2bool=True,
    twobody2bool=True,
    engine='auto',
    compression='snappy',
    filters=None,
    strict_column_match=False,
)

Fetch the orbit data from API and save it to a parquet file.

Note: kete is only required when output=None. In that case, install with: pip install skyloc[kete]

Parameters

output : path-like, default = 'orb.parq'

The path to the output file. If None, it will be saved to the default cache path (see kete.cache.cache_path()) with filename "horizons_orbits.parq". Default is "orb.parq".

update_output : bool, float, default = False

If True, update the entries with newer “soln_date” and remove entries that are not in the latest “pdes” list (deleted objects). The fields must contain both "pdes" and "soln_date" fields. To completely update the output file, remove the existing file. If float, it will check last-modified time of the file and update the entries if the file is older than the given number of days. Ironically, setting update_output to False will be equivalent to setting it to 0. Default is False.

server : str, default = 'jplsbdb'

The server to query. Currently, only “jplsbdb” is supported. Hopefully, in the future, it will be possible to query other servers like “iaumpc”. Default is "jplsbdb".

kind2bools : bool, default = True

Whether to convert certain string columns to boolean columns. See jplsbdb.cols2bools_sbdb for details. Default is True for all.

neo2bool : bool, default = True

Whether to convert certain string columns to boolean columns. See jplsbdb.cols2bools_sbdb for details. Default is True for all.

pha2bool : bool, default = True

Whether to convert certain string columns to boolean columns. See jplsbdb.cols2bools_sbdb for details. Default is True for all.

twobody2bool : bool, default = True

Whether to convert certain string columns to boolean columns. See jplsbdb.cols2bools_sbdb for details. Default is True for all.

fields : list, default = 'simple'

List of fields to download from API. If None, it will download the minimum fields (see configs.KETE_SBDB_MINIMUM_FIELDS). If fields is superset of already downloaded file, it will likely raise an error. Recommended to delete the existing file. With any of "A1", "A2", "A3", "DT", it must also contain "soln_date" (see Notes). Default is "simple" (see ~configs.SBDB_FIELDS).

drop_impacted : bool, default = True

Whether to drop objects that are marked as impacted or unreliable in the SBDB data. See jplsbdb.sanitize_sbdb for details. Defaults are True for both.

drop_unreliable : bool, default = True

Whether to drop objects that are marked as impacted or unreliable in the SBDB data. See jplsbdb.sanitize_sbdb for details. Defaults are True for both.

engine : str, default = 'auto'

The engine and compression to use for saving the parquet file (see pandas.DataFrame.to_parquet for details).

compression : str, default = 'snappy'

The engine and compression to use for saving the parquet file (see pandas.DataFrame.to_parquet for details).

filters : str, list-like, or ExprNode, default = None

A list of filters to apply when reading the parquet file. This is passed either to pqfilt.read (if a string or ExprNode) or natively to pandas.read_parquet (if a list).

If string: Uses the pqfilt expression syntax. Example: filters="kind in 'an','cn' & condition_code == 0"

If list: Uses PyArrow/Pandas native filter syntax. Example: filters=[("kind", "in", ("an", "cn")), ("condition_code", "==", "0")]

If None (default), no filters are applied to read all data.

strict_column_match : bool, default = False

(not matured yet) If True, when updating the existing parquet file, check if the fields in the new query match the columns in the existing DataFrame, except for the columns that are mapped by KETE_SBDB2KETECOLS. This may be erroneous if the user changes the fields parameter using kind2bools, because it removes "kind" and adds "is_comet" and "has_number"… Default is False.

Returns

orb : ~pandas.DataFrame

The orbit data with columns of orbital elements.

m_ng : ~pandas.Series

A boolean mask indicating which objects have non-gravitational parameters (i.e., A1, A2, A3, DT are not all zero). This is useful to filter out objects that do not have non-gravitational parameters, which are typically comets or asteroids with non-gravitational perturbations.

Notes

This returns orbit data, not propagated states. Use orb with SSOLocator or locator_twice. For repeated full-catalog propagation, optionally pass both outputs to CachedOrbPropagator(orb, m_ng) once.

The bulk SBDB API gives A1, A2, A3, and DT, but not the radial law g(r) that scales them. So, for each object with nonzero A1, A2, A3, or DT, this also queries the single-object SBDB API and writes the law as alpha, r_0, m, n, and k (see nongrav_parameters). JPL allows one request at a time, so a full download takes several minutes longer (about 1000 such objects as of 2026 November). An update queries only rows with an empty law.

If, for some reasons, the user wants to save without dropping impacted or unreliable objects, they can just run fetch_orb with drop_impacted=False, etc, and then afterwards, load them by fetch_orb(update_output=False).