[![DOI](https://zenodo.org/badge/93170857.svg)](https://zenodo.org/badge/latestdoi/93170857)
[![Build Status](https://app.travis-ci.com/hapi-server/client-python.svg?branch=master)](https://app.travis-ci.com/hapi-server/client-python)
**HAPI Client for Python**
Basic usage examples for various HAPI servers are given in [hapi_demo.py](https://github.com/hapi-server/client-python/blob/master/hapi_demo.py) and the Examples section of a Jupyter Notebook hosted on Google Colab: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/hapi-server/client-python-notebooks/blob/master/hapi_demo.ipynb#examples).
# Installation
```bash
pip install hapiclient --upgrade
# or
pip install 'git+https://github.com/hapi-server/client-python' --upgrade
```
The optional [hapiplot package](https://github.com/hapi-server/plot-python) provides basic preview plotting capabilities of data from a HAPI server. The [Plotting section](https://colab.research.google.com/github/hapi-server/client-python-notebooks/blob/master/hapi_demo.ipynb#plotting) of the `hapiclient` Jupyter Notebook shows how to plot the output of `hapiclient` using many other plotting libraries.
To install `hapiplot`, use
```bash
python -m pip install hapiplot --upgrade
# or
python -m pip install 'git+https://github.com/hapi-server/plot-python' --upgrade
```
See the [Appendix](#appendix) for a fail-safe installation method.
# Basic Example
```python
# Get Dst index from CDAWeb HAPI server
from hapiclient import hapi
# See http://hapi-server.org/servers/ for a list of
# other HAPI servers and datasets.
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)
print(meta)
print(data)
# Plot all parameters
from hapiplot import hapiplot
hapiplot(data, meta)
```
# Documentation
Basic usage examples for various HAPI servers are given in [hapi_demo.py](https://github.com/hapi-server/client-python/blob/master/hapi_demo.py>) and the [Examples section](https://colab.research.google.com/github/hapi-server/client-python-notebooks/blob/master/hapi_demo.ipynb#examples) of a Jupyter Notebook hosted on Google Colab.
See http://hapi-server.org/servers/ for a list of HAPI servers and datasets.
All of the features are extensively demonstrated in [hapi_demo.ipynb](https://colab.research.google.com/github/hapi-server/client-python-notebooks/blob/master/hapi_demo.ipynb#data-model), a Jupyter Notebook that can be viewed an executed on Google Colab.
# Metadata Model
See also the examples in the [Metadata Model section](https://colab.research.google.com/github/hapi-server/client-python-notebooks/blob/master/hapi_demo.ipynb) of the `hapiclient` Jupyter Notebook.
The HAPI client metadata model is intentionally minimal and closely follows that of the [HAPI metadata model](https://github.com/hapi-server/data-specification). We expect that another library will be developed that allows high-level search and grouping of information from HAPI servers. See also [issue #106](https://github.com/hapi-server/data-specification/issues/106).
# Data Model and Time Format
See also the examples in the [Data Model section](https://colab.research.google.com/github/hapi-server/client-python-notebooks/blob/master/hapi_demo.ipynb) of the `hapiclient` Jupyter Notebook. The examples include
1. Fast and well-tested conversion from ISO 8601 timestamp strings to Python `datetime` objects
2. Putting the content of `data` in a Pandas `DataFrame` object
3. Creating an Astropy NDArray
A request for data of the form
```
data, meta = hapi(server, dataset, parameters, start, stop)
```
returns the [Numpy N-D array](https://docs.scipy.org/doc/numpy-1.15.1/user/quickstart.html) `data` and a Python dictionary `meta` from a HAPI-compliant data server `server`. The structure of `data` and `meta` mirrors the structure of a response from a HAPI server.
The HAPI client data model is intentionally basic. There is an ongoing discussion of a data model for Heliophysics data among the [PyHC community](https://heliopython.org/). When this data model is complete, a function that converts `data` and `meta` to that data model will be included in the `hapiclient` package.
# Development
```bash
git clone https://github.com/hapi-server/client-python
cd client-python; python -m pip install -e .
```
or, create an isolated Anaconda installation (downloads and installs latest Miniconda3) using
``` bash
make install PYTHON=python3.6
# Execute command displayed to activate isolated environment
```
The command `pip install -e .` creates symlinks so that the local package is
used instead of an installed package. You may need to execute `python -m pip uninstall hapiclient` to ensure the local package is used. To check the version installed, use `python -m pip list | grep hapiclient`.
To run tests before a commit, execute
```bash
make repository-test
```
To run an individual unit test in a Python session, use, e.g.,
```python
from hapiclient.test.test_hapi import test_reader_short
test_reader_short()
```
# Contact
Submit bug reports and feature requests on the [repository issue
tracker](https://github.com/hapi-server/client-python/issues>).
Raw data
{
"_id": null,
"home_page": "http://pypi.python.org/pypi/hapiclient/",
"name": "hapiclient",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Bob Weigel",
"author_email": "rweigel@gmu.edu",
"download_url": "https://files.pythonhosted.org/packages/33/28/aa511c97a5495f7554a8df5d9b37ec8736f804c9f3fd9f298a96b963995e/hapiclient-0.2.6.tar.gz",
"platform": null,
"description": "[![DOI](https://zenodo.org/badge/93170857.svg)](https://zenodo.org/badge/latestdoi/93170857)\n[![Build Status](https://app.travis-ci.com/hapi-server/client-python.svg?branch=master)](https://app.travis-ci.com/hapi-server/client-python)\n\n**HAPI Client for Python**\n\nBasic usage examples for various HAPI servers are given in [hapi_demo.py](https://github.com/hapi-server/client-python/blob/master/hapi_demo.py) and the Examples section of a Jupyter Notebook hosted on Google Colab: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/hapi-server/client-python-notebooks/blob/master/hapi_demo.ipynb#examples).\n\n# Installation\n\n```bash\npip install hapiclient --upgrade\n# or\npip install 'git+https://github.com/hapi-server/client-python' --upgrade\n```\n\nThe optional [hapiplot package](https://github.com/hapi-server/plot-python) provides basic preview plotting capabilities of data from a HAPI server. The [Plotting section](https://colab.research.google.com/github/hapi-server/client-python-notebooks/blob/master/hapi_demo.ipynb#plotting) of the `hapiclient` Jupyter Notebook shows how to plot the output of `hapiclient` using many other plotting libraries.\n\nTo install `hapiplot`, use\n\n```bash\npython -m pip install hapiplot --upgrade\n# or\npython -m pip install 'git+https://github.com/hapi-server/plot-python' --upgrade\n```\n\nSee the [Appendix](#appendix) for a fail-safe installation method.\n\n# Basic Example\n\n```python\n# Get Dst index from CDAWeb HAPI server\nfrom hapiclient import hapi\n\n# See http://hapi-server.org/servers/ for a list of\n# other HAPI servers and datasets.\nserver = 'https://cdaweb.gsfc.nasa.gov/hapi'\ndataset = 'OMNI2_H0_MRG1HR'\nstart = '2003-09-01T00:00:00'\nstop = '2003-12-01T00:00:00'\nparameters = 'DST1800'\nopts = {'logging': True}\n\n# Get data\ndata, meta = hapi(server, dataset, parameters, start, stop, **opts)\nprint(meta)\nprint(data)\n\n# Plot all parameters\nfrom hapiplot import hapiplot\nhapiplot(data, meta)\n```\n\n# Documentation\n\nBasic usage examples for various HAPI servers are given in [hapi_demo.py](https://github.com/hapi-server/client-python/blob/master/hapi_demo.py>) and the [Examples section](https://colab.research.google.com/github/hapi-server/client-python-notebooks/blob/master/hapi_demo.ipynb#examples) of a Jupyter Notebook hosted on Google Colab.\n\nSee http://hapi-server.org/servers/ for a list of HAPI servers and datasets.\n\nAll of the features are extensively demonstrated in [hapi_demo.ipynb](https://colab.research.google.com/github/hapi-server/client-python-notebooks/blob/master/hapi_demo.ipynb#data-model), a Jupyter Notebook that can be viewed an executed on Google Colab.\n\n# Metadata Model\n\nSee also the examples in the [Metadata Model section](https://colab.research.google.com/github/hapi-server/client-python-notebooks/blob/master/hapi_demo.ipynb) of the `hapiclient` Jupyter Notebook.\n\nThe HAPI client metadata model is intentionally minimal and closely follows that of the [HAPI metadata model](https://github.com/hapi-server/data-specification). We expect that another library will be developed that allows high-level search and grouping of information from HAPI servers. See also [issue #106](https://github.com/hapi-server/data-specification/issues/106).\n\n# Data Model and Time Format\n\nSee also the examples in the [Data Model section](https://colab.research.google.com/github/hapi-server/client-python-notebooks/blob/master/hapi_demo.ipynb) of the `hapiclient` Jupyter Notebook. The examples include \n\n1. Fast and well-tested conversion from ISO 8601 timestamp strings to Python `datetime` objects\n2. Putting the content of `data` in a Pandas `DataFrame` object\n3. Creating an Astropy NDArray\n\nA request for data of the form\n```\ndata, meta = hapi(server, dataset, parameters, start, stop)\n```\n\nreturns the [Numpy N-D array](https://docs.scipy.org/doc/numpy-1.15.1/user/quickstart.html) `data` and a Python dictionary `meta` from a HAPI-compliant data server `server`. The structure of `data` and `meta` mirrors the structure of a response from a HAPI server.\n\nThe HAPI client data model is intentionally basic. There is an ongoing discussion of a data model for Heliophysics data among the [PyHC community](https://heliopython.org/). When this data model is complete, a function that converts `data` and `meta` to that data model will be included in the `hapiclient` package.\n\n# Development\n\n```bash\ngit clone https://github.com/hapi-server/client-python\ncd client-python; python -m pip install -e .\n```\n\nor, create an isolated Anaconda installation (downloads and installs latest Miniconda3) using\n\n``` bash\nmake install PYTHON=python3.6\n# Execute command displayed to activate isolated environment\n```\n\nThe command `pip install -e .` creates symlinks so that the local package is\nused instead of an installed package. You may need to execute `python -m pip uninstall hapiclient` to ensure the local package is used. To check the version installed, use `python -m pip list | grep hapiclient`.\n\nTo run tests before a commit, execute\n\n```bash\nmake repository-test\n```\n\nTo run an individual unit test in a Python session, use, e.g.,\n\n```python\nfrom hapiclient.test.test_hapi import test_reader_short\ntest_reader_short()\n```\n\n# Contact\n\nSubmit bug reports and feature requests on the [repository issue\ntracker](https://github.com/hapi-server/client-python/issues>).\n",
"bugtrack_url": null,
"license": "LICENSE.txt",
"summary": "Interface to Heliophysics data server API",
"version": "0.2.6",
"project_urls": {
"Homepage": "http://pypi.python.org/pypi/hapiclient/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3328aa511c97a5495f7554a8df5d9b37ec8736f804c9f3fd9f298a96b963995e",
"md5": "8c23c1bbc84415cdba33ecb2f9e39e50",
"sha256": "e7993a51815e7447795aff095ccd4d510ef4e0bbc9b9d00ab5bdd1a1000169d1"
},
"downloads": -1,
"filename": "hapiclient-0.2.6.tar.gz",
"has_sig": false,
"md5_digest": "8c23c1bbc84415cdba33ecb2f9e39e50",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 32974,
"upload_time": "2024-05-11T19:20:46",
"upload_time_iso_8601": "2024-05-11T19:20:46.351139Z",
"url": "https://files.pythonhosted.org/packages/33/28/aa511c97a5495f7554a8df5d9b37ec8736f804c9f3fd9f298a96b963995e/hapiclient-0.2.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-11 19:20:46",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "hapiclient"
}