Asteroids-NeoWs API Reference

This page provides a breakdown of the aionasa Asteroids-NeoWs (Near Earth Object Web Service) module.

The NeoWs REST API has three endpoints:

  • Feed: Retrieve a list of Asteroids based on their closest approach date to Earth.
    • GET https://api.nasa.gov/neo/rest/v1/feed

  • Lookup: Lookup a specific Asteroid based on its NASA JPL small body ID (SPK-ID).
    • GET https://api.nasa.gov/neo/rest/v1/neo/

  • Browse: Browse the overall Asteroid data-set.
    • GET https://api.nasa.gov/neo/rest/v1/neo/browse

Note

In this context, “epoch” should generally refer to the J2000 epoch (January 2000). This is also the basis of the coordinate systems used by most of the NASA APIs (i.e. EPIC’s coordinate data).

Client

class aionasa.neows.NeoWs(api_key='DEMO_KEY', session=None, rate_limiter=<default_rate_limiter>)

Client for NASA Near Earth Object Weather Service.

await browse(page: int = 0)

Browse the overall asteroid dataset.

Parameters

page (int) – The page to request. Defaults to ‘page 0’.

Returns

The paginated NeoWs asteroid data.

Return type

List[...]

await feed(start_date: datetime.date, end_date: Optional[datetime.date] = None)

Retrieve a list of Asteroids based on their closest approach date to Earth.

Parameters
  • start_date (datetime.date) – Starting date for asteroid search.

  • end_date (datetime.date) – Ending date for asteroid search.

Returns

A list of Asteroids returned by the API.

Return type

List[Asteroid]

await lookup(asteroid_id: int)

Retrieve a list of Asteroids based on their closest approach date to Earth.

Parameters

asteroid_id (int) – Asteroid SPK-ID correlates to the NASA JPL small body.

Returns

Data for the requested NEO.

Return type

Asteroid

Data Classes

class aionasa.neows.Asteroid(json)

NASA data on a single NEO.

json

Raw JSON data from the API that was used to build this object.

Type

dict

id

JPL NEO ID. In the JSON data, 'neo_reference_id' is an alias for this.

Type

int

name

Name of the NEO. In the JSON data, 'designation' is an alias for this.

Type

str

nasa_jpl_url

NASA Jet Propulsion Laboratory website URL containing information regarding this NEO.

Type

str

absolute_magnitude_h

Absolute magnitude of the NEO (magnitude at 1 au from Sun and observer).

Type

float

is_potentially_hazardous_asteroid

:strike:`Self-explanatory, I hope.`

Type

bool

is_sentry_object

`Sentry: Earth Impact Monitoring https://cneos.jpl.nasa.gov/sentry/`_

Type

bool

estimated_diameter

Estimated diameter of the NEO. A dict containing minimum and maximum diameters in four units: kilometers, meters, miles, feet.

Type

dict

close_approach_data

A list of close approach events between this NEO and Earth.

Type

List[CloseApproach]

orbital_data

Information regarding this NEO’s orbit.

Type

OrbitalData

class aionasa.neows.CloseApproach(json)

A single NEO close-approach date.

json

Raw JSON data from the API that was used to build this object.

Type

dict

date

The date of this close approach.

Type

datetime.date

date_full

The full timestamp of this close approach.

Type

datetime.datetime

epoch_date

The timestamp of this close approach, in seconds from the epoch.

Type

int

orbiting_body

The name of the body this NEO is orbiting.

Type

str

relative_velocity

Relative velocity of this NEO with respect to Earth during this close approach. TODO: uncertain about this one.

Type

dict

miss_distance

The distance by which this NEO missed the Earth during this close approach.

Type

dict

class aionasa.neows.OrbitalData(json)

NEO orbital data.

orbit_id

JPL orbit ID (JPL 13, JPL 24, etc). TODO: figure out what this actually means

Type

int

orbit_determination_date

When orbit solution was computed.

Type

datetime.datetime

first_observation_date

Date of the first recorded observation of this orbit.

Type

datetime.date

last_observation_date

Date of the last recorded observation of this orbit.

Type

datetime.date

data_arc_in_days

Number of days spanned by the data-arc.

Type

int

observations_used

Number of recorded observations of this orbit.

Type

int

orbit_uncertainty

MPC “U” parameter: orbit uncertainty estimate 0-9, with 0 being good, and 9 being highly uncertain.

Type

int

minimum_orbit_intersection

Earth MOID (Minimum Orbit Intersection Distance), in au.

Type

float

jupiter_tisserand_invariant

Jupiter Tisserand invariant.

Type

float

epoch_osculation

When these orbital elements were determined, in seconds from the epoch.

Type

float

eccentricity

Eccentricity of the orbit.

Type

float

semi_major_axis

Semi-major axis of the orbit, in au.

Type

float

inclination

Inclination of the NEO’s orbit, in degrees.

Type

float

ascending_node_longitude

Longitude of the ascending node, in degrees.

Type

float

orbital_period

Orbital period, in days.

Type

float

perihelion_distance

Perihelion distance, in au.

Type

float

perihelion_argument

Argument of perihelion, in degrees.

Type

float

aphelion_distance

Aphelion distance, in au.

Type

float

perihelion_time

Time of perihelion passage, in `TDB`_ (Barycentric Dynamical Time).

Type

float

mean_anomaly

Mean anomaly, in degrees.

Type

float

mean_motion

Mean motion, in degrees per day.

Type

float

equinox

Will most likely be J2000 (January 1, 2000)

Type

str

orbit_class

Orbital classification information.

Type

dict

.. _TDB
Type

https://www.timeanddate.com/time/terrestrial-dynamic-time.html

Data Paginators

class aionasa.neows.NeoWsFeedPage(client, json)

Class representing the paginated NEO API feed endpoint. Asteroids are sorted into a dict by date.

json

JSON data returned by the API.

Type

dict

element_count

Number of Asteroids on this page.

Type

int

await next()

Returns the next page in the feed.

Returns

The next page in the feed.

Return type

NeoWsFeedPage

await prev()

Returns the previous page in the feed.

Returns

The previous page in the feed.

Return type

NeoWsFeedPage

class aionasa.neows.NeoWsBrowsePage(client, json)

Class representing the paginated NEO API browse endpoint. Asteroids are all in a single list, 'near_earth_objects'.

json

JSON data returned by the API.

Type

dict

page_number

The page number of this page.

page_size

TODO

page_count

Total number of pages available through the API.

element_count

Number of Asteroids on this page.

await next()

Returns the next page in the browse feed.

Returns

The next page in the feed.

Return type

NeoWsBrowsePage

await prev()

Returns the previous page in the browse feed.

Returns

The previous page in the feed.

Return type

NeoWsBrowsePage