hapiclient 0.2.4__tar.gz → 0.2.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hapiclient-0.2.4 → hapiclient-0.2.6}/CHANGES.txt +13 -0
- hapiclient-0.2.4/README.md → hapiclient-0.2.6/PKG-INFO +24 -28
- hapiclient-0.2.6/README.md +117 -0
- {hapiclient-0.2.4 → hapiclient-0.2.6}/hapiclient/__init__.py +4 -1
- {hapiclient-0.2.4 → hapiclient-0.2.6}/hapiclient/hapi.py +185 -118
- {hapiclient-0.2.4 → hapiclient-0.2.6}/hapiclient/hapitime.py +54 -11
- {hapiclient-0.2.4 → hapiclient-0.2.6}/hapiclient/test/compare.py +7 -4
- {hapiclient-0.2.4 → hapiclient-0.2.6}/hapiclient/test/test_chunking.py +9 -9
- hapiclient-0.2.6/hapiclient/test/test_datetime2hapitime.py +17 -0
- {hapiclient-0.2.4 → hapiclient-0.2.6}/hapiclient/test/test_hapi.py +72 -7
- {hapiclient-0.2.4 → hapiclient-0.2.6}/hapiclient/test/test_hapitime2datetime.py +3 -2
- {hapiclient-0.2.4 → hapiclient-0.2.6}/hapiclient/test/test_hapitime_reformat.py +1 -3
- {hapiclient-0.2.4 → hapiclient-0.2.6}/hapiclient/util.py +29 -5
- hapiclient-0.2.6/hapiclient.egg-info/PKG-INFO +128 -0
- {hapiclient-0.2.4 → hapiclient-0.2.6}/hapiclient.egg-info/SOURCES.txt +1 -0
- {hapiclient-0.2.4 → hapiclient-0.2.6}/setup.py +1 -1
- hapiclient-0.2.4/PKG-INFO +0 -143
- hapiclient-0.2.4/hapiclient.egg-info/PKG-INFO +0 -143
- {hapiclient-0.2.4 → hapiclient-0.2.6}/LICENSE.txt +0 -0
- {hapiclient-0.2.4 → hapiclient-0.2.6}/MANIFEST.in +0 -0
- {hapiclient-0.2.4 → hapiclient-0.2.6}/hapiclient/test/__init__.py +0 -0
- {hapiclient-0.2.4 → hapiclient-0.2.6}/hapiclient.egg-info/dependency_links.txt +0 -0
- {hapiclient-0.2.4 → hapiclient-0.2.6}/hapiclient.egg-info/requires.txt +0 -0
- {hapiclient-0.2.4 → hapiclient-0.2.6}/hapiclient.egg-info/top_level.txt +0 -0
- {hapiclient-0.2.4 → hapiclient-0.2.6}/setup.cfg +0 -0
|
@@ -91,3 +91,16 @@ v0.2.3:
|
|
|
91
91
|
v0.2.4:
|
|
92
92
|
2022-03-07 -- 88b0eb2 try/except on file read
|
|
93
93
|
2022-03-29 -- 0042abb Fix for method=''. Closes #47.
|
|
94
|
+
v0.2.5:
|
|
95
|
+
2022-06-30 -- 10df388 Update docstring for hapi()
|
|
96
|
+
2022-07-12 -- 460c30b Final Unicode/Windows fixes
|
|
97
|
+
v0.2.6b:
|
|
98
|
+
2022-08-08 -- 508fb20-3f1168c Add datetime2hapitime
|
|
99
|
+
2022-08-08 -- 8bfef2f Allow start and stop to be None; https://github.com/hapi-server/client-python/issues/10
|
|
100
|
+
2022-09-21 -- bc70f3c CSV read failure; https://github.com/hapi-server/client-python/issues/62
|
|
101
|
+
2022-09-22 -- 373fdca Catch other CSV read failures
|
|
102
|
+
v0.2.6b1:
|
|
103
|
+
2023-02-04 -- 2ef7cff Unicode fix; Log string fix
|
|
104
|
+
2024-05-11 -- fba4ad3 Testing Updates
|
|
105
|
+
v0.2.6:
|
|
106
|
+
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: hapiclient
|
|
3
|
+
Version: 0.2.6
|
|
4
|
+
Summary: Interface to Heliophysics data server API
|
|
5
|
+
Home-page: http://pypi.python.org/pypi/hapiclient/
|
|
6
|
+
Author: Bob Weigel
|
|
7
|
+
Author-email: rweigel@gmu.edu
|
|
8
|
+
License: LICENSE.txt
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE.txt
|
|
11
|
+
|
|
1
12
|
[](https://zenodo.org/badge/latestdoi/93170857)
|
|
13
|
+
[](https://app.travis-ci.com/hapi-server/client-python)
|
|
2
14
|
|
|
3
15
|
**HAPI Client for Python**
|
|
4
16
|
|
|
5
|
-
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
|
|
17
|
+
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: [](https://colab.research.google.com/github/hapi-server/client-python-notebooks/blob/master/hapi_demo.ipynb#examples).
|
|
6
18
|
|
|
7
19
|
# Installation
|
|
8
20
|
|
|
@@ -17,9 +29,9 @@ The optional [hapiplot package](https://github.com/hapi-server/plot-python) prov
|
|
|
17
29
|
To install `hapiplot`, use
|
|
18
30
|
|
|
19
31
|
```bash
|
|
20
|
-
pip install hapiplot --upgrade
|
|
32
|
+
python -m pip install hapiplot --upgrade
|
|
21
33
|
# or
|
|
22
|
-
pip install 'git+https://github.com/hapi-server/plot-python' --upgrade
|
|
34
|
+
python -m pip install 'git+https://github.com/hapi-server/plot-python' --upgrade
|
|
23
35
|
```
|
|
24
36
|
|
|
25
37
|
See the [Appendix](#appendix) for a fail-safe installation method.
|
|
@@ -84,11 +96,18 @@ The HAPI client data model is intentionally basic. There is an ongoing discussio
|
|
|
84
96
|
|
|
85
97
|
```bash
|
|
86
98
|
git clone https://github.com/hapi-server/client-python
|
|
87
|
-
cd client-python; pip install -e .
|
|
99
|
+
cd client-python; python -m pip install -e .
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
or, create an isolated Anaconda installation (downloads and installs latest Miniconda3) using
|
|
103
|
+
|
|
104
|
+
``` bash
|
|
105
|
+
make install PYTHON=python3.6
|
|
106
|
+
# Execute command displayed to activate isolated environment
|
|
88
107
|
```
|
|
89
108
|
|
|
90
109
|
The command `pip install -e .` creates symlinks so that the local package is
|
|
91
|
-
used instead of an installed package. You may need to execute `pip uninstall hapiclient` to ensure the local package is used. To check the version installed, use `pip list | grep hapiclient`.
|
|
110
|
+
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`.
|
|
92
111
|
|
|
93
112
|
To run tests before a commit, execute
|
|
94
113
|
|
|
@@ -107,26 +126,3 @@ test_reader_short()
|
|
|
107
126
|
|
|
108
127
|
Submit bug reports and feature requests on the [repository issue
|
|
109
128
|
tracker](https://github.com/hapi-server/client-python/issues>).
|
|
110
|
-
|
|
111
|
-
# Appendix
|
|
112
|
-
|
|
113
|
-
Fail-safe installation
|
|
114
|
-
|
|
115
|
-
Python command line:
|
|
116
|
-
|
|
117
|
-
```python
|
|
118
|
-
import os
|
|
119
|
-
print(os.popen("pip install hapiclient").read())
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
The above executes and displays the output of the operating system
|
|
123
|
-
command `pip install hapiclient` using the shell environment
|
|
124
|
-
associated with that installation of Python.
|
|
125
|
-
|
|
126
|
-
This method addresses a problem that is sometimes encountered when
|
|
127
|
-
attempting to use `pip` packages in Anaconda. To use a `pip` package
|
|
128
|
-
in Anaconda, one must use the version of `pip` installed with Anaconda
|
|
129
|
-
(it is usually under a subdirectory with the name `anaconda/`) as
|
|
130
|
-
opposed to the one installed with the operating system. To see the
|
|
131
|
-
location of ``pip`` used in a given Python session, enter
|
|
132
|
-
`print(os.popen("which pip").read())`.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
[](https://zenodo.org/badge/latestdoi/93170857)
|
|
2
|
+
[](https://app.travis-ci.com/hapi-server/client-python)
|
|
3
|
+
|
|
4
|
+
**HAPI Client for Python**
|
|
5
|
+
|
|
6
|
+
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: [](https://colab.research.google.com/github/hapi-server/client-python-notebooks/blob/master/hapi_demo.ipynb#examples).
|
|
7
|
+
|
|
8
|
+
# Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install hapiclient --upgrade
|
|
12
|
+
# or
|
|
13
|
+
pip install 'git+https://github.com/hapi-server/client-python' --upgrade
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
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.
|
|
17
|
+
|
|
18
|
+
To install `hapiplot`, use
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
python -m pip install hapiplot --upgrade
|
|
22
|
+
# or
|
|
23
|
+
python -m pip install 'git+https://github.com/hapi-server/plot-python' --upgrade
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
See the [Appendix](#appendix) for a fail-safe installation method.
|
|
27
|
+
|
|
28
|
+
# Basic Example
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
# Get Dst index from CDAWeb HAPI server
|
|
32
|
+
from hapiclient import hapi
|
|
33
|
+
|
|
34
|
+
# See http://hapi-server.org/servers/ for a list of
|
|
35
|
+
# other HAPI servers and datasets.
|
|
36
|
+
server = 'https://cdaweb.gsfc.nasa.gov/hapi'
|
|
37
|
+
dataset = 'OMNI2_H0_MRG1HR'
|
|
38
|
+
start = '2003-09-01T00:00:00'
|
|
39
|
+
stop = '2003-12-01T00:00:00'
|
|
40
|
+
parameters = 'DST1800'
|
|
41
|
+
opts = {'logging': True}
|
|
42
|
+
|
|
43
|
+
# Get data
|
|
44
|
+
data, meta = hapi(server, dataset, parameters, start, stop, **opts)
|
|
45
|
+
print(meta)
|
|
46
|
+
print(data)
|
|
47
|
+
|
|
48
|
+
# Plot all parameters
|
|
49
|
+
from hapiplot import hapiplot
|
|
50
|
+
hapiplot(data, meta)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
# Documentation
|
|
54
|
+
|
|
55
|
+
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.
|
|
56
|
+
|
|
57
|
+
See http://hapi-server.org/servers/ for a list of HAPI servers and datasets.
|
|
58
|
+
|
|
59
|
+
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.
|
|
60
|
+
|
|
61
|
+
# Metadata Model
|
|
62
|
+
|
|
63
|
+
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.
|
|
64
|
+
|
|
65
|
+
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).
|
|
66
|
+
|
|
67
|
+
# Data Model and Time Format
|
|
68
|
+
|
|
69
|
+
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
|
|
70
|
+
|
|
71
|
+
1. Fast and well-tested conversion from ISO 8601 timestamp strings to Python `datetime` objects
|
|
72
|
+
2. Putting the content of `data` in a Pandas `DataFrame` object
|
|
73
|
+
3. Creating an Astropy NDArray
|
|
74
|
+
|
|
75
|
+
A request for data of the form
|
|
76
|
+
```
|
|
77
|
+
data, meta = hapi(server, dataset, parameters, start, stop)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
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.
|
|
81
|
+
|
|
82
|
+
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.
|
|
83
|
+
|
|
84
|
+
# Development
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
git clone https://github.com/hapi-server/client-python
|
|
88
|
+
cd client-python; python -m pip install -e .
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
or, create an isolated Anaconda installation (downloads and installs latest Miniconda3) using
|
|
92
|
+
|
|
93
|
+
``` bash
|
|
94
|
+
make install PYTHON=python3.6
|
|
95
|
+
# Execute command displayed to activate isolated environment
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The command `pip install -e .` creates symlinks so that the local package is
|
|
99
|
+
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`.
|
|
100
|
+
|
|
101
|
+
To run tests before a commit, execute
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
make repository-test
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
To run an individual unit test in a Python session, use, e.g.,
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from hapiclient.test.test_hapi import test_reader_short
|
|
111
|
+
test_reader_short()
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
# Contact
|
|
115
|
+
|
|
116
|
+
Submit bug reports and feature requests on the [repository issue
|
|
117
|
+
tracker](https://github.com/hapi-server/client-python/issues>).
|
|
@@ -4,10 +4,13 @@ from hapiclient.hapi import hapi
|
|
|
4
4
|
# Allow "from hapiclient import hapitime2datetime"
|
|
5
5
|
from hapiclient.hapitime import hapitime2datetime
|
|
6
6
|
|
|
7
|
+
# Allow "from hapiclient import datetime2hapitime"
|
|
8
|
+
from hapiclient.hapitime import datetime2hapitime
|
|
9
|
+
|
|
7
10
|
# Allow "from hapiclient import HAPIError"
|
|
8
11
|
from hapiclient.util import HAPIError
|
|
9
12
|
|
|
10
|
-
__version__ = '0.2.
|
|
13
|
+
__version__ = '0.2.6'
|
|
11
14
|
|
|
12
15
|
import sys
|
|
13
16
|
if sys.version_info[0] < 3:
|