Skip to content

Commit

Permalink
update docstrings and commit updated doc build
Browse files Browse the repository at this point in the history
  • Loading branch information
aschleg committed Nov 28, 2019
1 parent 09ede68 commit bf45b68
Show file tree
Hide file tree
Showing 11 changed files with 461 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Version 1.0.0
# Version 0.2.0

Initial release.
53 changes: 29 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,64 +101,52 @@ nasa.get_asteroids()
nasa.get_asteroids(asteroid_id=3542519)
~~~

#### Coronal Mass Ejection Event Data
#### DONKI (Space Weather Database of Notifications, Knowledge and Information)

~~~ python
# Coronal Mass Ejection Event Data

# View data from coronal mass ejection events from the last thirty days
nasa.coronal_mass_ejection()
# View all CME events from the beginning of 2019.
nasa.coronal_mass_ejection(start_date='2019-01-01', end_date=datetime.datetime.today())
~~~

#### Geomagnetic Storm Event Data
# Geomagnetic Storm Event Data

~~~ python
# Get geomagnetic storm events from the last thirty days.
nasa.geomagnetic_storm()
~~~

#### Solar Flare Event Data
# Solar Flare Event Data

~~~ python
# Get solar flare events from May of 2019
nasa.solar_flare(start_date='2019-05-01', end_date='2019-05-31')
~~~

#### Solar Energetic Particle Data
# Solar Energetic Particle Data

~~~ python
# Get data from April 2017
nasa.solar_energetic_particle(start_date='2017-04-01', end_date='2017-04-30')
~~~

#### Magnetopause Crossing Data
# Magnetopause Crossing Data

~~~ python
# Get data on magnetopause crossing events from 2018 to the current date.
nasa.magnetopause_crossing(start_date='2018-01-01')
~~~

#### Radiation Belt Enhancement Data
# Radiation Belt Enhancement Data

~~~ python
# Get data on radiation belt enhancement events from the last 30 days.
nasa.radiation_belt_enhancement()
~~~

#### Hight Speed Stream Data
# Hight Speed Stream Data

~~~ python
# Get data on hight speed stream events from the beginning of September 2019.
nasa.hight_speed_stream()
~~~

#### WSA Enlil-Simulation Data
# WSA Enlil-Simulation Data

~~~ python
# Get data from the first simulation performed in 2019.
wsa = n.wsa_enlil_simulation(start_date='2019-01-01')
wsa[0]
~~~
~~~

#### EPIC (DSCOVR's Earth Polychromatic Imaging Camera)

Expand All @@ -174,6 +162,9 @@ e[0]
~~~ python
# Get imagery at latitude 1.5, longitude 100.75 and include the computed cloud score calculation.
nasa.earth_imagery(lon=100.75, lat=1.5, cloud_score=True)

# Get assets available beginning from 2014-02-01 at lat-lon 100.75, 1.5
nasa.earth_assets(lat=100.75, lon=1.5, begin_date='2014-02-01')
~~~

#### Available Image data collected by the Mars rovers Curiosity, Discovery and Spirit.
Expand All @@ -186,7 +177,8 @@ nasa.mars_rover(sol=1000)
#### Access GeneLab and Other Bioinformatics Databases

~~~ python

# Find Gene studies in the cgene database related to 'mouse liver'
n.genelab_search(term='mouse liver')
~~~

The following functions do not require authentication with an API or demo key.
Expand All @@ -207,6 +199,19 @@ r = media_search(query='apollo 11', description='moon landing')
r['items'][0]
~~~

Other function examples

#### Getting the Julian and Modified Julian Date

~~~ python
# Return the modified Julian Date for the current time.
julian_date()
# Return the non-modified Julian Date for the current time.
julian_date(modified=False)
# Get the modified Julian Date for 2019-01-01 at midnight.
julian_date(year=2019)
~~~

## Requirements

* Python 3.4+
Expand Down
Binary file modified docs/build/doctrees/api.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/environment.pickle
Binary file not shown.
145 changes: 145 additions & 0 deletions docs/build/html/_sources/api.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ exact date in the request.
:param end_date: End of date range in which to search for available assets. If not specified, defaults to the current date. If specified, Must be a string representing a date in 'YYYY-MM-DD' format or a datetime object
:rtype: dict. Dictionary object representing the returned JSON data from the API.

.. code-block:: python
# Get assets available beginning from 2014-02-01 at lat-lon 100.75, 1.5
n.earth_assets(lat=100.75, lon=1.5, begin_date='2014-02-01')
Mars Rover Photos
+++++++++++++++++

Expand Down Expand Up @@ -327,6 +332,11 @@ GeneLab Search
:param fvalue: Filters the returned data based on value or values in the specified :code:`ffield` parameter field. Only the 'cgene' (GeneLab) database can be filtered.
:rtype: dict. Dictionary object representing the returned JSON data.

.. code-block:: python
# Find Gene studies in the cgene database related to 'mouse liver'
n.genelab_search(term='mouse liver')
Techport
++++++++

Expand Down Expand Up @@ -496,3 +506,138 @@ and `Center for Near-Earth Object Studies <https://cneos.jpl.nasa.gov/>`_ APIs.
# Get data from the beginning of 2019
>>> nasapy.fireballs(date_min='2019-01-01')
.. method:: mission_design([des=None][, spk=None][, sstr=None][, orbit_class=False][, mjd0=None][, span=None][, tof_min=None][, tof_max=None][, step=None])

Provides access to the Jet Propulsion Laboratory/Solar System Dynamics small body mission design suite API.

:param des: The designation (provisional or IAU-number) of the desired object to search.
:param spk: The SPK-ID of the desired object to search.
:param sstr: Object search string.
:param orbit_class: If True, returns the orbit class in human readable format instead of the default three-letter code.
:param mjd0: First launch date in Modified Julian Date. Must be between [33282, 73459].
:param span: Duration of the launch-date period to be explored in days. Must be between [10, 9200].
:param tof_min: Minimum time of flight in days. Must be between [10, 9200].
:param tof_max: Maximum time of flight in days. Must be between [10, 9200].
:param step: Time step used to advance the launch date and the time of flight. Size of transfer map is limited to 1,500,000 points.
:rtype: dict. Dictionary object representing the returned JSON data from the API.

.. code-block:: python
# Search for mission design data for SPK-ID 2000433
r = nasapy.mission_design(spk=2000433)
# Print the object data from the returned dictionary object.
r['object']
# Get Missions to 1 Ceres
r = nasapy.mission_design(des=1, mjd0=59000, span=1800, tof_min=120, tof_max=1500, step=5)
r['object']
.. method:: nhats([spk=None][, des=None][, delta_v=12][, duration=450][, stay=8][, launch='2020-2045'][, magnitude=None][, orbit_condition_code=None][, plot=False])

Returns data available from the Near-Earth Object Human Space Flight Accessible Targets Study (NHATS) in the Small
Bodies Database

:param spk: Returns data for a specific object by its SPK-ID.
:param des: Returns data for a specific object by its designation.
:param delta_v: Minimum total delta-v in km/s. Must be one of {12, 4, 5, 6, 7, 8, 9, 10, 11}
:param duration: Minimum total distribution in number of days. Must be one of {450, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420}
:param stay: Minimum stay in days. Must be one of {8, 16, 24, 32}
:param launch: The proposed launch window as a year range. Must be one of {'2020-2045', '2020-2025', '2025-2030', '2030-2035', '2035-2040', '2040-2045'}
:param magnitude: The object's maximum absolute magnitude, also denoted as H. Must be one of {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30}
:param orbit_condition_code: The object's maximum orbit condition code (OCC). Must be one of {0, 1, 2, 3, 4, 5, 6, 7, 8}
:param plot: If True, include base-64 encoded plot image file content. Will include a new output field 'plot_base64' in the returned results if True.
:rtype: dict. Dictionary object representing the returned JSON data from the API.

.. code-block:: python
# Get all available summary data for NHATS objects.
n = nhats()
# Get the results from a 'standard' search on the NHATS webpage.
nhats(delta_v=6, duration=360, stay=8, magnitude=26, launch='2020-2045', orbit_condition_code=7)
# Return data for a specific object by its designation
nhats(des=99942)
.. method:: scout([tdes=None][, plot=None][, data_files=None][, orbits=None][, n_orbits=None][, eph_start=None][, eph_stop=None][, eph_step=None][, obs_code=None][, fov_diam=None][, fov_ra=None][, fov_dec=None][, fov_vmag=None])

Provides access and data available from NASA's Center for Near-Earth Object Studies (CNEOS) Scout system.

:param tdes: Filter results by an object's temporary designation.
:param plot: Includes the plot files for the specified object of the select type. Options include 'el' (elements), 'ca' (close approach) and `sr` (systematic-ranging) or any combination delimited by ':'. For example, 'ca:el:sr' would include plot files of each available type.
:param data_files: Returns available data files or the requested data file for the specified object. Currently only 'mpc' is available.
:param orbits: If True, returns the sampled orbits data for a specified object.
:param n_orbits: Limits the number of sampled orbits to this value. Must be in range [1, 1000].
:param eph_start: Get the ephemeris for the specified object at the specified time in UTC.
:param eph_stop: Sets the ephemeris stop-time. Also requires :code:`eph_start` if specified.
:param eph_step: Sets the ephemeris step size. Requires both :code:`eph_start` and :code:`eph_stop` to be specified.
:param obs_code: Gets the ephemeris for the specified object relative to the specified MPC observatory code.
:param fov_diam: Specifies the size (diameter) of the field-of-view in arc-minutes.
:param fov_ra: Specifies the field-of-view center (R.A component). Requires parameters :code:`fov_diam` and :code:`fov_dec` to be set as well. Invalid if :code:`eph_stop` is passed.
:param fov_dec: Specifies the field-of-view center (Dec. component). Requires :code:`fov_diam` and :code:`fov_ra` to be passed as well. Invalid if :code:`eph_stop` is set.
:param fov_vmag: Filters ephemeris results to those with V-magnitude of this value or brighter. Requires :code:`fov_diam` to also be specified.
:rtype: dict. Dictionary object representing the returned JSON data from the API.

.. code-block:: python
# Get all available summary data.
scout()
# Return data and plot files for a specific object by its temporary designation. Note the object may no longer
# exist in the current database
scout(tdes='P20UvyK')
# Get ephemeris data for a specific object at the current time with a Field of View diameter of 5 arc-minutes
# with a limiting V-magnitude of 23.1.
scout(tdes='P20UvyK', fov_diam=5, fov_vmag=23.1)
.. method:: sentry([spk=None][, des=None][, h_max=None][, ps_min=None][, ip_min=None][, last_obs_days=None][, complete_data=False][, removed=False])

Provides data available from the Center for Near Earth Object Studies (CNEOS) Sentry system.

:param spk: Returns data available for the object matching the specified SPK-ID.
:param des: Selects data for the matching designation.
:param h_max: Limits data to those with an absolute magnitude, less than or equal to the specified value. Must be in the range [-10:100].
:param ps_min: Limits results to those with a Palermo scale (PS) greater than or equal to the specified value. Must be in the range [-20:20].
:param ip_min: Filters data to that which has an impact probability (IP) greater than or equal to the specified value.
:param last_obs_days: Number of days since last observation. If negative, filters data to those which have not been observed within the specified number of days. If passed, must have an absolute value greater than 6.
:param complete_data: If True, requests the full dataset to be returned.
:param removed: If True, requests the list of removed objects to be returned.
:rtype: dict. Dictionary object representing the returned JSON data.

.. code-block:: python
# Get summary data for available sentry objects.
sentry()
# Get data for a specific Sentry object by its designation.
sentry(des=99942)
# Get data for objects removed from the Sentry system.
sentry(removed=1)
Other Methods
+++++++++++++

.. method:: julian_date([dt=None][, year=None][, month=1][, day=1][, hour=0][, minute=0][, second=0][, modified=True])

Calculates the Julian date or modified Julian date (if specified).

:param dt: Datetime object to convert into a Julian date. Note if a datetime object is supplied to :code:`dt` the other parameters will not be evaluated. If None, returns the current datetime converted into a Julian date.
:param year: Four digit year, such as 2019 or '2019'.
:param month: Month number. For example 1 = January, 12 = December.
:param day: Day of the month.
:param hour: Hour of the day.
:param minute: Minute of the day.
:param second: Second of the day.
:param modified: If True, returns the modified Julian date, which is the computed Julian Date - 24000000.5.
:rtype: float. The computed Julian or Modified Julian date.

.. code-block:: python
# Return the modified Julian Date for the current time.
julian_date()
# Return the non-modified Julian Date for the current time.
julian_date(modified=False)
# Get the modified Julian Date for 2019-01-01 at midnight.
julian_date(year=2019)
The equation for calculating the Julian date is defined as:

.. math::
J = 367(Year) - /large[ \large( \frac{7(Year + \frac{Month + 9}{12})}{4} \large). \large] +
\frac{275(Month)}{9}. + Day + 1721013.5 + \frac{\large( \frac{\frac{Second}{60} + Minute}{60} \large) + Hour}{24}
Loading

0 comments on commit bf45b68

Please sign in to comment.