Skip to content

Commit bf45b68

Browse files
committed
update docstrings and commit updated doc build
1 parent 09ede68 commit bf45b68

File tree

11 files changed

+461
-33
lines changed

11 files changed

+461
-33
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Version 1.0.0
1+
# Version 0.2.0
22

33
Initial release.

README.md

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -101,64 +101,52 @@ nasa.get_asteroids()
101101
nasa.get_asteroids(asteroid_id=3542519)
102102
~~~
103103

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

106106
~~~ python
107+
# Coronal Mass Ejection Event Data
108+
107109
# View data from coronal mass ejection events from the last thirty days
108110
nasa.coronal_mass_ejection()
109111
# View all CME events from the beginning of 2019.
110112
nasa.coronal_mass_ejection(start_date='2019-01-01', end_date=datetime.datetime.today())
111-
~~~
112113

113-
#### Geomagnetic Storm Event Data
114+
# Geomagnetic Storm Event Data
114115

115-
~~~ python
116116
# Get geomagnetic storm events from the last thirty days.
117117
nasa.geomagnetic_storm()
118-
~~~
119118

120-
#### Solar Flare Event Data
119+
# Solar Flare Event Data
121120

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

127-
#### Solar Energetic Particle Data
124+
# Solar Energetic Particle Data
128125

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

134-
#### Magnetopause Crossing Data
129+
# Magnetopause Crossing Data
135130

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

141-
#### Radiation Belt Enhancement Data
134+
# Radiation Belt Enhancement Data
142135

143-
~~~ python
144136
# Get data on radiation belt enhancement events from the last 30 days.
145137
nasa.radiation_belt_enhancement()
146-
~~~
147138

148-
#### Hight Speed Stream Data
139+
# Hight Speed Stream Data
149140

150-
~~~ python
151141
# Get data on hight speed stream events from the beginning of September 2019.
152142
nasa.hight_speed_stream()
153-
~~~
154143

155-
#### WSA Enlil-Simulation Data
144+
# WSA Enlil-Simulation Data
156145

157-
~~~ python
158146
# Get data from the first simulation performed in 2019.
159147
wsa = n.wsa_enlil_simulation(start_date='2019-01-01')
160148
wsa[0]
161-
~~~
149+
~~~
162150

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

@@ -174,6 +162,9 @@ e[0]
174162
~~~ python
175163
# Get imagery at latitude 1.5, longitude 100.75 and include the computed cloud score calculation.
176164
nasa.earth_imagery(lon=100.75, lat=1.5, cloud_score=True)
165+
166+
# Get assets available beginning from 2014-02-01 at lat-lon 100.75, 1.5
167+
nasa.earth_assets(lat=100.75, lon=1.5, begin_date='2014-02-01')
177168
~~~
178169

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

188179
~~~ python
189-
180+
# Find Gene studies in the cgene database related to 'mouse liver'
181+
n.genelab_search(term='mouse liver')
190182
~~~
191183

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

202+
Other function examples
203+
204+
#### Getting the Julian and Modified Julian Date
205+
206+
~~~ python
207+
# Return the modified Julian Date for the current time.
208+
julian_date()
209+
# Return the non-modified Julian Date for the current time.
210+
julian_date(modified=False)
211+
# Get the modified Julian Date for 2019-01-01 at midnight.
212+
julian_date(year=2019)
213+
~~~
214+
210215
## Requirements
211216

212217
* Python 3.4+

docs/build/doctrees/api.doctree

45.8 KB
Binary file not shown.
675 Bytes
Binary file not shown.

docs/build/html/_sources/api.rst.txt

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,11 @@ exact date in the request.
293293
: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
294294
:rtype: dict. Dictionary object representing the returned JSON data from the API.
295295

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

@@ -327,6 +332,11 @@ GeneLab Search
327332
: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.
328333
:rtype: dict. Dictionary object representing the returned JSON data.
329334

335+
.. code-block:: python
336+
337+
# Find Gene studies in the cgene database related to 'mouse liver'
338+
n.genelab_search(term='mouse liver')
339+
330340
Techport
331341
++++++++
332342

@@ -496,3 +506,138 @@ and `Center for Near-Earth Object Studies <https://cneos.jpl.nasa.gov/>`_ APIs.
496506
# Get data from the beginning of 2019
497507
>>> nasapy.fireballs(date_min='2019-01-01')
498508
509+
.. method:: mission_design([des=None][, spk=None][, sstr=None][, orbit_class=False][, mjd0=None][, span=None][, tof_min=None][, tof_max=None][, step=None])
510+
511+
Provides access to the Jet Propulsion Laboratory/Solar System Dynamics small body mission design suite API.
512+
513+
:param des: The designation (provisional or IAU-number) of the desired object to search.
514+
:param spk: The SPK-ID of the desired object to search.
515+
:param sstr: Object search string.
516+
:param orbit_class: If True, returns the orbit class in human readable format instead of the default three-letter code.
517+
:param mjd0: First launch date in Modified Julian Date. Must be between [33282, 73459].
518+
:param span: Duration of the launch-date period to be explored in days. Must be between [10, 9200].
519+
:param tof_min: Minimum time of flight in days. Must be between [10, 9200].
520+
:param tof_max: Maximum time of flight in days. Must be between [10, 9200].
521+
: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.
522+
:rtype: dict. Dictionary object representing the returned JSON data from the API.
523+
524+
.. code-block:: python
525+
526+
# Search for mission design data for SPK-ID 2000433
527+
r = nasapy.mission_design(spk=2000433)
528+
# Print the object data from the returned dictionary object.
529+
r['object']
530+
# Get Missions to 1 Ceres
531+
r = nasapy.mission_design(des=1, mjd0=59000, span=1800, tof_min=120, tof_max=1500, step=5)
532+
r['object']
533+
534+
.. method:: nhats([spk=None][, des=None][, delta_v=12][, duration=450][, stay=8][, launch='2020-2045'][, magnitude=None][, orbit_condition_code=None][, plot=False])
535+
536+
Returns data available from the Near-Earth Object Human Space Flight Accessible Targets Study (NHATS) in the Small
537+
Bodies Database
538+
539+
:param spk: Returns data for a specific object by its SPK-ID.
540+
:param des: Returns data for a specific object by its designation.
541+
:param delta_v: Minimum total delta-v in km/s. Must be one of {12, 4, 5, 6, 7, 8, 9, 10, 11}
542+
: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}
543+
:param stay: Minimum stay in days. Must be one of {8, 16, 24, 32}
544+
: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'}
545+
: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}
546+
: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}
547+
: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.
548+
:rtype: dict. Dictionary object representing the returned JSON data from the API.
549+
550+
.. code-block:: python
551+
552+
# Get all available summary data for NHATS objects.
553+
n = nhats()
554+
# Get the results from a 'standard' search on the NHATS webpage.
555+
nhats(delta_v=6, duration=360, stay=8, magnitude=26, launch='2020-2045', orbit_condition_code=7)
556+
# Return data for a specific object by its designation
557+
nhats(des=99942)
558+
559+
.. 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])
560+
561+
Provides access and data available from NASA's Center for Near-Earth Object Studies (CNEOS) Scout system.
562+
563+
:param tdes: Filter results by an object's temporary designation.
564+
: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.
565+
:param data_files: Returns available data files or the requested data file for the specified object. Currently only 'mpc' is available.
566+
:param orbits: If True, returns the sampled orbits data for a specified object.
567+
:param n_orbits: Limits the number of sampled orbits to this value. Must be in range [1, 1000].
568+
:param eph_start: Get the ephemeris for the specified object at the specified time in UTC.
569+
:param eph_stop: Sets the ephemeris stop-time. Also requires :code:`eph_start` if specified.
570+
:param eph_step: Sets the ephemeris step size. Requires both :code:`eph_start` and :code:`eph_stop` to be specified.
571+
:param obs_code: Gets the ephemeris for the specified object relative to the specified MPC observatory code.
572+
:param fov_diam: Specifies the size (diameter) of the field-of-view in arc-minutes.
573+
: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.
574+
: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.
575+
:param fov_vmag: Filters ephemeris results to those with V-magnitude of this value or brighter. Requires :code:`fov_diam` to also be specified.
576+
:rtype: dict. Dictionary object representing the returned JSON data from the API.
577+
578+
.. code-block:: python
579+
580+
# Get all available summary data.
581+
scout()
582+
# Return data and plot files for a specific object by its temporary designation. Note the object may no longer
583+
# exist in the current database
584+
scout(tdes='P20UvyK')
585+
# Get ephemeris data for a specific object at the current time with a Field of View diameter of 5 arc-minutes
586+
# with a limiting V-magnitude of 23.1.
587+
scout(tdes='P20UvyK', fov_diam=5, fov_vmag=23.1)
588+
589+
.. method:: sentry([spk=None][, des=None][, h_max=None][, ps_min=None][, ip_min=None][, last_obs_days=None][, complete_data=False][, removed=False])
590+
591+
Provides data available from the Center for Near Earth Object Studies (CNEOS) Sentry system.
592+
593+
:param spk: Returns data available for the object matching the specified SPK-ID.
594+
:param des: Selects data for the matching designation.
595+
: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].
596+
: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].
597+
:param ip_min: Filters data to that which has an impact probability (IP) greater than or equal to the specified value.
598+
: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.
599+
:param complete_data: If True, requests the full dataset to be returned.
600+
:param removed: If True, requests the list of removed objects to be returned.
601+
:rtype: dict. Dictionary object representing the returned JSON data.
602+
603+
.. code-block:: python
604+
605+
# Get summary data for available sentry objects.
606+
sentry()
607+
# Get data for a specific Sentry object by its designation.
608+
sentry(des=99942)
609+
# Get data for objects removed from the Sentry system.
610+
sentry(removed=1)
611+
612+
Other Methods
613+
+++++++++++++
614+
615+
.. method:: julian_date([dt=None][, year=None][, month=1][, day=1][, hour=0][, minute=0][, second=0][, modified=True])
616+
617+
Calculates the Julian date or modified Julian date (if specified).
618+
619+
: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.
620+
:param year: Four digit year, such as 2019 or '2019'.
621+
:param month: Month number. For example 1 = January, 12 = December.
622+
:param day: Day of the month.
623+
:param hour: Hour of the day.
624+
:param minute: Minute of the day.
625+
:param second: Second of the day.
626+
:param modified: If True, returns the modified Julian date, which is the computed Julian Date - 24000000.5.
627+
:rtype: float. The computed Julian or Modified Julian date.
628+
629+
.. code-block:: python
630+
631+
# Return the modified Julian Date for the current time.
632+
julian_date()
633+
# Return the non-modified Julian Date for the current time.
634+
julian_date(modified=False)
635+
# Get the modified Julian Date for 2019-01-01 at midnight.
636+
julian_date(year=2019)
637+
638+
The equation for calculating the Julian date is defined as:
639+
640+
.. math::
641+
642+
J = 367(Year) - /large[ \large( \frac{7(Year + \frac{Month + 9}{12})}{4} \large). \large] +
643+
\frac{275(Month)}{9}. + Day + 1721013.5 + \frac{\large( \frac{\frac{Second}{60} + Minute}{60} \large) + Hour}{24}

0 commit comments

Comments
 (0)