Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
seignovert committed Jan 13, 2019
0 parents commit b0eea47
Show file tree
Hide file tree
Showing 16 changed files with 608 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.tox
.coverage
*.egg-info
.eggs/
build/
dist/
htmlcov/
__pycache__/
AUTHORS
Changelog
33 changes: 33 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
sudo: false
language: python
cache: pip

python: 3.6

stages:
- name: test
- name: deploy
if: tag IS present

jobs:
include:
- stage: test
install:
- pip install tox-travis python-coveralls
script:
- tox
after_success:
- coveralls

- stage: deploy
script: echo 'Deploy to PyPi...'
env: PBR_VERSION=$TRAVIS_TAG
deploy:
provider: pypi
user: seignovert
password:
secure: RnvVK0k/25wCMAx/3B0umMm3F/jMTU+LQ7phFlt8fpvjP4EvZ0nxHcf7++RM8fQpWcLneY6MneLh1yZoKlkL9QadjEC9zqvqp+12hJqPrfpqhQmKE8kiuAiVZ3/uJJa6SVPNxVDHYQ0w4TUe4KYzNWQVOyXkt4tbtX60DKgKCWVWSnCFqCHNtdPrgaYoMDm+Koq0fHOLMHU4K64rWk10eo3O1w2QHmurYqxvcDwup7t7T2MKgkjfEu5iCsS5VvQTNlRCE86gxSha2xiJcU1MSx1+hGHxadPlPFuPAZVGgGyj3tplJkjvUfnaxoZedHJ5HPvmrlmFvexstXi8tOubkn2ognPf4VOrTKxnqAdYCkiLs/RARe6e3krVxgwGRbV3LsPR4YH6fSnrLvA73oDEHicumZdFIrZXe4PrXi41XMELqkMPHX/S3BbizNKbzXZzryVEXdCIP5zKywDzBfMbCgX9WrIag6QWDvUtBqfK9Z70ICqlGLlogTLEHdsyAGaRzOJYRn7SQ0VyETVE/Z53b0WbRbuDYrmDUWOZoGAIv96YgurfWwBQbpMAN5z1qMGXfAI2qj22NUzoJzbJoWrd1L0EaR/Ohe6SQHpddR+O6GNJ/tM4/6w/cWdpivhJ/K/6A2EGrsd7lddrzMRKs3DlKEX+6ul2BmHDD35ZRNupXH0=
skip_cleanup: true
distributions: sdist bdist_wheel
on:
tags: true
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) [2019 B. Seignovert](https://benoit.seignovert.fr)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
91 changes: 91 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
Python package for NAIF WebGeoCalc API
======================================

|Build| |Coverage| |PyPI| |Status| |Version| |Python| |License| |Examples|

.. |Build| image:: https://travis-ci.org/seignovert/python-webgeocalc.svg?branch=master
:target: https://travis-ci.org/seignovert/python-webgeocalc
.. |Coverage| image:: https://coveralls.io/repos/github/seignovert/python-webgeocalc/badge.svg?branch=master
:target: https://coveralls.io/github/seignovert/python-webgeocalc?branch=master
.. |PyPI| image:: https://img.shields.io/badge/PyPI-webgeocalc-blue.svg
:target: https://pypi.org/project/webgeocalc
.. |Status| image:: https://img.shields.io/pypi/status/webgeocalc.svg?label=Status
:target: https://pypi.org/project/webgeocalc
.. |Version| image:: https://img.shields.io/pypi/v/webgeocalc.svg?label=Version
:target: https://pypi.org/project/webgeocalc
.. |Python| image:: https://img.shields.io/pypi/pyversions/webgeocalc.svg?label=Python
:target: https://pypi.org/project/webgeocalc
.. |License| image:: https://img.shields.io/pypi/l/webgeocalc.svg?label=License
:target: https://pypi.org/project/webgeocalc
.. |Examples| image:: https://img.shields.io/badge/Jupyter%20Notebook-examples-blue.svg
:target: https://nbviewer.jupyter.org/github/seignovert/python-webgeocalc/blob/master/examples/api.ipynb


In december 2018, `JPL/NAIF`_ announced an **experimental**
`API RESTful interface`_ for their new `WebGeocalc server`_
(which make online SPICE calculations).
Documentation_ and `JavaScript examples`_ are already available.

This package is an **early attempt** to provide a Python interface to
make SPICE calculation through this API.

.. _`JPL/NAIF`: https://naif.jpl.nasa.gov/naif/webgeocalc.html
.. _`API RESTful interface`: https://naif.jpl.nasa.gov/naif/WebGeocalc_announcement.pdf
.. _`WebGeocalc server`: https://wgc2.jpl.nasa.gov:8443/webgeocalc
.. _Documentation: https://wgc2.jpl.nasa.gov:8443/webgeocalc/documents/api-info.html
.. _`JavaScript examples`: https://wgc2.jpl.nasa.gov:8443/webgeocalc/example/perform-calculation.html

Install
-------
With ``pip``:

.. code:: bash
$ pip install webgeocalc
With the ``source files``:

.. code:: bash
$ git clone https://github.com/seignovert/python-webgeocalc.git webgeocalc
$ cd webgeocalc ; python setup.py install
Usage
-----

.. code:: python
>>> from webgeocalc import API
>>> API.url
'https://wgc2.jpl.nasa.gov:8443/webgeocalc/api'
>>> kernels = API.kernel_sets() # /kernel-sets
[
<KernelSetDetails> Solar System Kernels (id: 1),
<KernelSetDetails> Latest Leapseconds Kernel (id: 2),
...
<KernelSetDetails> SPICE Class -- Binary PCK Lesson Kernels (Earth) (id: 39)
]
>>> kernel = kernels[0]
>>> int(kernel) # kernelSetId
1
>>> str(kernel) # Caption
'Solar System Kernels'
>>> kernel.description
'Generic kernels for planets, satellites, and some asteroids covering from 1950-01-01 to 2050-01-01.'
>>> kernel.keys()
dict_keys(['caption', 'sclkId', 'description', 'kernelSetId', 'missionId'])
>>> kernel.values()
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'])
Disclaimer
----------
This project is not supported or endorsed by either JPL, NAIF or NASA.
The code is provided *"as is"*, use at your own risk.
234 changes: 234 additions & 0 deletions examples/api.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Python package for NAIF WebGeoCalc API\n",
"======================================\n",
"\n",
"In december 2018, [JPL/NAIF](https://naif.jpl.nasa.gov/naif/webgeocalc.html)\n",
"announced an **experimental**\n",
"[API RESTful interface](https://naif.jpl.nasa.gov/naif/WebGeocalc_announcement.pdf)\n",
"for their new \n",
"[WebGeocalc server](https://wgc2.jpl.nasa.gov:8443/webgeocalc)\n",
"(which make online SPICE calculations).\n",
"[Documentation](https://wgc2.jpl.nasa.gov:8443/webgeocalc/documents/api-info.html)\n",
"and [JavaScript examples](https://wgc2.jpl.nasa.gov:8443/webgeocalc/example/perform-calculation.html)\n",
"are already available.\n",
"\n",
"This package is an **early attempt** to provide a Python interface to\n",
"make SPICE calculation through this API.\n",
"\n",
"\n",
"Disclaimer\n",
"----------\n",
"This project is not supported or endorsed by either JPL, NAIF or NASA.\n",
"The code is provided *\"as is\"*, use at your own risk."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'https://wgc2.jpl.nasa.gov:8443/webgeocalc/api'"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from webgeocalc import API\n",
"\n",
"API.url"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<KernelSetDetails> Solar System Kernels (id: 1),\n",
" <KernelSetDetails> Latest Leapseconds Kernel (id: 2),\n",
" <KernelSetDetails> Latest Planetary Constants Kernel (id: 3),\n",
" <KernelSetDetails> Ground Stations Kernels (id: 4),\n",
" <KernelSetDetails> Cassini Huygens (id: 5),\n",
" <KernelSetDetails> Clementine (id: 6),\n",
" <KernelSetDetails> Dawn (id: 7),\n",
" <KernelSetDetails> Deep Impact (Primary mission) (id: 8),\n",
" <KernelSetDetails> Deep Impact (EPOXI mission) (id: 9),\n",
" <KernelSetDetails> Deep Space 1 (id: 10),\n",
" <KernelSetDetails> GRAIL (id: 11),\n",
" <KernelSetDetails> Hayabusa (id: 12),\n",
" <KernelSetDetails> JUNO (id: 13),\n",
" <KernelSetDetails> Lunar Reconnaissance Orbiter (id: 14),\n",
" <KernelSetDetails> MAVEN (id: 15),\n",
" <KernelSetDetails> MER1 Rover (Opportunity) (id: 16),\n",
" <KernelSetDetails> MER2 Rover (Spirit) (id: 17),\n",
" <KernelSetDetails> MESSENGER (id: 18),\n",
" <KernelSetDetails> Mars Express (id: 19),\n",
" <KernelSetDetails> Mars Global Surveyor (id: 20),\n",
" <KernelSetDetails> Mars Odyssey (id: 21),\n",
" <KernelSetDetails> Mars Reconnaissance Orbiter (id: 22),\n",
" <KernelSetDetails> MSL Rover (Curiosity) (id: 23),\n",
" <KernelSetDetails> NEAR (id: 24),\n",
" <KernelSetDetails> New Horizons (id: 25),\n",
" <KernelSetDetails> OSIRIS-REx (id: 26),\n",
" <KernelSetDetails> Rosetta (id: 27),\n",
" <KernelSetDetails> Stardust (id: 28),\n",
" <KernelSetDetails> Venus Climate Orbiter (id: 29),\n",
" <KernelSetDetails> Venus Express (id: 30),\n",
" <KernelSetDetails> Viking Orbiters (id: 31),\n",
" <KernelSetDetails> LADEE (id: 32),\n",
" <KernelSetDetails> SPICE Class -- CASSINI Remote Sensing Lesson Kernels (id: 33),\n",
" <KernelSetDetails> SPICE Class -- ExoMars 2016 Remote Sensing Lesson Kernels (id: 34),\n",
" <KernelSetDetails> SPICE Class -- In-situ Sensing Lesson Kernels (id: 35),\n",
" <KernelSetDetails> SPICE Class -- Mars Express Geometric Event Finding Lesson Kernels (id: 36),\n",
" <KernelSetDetails> SPICE Class -- ExoMars 2016 Geometric Event Finding Lesson Kernels (id: 37),\n",
" <KernelSetDetails> SPICE Class -- Binary PCK Lesson Kernels (Moon) (id: 38),\n",
" <KernelSetDetails> SPICE Class -- Binary PCK Lesson Kernels (Earth) (id: 39)]"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"kernels = API.kernel_sets() # /kernel-sets\n",
"kernels"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"kernel = kernels[0]\n",
"int(kernel) # kernelSetId"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Solar System Kernels'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"str(kernel) # Caption"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Generic kernels for planets, satellites, and some asteroids covering from 1950-01-01 to 2050-01-01.'"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"kernel.description"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"dict_keys(['caption', 'sclkId', 'description', 'kernelSetId', 'missionId'])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"kernel.keys()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"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'])"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"kernel.values()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests
Loading

0 comments on commit b0eea47

Please sign in to comment.