Skip to content

Commit b0eea47

Browse files
committed
Initial commit
0 parents  commit b0eea47

File tree

16 files changed

+608
-0
lines changed

16 files changed

+608
-0
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.tox
2+
.coverage
3+
*.egg-info
4+
.eggs/
5+
build/
6+
dist/
7+
htmlcov/
8+
__pycache__/
9+
AUTHORS
10+
Changelog

.travis.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
sudo: false
2+
language: python
3+
cache: pip
4+
5+
python: 3.6
6+
7+
stages:
8+
- name: test
9+
- name: deploy
10+
if: tag IS present
11+
12+
jobs:
13+
include:
14+
- stage: test
15+
install:
16+
- pip install tox-travis python-coveralls
17+
script:
18+
- tox
19+
after_success:
20+
- coveralls
21+
22+
- stage: deploy
23+
script: echo 'Deploy to PyPi...'
24+
env: PBR_VERSION=$TRAVIS_TAG
25+
deploy:
26+
provider: pypi
27+
user: seignovert
28+
password:
29+
secure: RnvVK0k/25wCMAx/3B0umMm3F/jMTU+LQ7phFlt8fpvjP4EvZ0nxHcf7++RM8fQpWcLneY6MneLh1yZoKlkL9QadjEC9zqvqp+12hJqPrfpqhQmKE8kiuAiVZ3/uJJa6SVPNxVDHYQ0w4TUe4KYzNWQVOyXkt4tbtX60DKgKCWVWSnCFqCHNtdPrgaYoMDm+Koq0fHOLMHU4K64rWk10eo3O1w2QHmurYqxvcDwup7t7T2MKgkjfEu5iCsS5VvQTNlRCE86gxSha2xiJcU1MSx1+hGHxadPlPFuPAZVGgGyj3tplJkjvUfnaxoZedHJ5HPvmrlmFvexstXi8tOubkn2ognPf4VOrTKxnqAdYCkiLs/RARe6e3krVxgwGRbV3LsPR4YH6fSnrLvA73oDEHicumZdFIrZXe4PrXi41XMELqkMPHX/S3BbizNKbzXZzryVEXdCIP5zKywDzBfMbCgX9WrIag6QWDvUtBqfK9Z70ICqlGLlogTLEHdsyAGaRzOJYRn7SQ0VyETVE/Z53b0WbRbuDYrmDUWOZoGAIv96YgurfWwBQbpMAN5z1qMGXfAI2qj22NUzoJzbJoWrd1L0EaR/Ohe6SQHpddR+O6GNJ/tM4/6w/cWdpivhJ/K/6A2EGrsd7lddrzMRKs3DlKEX+6ul2BmHDD35ZRNupXH0=
30+
skip_cleanup: true
31+
distributions: sdist bdist_wheel
32+
on:
33+
tags: true

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) [2019 B. Seignovert](https://benoit.seignovert.fr)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.rst

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
Python package for NAIF WebGeoCalc API
2+
======================================
3+
4+
|Build| |Coverage| |PyPI| |Status| |Version| |Python| |License| |Examples|
5+
6+
.. |Build| image:: https://travis-ci.org/seignovert/python-webgeocalc.svg?branch=master
7+
:target: https://travis-ci.org/seignovert/python-webgeocalc
8+
.. |Coverage| image:: https://coveralls.io/repos/github/seignovert/python-webgeocalc/badge.svg?branch=master
9+
:target: https://coveralls.io/github/seignovert/python-webgeocalc?branch=master
10+
.. |PyPI| image:: https://img.shields.io/badge/PyPI-webgeocalc-blue.svg
11+
:target: https://pypi.org/project/webgeocalc
12+
.. |Status| image:: https://img.shields.io/pypi/status/webgeocalc.svg?label=Status
13+
:target: https://pypi.org/project/webgeocalc
14+
.. |Version| image:: https://img.shields.io/pypi/v/webgeocalc.svg?label=Version
15+
:target: https://pypi.org/project/webgeocalc
16+
.. |Python| image:: https://img.shields.io/pypi/pyversions/webgeocalc.svg?label=Python
17+
:target: https://pypi.org/project/webgeocalc
18+
.. |License| image:: https://img.shields.io/pypi/l/webgeocalc.svg?label=License
19+
:target: https://pypi.org/project/webgeocalc
20+
.. |Examples| image:: https://img.shields.io/badge/Jupyter%20Notebook-examples-blue.svg
21+
:target: https://nbviewer.jupyter.org/github/seignovert/python-webgeocalc/blob/master/examples/api.ipynb
22+
23+
24+
In december 2018, `JPL/NAIF`_ announced an **experimental**
25+
`API RESTful interface`_ for their new `WebGeocalc server`_
26+
(which make online SPICE calculations).
27+
Documentation_ and `JavaScript examples`_ are already available.
28+
29+
This package is an **early attempt** to provide a Python interface to
30+
make SPICE calculation through this API.
31+
32+
.. _`JPL/NAIF`: https://naif.jpl.nasa.gov/naif/webgeocalc.html
33+
.. _`API RESTful interface`: https://naif.jpl.nasa.gov/naif/WebGeocalc_announcement.pdf
34+
.. _`WebGeocalc server`: https://wgc2.jpl.nasa.gov:8443/webgeocalc
35+
.. _Documentation: https://wgc2.jpl.nasa.gov:8443/webgeocalc/documents/api-info.html
36+
.. _`JavaScript examples`: https://wgc2.jpl.nasa.gov:8443/webgeocalc/example/perform-calculation.html
37+
38+
Install
39+
-------
40+
With ``pip``:
41+
42+
.. code:: bash
43+
44+
$ pip install webgeocalc
45+
46+
With the ``source files``:
47+
48+
.. code:: bash
49+
50+
$ git clone https://github.com/seignovert/python-webgeocalc.git webgeocalc
51+
$ cd webgeocalc ; python setup.py install
52+
53+
Usage
54+
-----
55+
56+
.. code:: python
57+
58+
>>> from webgeocalc import API
59+
60+
>>> API.url
61+
'https://wgc2.jpl.nasa.gov:8443/webgeocalc/api'
62+
63+
>>> kernels = API.kernel_sets() # /kernel-sets
64+
[
65+
<KernelSetDetails> Solar System Kernels (id: 1),
66+
<KernelSetDetails> Latest Leapseconds Kernel (id: 2),
67+
...
68+
<KernelSetDetails> SPICE Class -- Binary PCK Lesson Kernels (Earth) (id: 39)
69+
]
70+
71+
>>> kernel = kernels[0]
72+
>>> int(kernel) # kernelSetId
73+
1
74+
75+
>>> str(kernel) # Caption
76+
'Solar System Kernels'
77+
78+
>>> kernel.description
79+
'Generic kernels for planets, satellites, and some asteroids covering from 1950-01-01 to 2050-01-01.'
80+
81+
>>> kernel.keys()
82+
dict_keys(['caption', 'sclkId', 'description', 'kernelSetId', 'missionId'])
83+
84+
>>> kernel.values()
85+
dict_values(['Solar System Kernels', '0', 'Generic kernels for planets, satellites, and some asteroids covering from 1950-01-01 to 2050-01-01.', '1', 'gen'])
86+
87+
88+
Disclaimer
89+
----------
90+
This project is not supported or endorsed by either JPL, NAIF or NASA.
91+
The code is provided *"as is"*, use at your own risk.

examples/api.ipynb

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"Python package for NAIF WebGeoCalc API\n",
8+
"======================================\n",
9+
"\n",
10+
"In december 2018, [JPL/NAIF](https://naif.jpl.nasa.gov/naif/webgeocalc.html)\n",
11+
"announced an **experimental**\n",
12+
"[API RESTful interface](https://naif.jpl.nasa.gov/naif/WebGeocalc_announcement.pdf)\n",
13+
"for their new \n",
14+
"[WebGeocalc server](https://wgc2.jpl.nasa.gov:8443/webgeocalc)\n",
15+
"(which make online SPICE calculations).\n",
16+
"[Documentation](https://wgc2.jpl.nasa.gov:8443/webgeocalc/documents/api-info.html)\n",
17+
"and [JavaScript examples](https://wgc2.jpl.nasa.gov:8443/webgeocalc/example/perform-calculation.html)\n",
18+
"are already available.\n",
19+
"\n",
20+
"This package is an **early attempt** to provide a Python interface to\n",
21+
"make SPICE calculation through this API.\n",
22+
"\n",
23+
"\n",
24+
"Disclaimer\n",
25+
"----------\n",
26+
"This project is not supported or endorsed by either JPL, NAIF or NASA.\n",
27+
"The code is provided *\"as is\"*, use at your own risk."
28+
]
29+
},
30+
{
31+
"cell_type": "code",
32+
"execution_count": 1,
33+
"metadata": {},
34+
"outputs": [
35+
{
36+
"data": {
37+
"text/plain": [
38+
"'https://wgc2.jpl.nasa.gov:8443/webgeocalc/api'"
39+
]
40+
},
41+
"execution_count": 1,
42+
"metadata": {},
43+
"output_type": "execute_result"
44+
}
45+
],
46+
"source": [
47+
"from webgeocalc import API\n",
48+
"\n",
49+
"API.url"
50+
]
51+
},
52+
{
53+
"cell_type": "code",
54+
"execution_count": 2,
55+
"metadata": {},
56+
"outputs": [
57+
{
58+
"data": {
59+
"text/plain": [
60+
"[<KernelSetDetails> Solar System Kernels (id: 1),\n",
61+
" <KernelSetDetails> Latest Leapseconds Kernel (id: 2),\n",
62+
" <KernelSetDetails> Latest Planetary Constants Kernel (id: 3),\n",
63+
" <KernelSetDetails> Ground Stations Kernels (id: 4),\n",
64+
" <KernelSetDetails> Cassini Huygens (id: 5),\n",
65+
" <KernelSetDetails> Clementine (id: 6),\n",
66+
" <KernelSetDetails> Dawn (id: 7),\n",
67+
" <KernelSetDetails> Deep Impact (Primary mission) (id: 8),\n",
68+
" <KernelSetDetails> Deep Impact (EPOXI mission) (id: 9),\n",
69+
" <KernelSetDetails> Deep Space 1 (id: 10),\n",
70+
" <KernelSetDetails> GRAIL (id: 11),\n",
71+
" <KernelSetDetails> Hayabusa (id: 12),\n",
72+
" <KernelSetDetails> JUNO (id: 13),\n",
73+
" <KernelSetDetails> Lunar Reconnaissance Orbiter (id: 14),\n",
74+
" <KernelSetDetails> MAVEN (id: 15),\n",
75+
" <KernelSetDetails> MER1 Rover (Opportunity) (id: 16),\n",
76+
" <KernelSetDetails> MER2 Rover (Spirit) (id: 17),\n",
77+
" <KernelSetDetails> MESSENGER (id: 18),\n",
78+
" <KernelSetDetails> Mars Express (id: 19),\n",
79+
" <KernelSetDetails> Mars Global Surveyor (id: 20),\n",
80+
" <KernelSetDetails> Mars Odyssey (id: 21),\n",
81+
" <KernelSetDetails> Mars Reconnaissance Orbiter (id: 22),\n",
82+
" <KernelSetDetails> MSL Rover (Curiosity) (id: 23),\n",
83+
" <KernelSetDetails> NEAR (id: 24),\n",
84+
" <KernelSetDetails> New Horizons (id: 25),\n",
85+
" <KernelSetDetails> OSIRIS-REx (id: 26),\n",
86+
" <KernelSetDetails> Rosetta (id: 27),\n",
87+
" <KernelSetDetails> Stardust (id: 28),\n",
88+
" <KernelSetDetails> Venus Climate Orbiter (id: 29),\n",
89+
" <KernelSetDetails> Venus Express (id: 30),\n",
90+
" <KernelSetDetails> Viking Orbiters (id: 31),\n",
91+
" <KernelSetDetails> LADEE (id: 32),\n",
92+
" <KernelSetDetails> SPICE Class -- CASSINI Remote Sensing Lesson Kernels (id: 33),\n",
93+
" <KernelSetDetails> SPICE Class -- ExoMars 2016 Remote Sensing Lesson Kernels (id: 34),\n",
94+
" <KernelSetDetails> SPICE Class -- In-situ Sensing Lesson Kernels (id: 35),\n",
95+
" <KernelSetDetails> SPICE Class -- Mars Express Geometric Event Finding Lesson Kernels (id: 36),\n",
96+
" <KernelSetDetails> SPICE Class -- ExoMars 2016 Geometric Event Finding Lesson Kernels (id: 37),\n",
97+
" <KernelSetDetails> SPICE Class -- Binary PCK Lesson Kernels (Moon) (id: 38),\n",
98+
" <KernelSetDetails> SPICE Class -- Binary PCK Lesson Kernels (Earth) (id: 39)]"
99+
]
100+
},
101+
"execution_count": 2,
102+
"metadata": {},
103+
"output_type": "execute_result"
104+
}
105+
],
106+
"source": [
107+
"kernels = API.kernel_sets() # /kernel-sets\n",
108+
"kernels"
109+
]
110+
},
111+
{
112+
"cell_type": "code",
113+
"execution_count": 3,
114+
"metadata": {},
115+
"outputs": [
116+
{
117+
"data": {
118+
"text/plain": [
119+
"1"
120+
]
121+
},
122+
"execution_count": 3,
123+
"metadata": {},
124+
"output_type": "execute_result"
125+
}
126+
],
127+
"source": [
128+
"kernel = kernels[0]\n",
129+
"int(kernel) # kernelSetId"
130+
]
131+
},
132+
{
133+
"cell_type": "code",
134+
"execution_count": 4,
135+
"metadata": {},
136+
"outputs": [
137+
{
138+
"data": {
139+
"text/plain": [
140+
"'Solar System Kernels'"
141+
]
142+
},
143+
"execution_count": 4,
144+
"metadata": {},
145+
"output_type": "execute_result"
146+
}
147+
],
148+
"source": [
149+
"str(kernel) # Caption"
150+
]
151+
},
152+
{
153+
"cell_type": "code",
154+
"execution_count": 5,
155+
"metadata": {},
156+
"outputs": [
157+
{
158+
"data": {
159+
"text/plain": [
160+
"'Generic kernels for planets, satellites, and some asteroids covering from 1950-01-01 to 2050-01-01.'"
161+
]
162+
},
163+
"execution_count": 5,
164+
"metadata": {},
165+
"output_type": "execute_result"
166+
}
167+
],
168+
"source": [
169+
"kernel.description"
170+
]
171+
},
172+
{
173+
"cell_type": "code",
174+
"execution_count": 6,
175+
"metadata": {},
176+
"outputs": [
177+
{
178+
"data": {
179+
"text/plain": [
180+
"dict_keys(['caption', 'sclkId', 'description', 'kernelSetId', 'missionId'])"
181+
]
182+
},
183+
"execution_count": 6,
184+
"metadata": {},
185+
"output_type": "execute_result"
186+
}
187+
],
188+
"source": [
189+
"kernel.keys()"
190+
]
191+
},
192+
{
193+
"cell_type": "code",
194+
"execution_count": 7,
195+
"metadata": {},
196+
"outputs": [
197+
{
198+
"data": {
199+
"text/plain": [
200+
"dict_values(['Solar System Kernels', '0', 'Generic kernels for planets, satellites, and some asteroids covering from 1950-01-01 to 2050-01-01.', '1', 'gen'])"
201+
]
202+
},
203+
"execution_count": 7,
204+
"metadata": {},
205+
"output_type": "execute_result"
206+
}
207+
],
208+
"source": [
209+
"kernel.values()"
210+
]
211+
}
212+
],
213+
"metadata": {
214+
"kernelspec": {
215+
"display_name": "Python 3",
216+
"language": "python",
217+
"name": "python3"
218+
},
219+
"language_info": {
220+
"codemirror_mode": {
221+
"name": "ipython",
222+
"version": 3
223+
},
224+
"file_extension": ".py",
225+
"mimetype": "text/x-python",
226+
"name": "python",
227+
"nbconvert_exporter": "python",
228+
"pygments_lexer": "ipython3",
229+
"version": "3.6.6"
230+
}
231+
},
232+
"nbformat": 4,
233+
"nbformat_minor": 2
234+
}

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
requests

0 commit comments

Comments
 (0)