Skip to content
Python client for HAPI
Python Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
hapiclient trivial tweak documentation Sep 26, 2019
misc version strings Jun 6, 2019
.gitignore Clean-up May 27, 2019
CHANGES.txt version strings Jun 6, 2019
LICENSE.txt Clean-up May 27, 2019
MANIFEST.in Update version before tagging Sep 19, 2018
Makefile version strings Jun 6, 2019
README.rst Clean-up May 27, 2019
TODO.md Clean-up May 27, 2019
_config.yml Set theme jekyll-theme-minimal Dec 12, 2018
hapi_demo.py Clean-up May 27, 2019
setup.py version strings Jun 6, 2019

README.rst

HAPI client for Python 2/3

Installation

Operating system command line:

pip install hapiclient --upgrade

or

pip install https://github.com/hapi-server/client-python --upgrade

See the Appendix for a fail-safe installation method.

Basic Example

# Get and plot Dst index from CDAWeb HAPI server
from hapiclient import hapi
from hapiclient import hapiplot

server     = 'https://cdaweb.gsfc.nasa.gov/hapi'
dataset    = 'OMNI2_H0_MRG1HR'
start      = '2003-09-01T00:00:00'
stop       = '2003-12-01T00:00:00'
parameters = 'DST1800'
opts       = {'logging': True}

# Get data
data, meta = hapi(server, dataset, parameters, start, stop, **opts)

# Plot all parameters
hapiplot(data, meta)

Documentation

All of the features are extensively demonstrated in the hapi_demo.ipynb Jupyter Notebook. The notebook shows example usage of the functions in this package that can be copied into a script or onto a Python command line.

To view the help string on the Python command line after installing hapiclient using pip install hapiclient, use

from hapiclient import hapi
help(hapi)

or

from hapiclient import hapiplot
help(hapiplot)

Development

git clone https://github.com/hapi-server/client-python
cd client-python; python setup.py develop

(The command python setup.py develop creates symlinks so that the local package is used instead of an installed package. Use pip uninstall hapiclient to ensure the local package is used.)

To run tests before a commit, execute

make repository-test

To run an individual unit test in a Python session, use, e.g.,

from hapiclient.test.test_hapi import test_reader
test_reader()

Contact

Submit bug reports and feature requests on the repository issue tracker.

Bob Weigel rweigel@gmu.edu

Appendix

Fail-safe installation

Python command line:

import os
print(os.popen("pip install hapiclient").read())

The above executes and displays the output of the operating system command pip install hapiclient using the shell environment associated with that installation of Python.

This method addresses a problem that is sometimes encountered when attempting to use pip packages in Anaconda. To use a pip package in Anaconda, one must use the version of pip installed with Anaconda (it is usually under a subdirectory with the name anaconda/) as opposed to the one installed with the operating system. To see the location of pip used in a given Python session, enter print(os.popen("which pip").read()).

You can’t perform that action at this time.