Skip to main content

Heliophysics API

Project description

https://travis-ci.org/hapi-server/client-python.svg?branch=master

HAPI client for Python 2/3

Installation

pip install hapiclient --upgrade
# or
pip install 'git+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)
# Show documentation
#help(hapi)

# Plot all parameters
hapiplot(data, meta)
# Show documentation
#help(hapiplot)

Documentation

Basic usage examples for various HAPI servers are given in hapi_demo.py

All of the features are extensively demonstrated in the hapi_demo.ipynb Jupyter Notebook.

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. You may need to execute pip uninstall hapiclient first 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_short
test_reader_short()

Contact

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

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()).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hapiclient-0.1.5b4.tar.gz (53.6 kB view details)

Uploaded Source

File details

Details for the file hapiclient-0.1.5b4.tar.gz.

File metadata

  • Download URL: hapiclient-0.1.5b4.tar.gz
  • Upload date:
  • Size: 53.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.25.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/2.7.18

File hashes

Hashes for hapiclient-0.1.5b4.tar.gz
Algorithm Hash digest
SHA256 7cd8102c4d5ea8d18de6d819ade1a56635e7000d5549c096ab687d76c0d9dadb
MD5 a77d2cb3dd326dc5ceee7569bc4f8604
BLAKE2b-256 50ce735a36db72aa786823071d4e8c15eab3ed9d0b1c264ea0d98d54faa74bf4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page