cdasws 1.8.9__tar.gz → 1.8.11__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.
- cdasws-1.8.11/LICENSE +249 -0
- cdasws-1.8.11/PKG-INFO +162 -0
- {cdasws-1.8.9 → cdasws-1.8.11}/README.md +16 -3
- {cdasws-1.8.9 → cdasws-1.8.11}/cdasws/__init__.py +25 -8
- {cdasws-1.8.9 → cdasws-1.8.11}/cdasws/__main__.py +32 -9
- {cdasws-1.8.9 → cdasws-1.8.11}/cdasws/timeinterval.py +8 -8
- cdasws-1.8.11/cdasws.egg-info/PKG-INFO +162 -0
- {cdasws-1.8.9 → cdasws-1.8.11}/cdasws.egg-info/SOURCES.txt +5 -1
- {cdasws-1.8.9 → cdasws-1.8.11}/cdasws.egg-info/requires.txt +3 -0
- {cdasws-1.8.9 → cdasws-1.8.11}/setup.py +2 -2
- cdasws-1.8.11/tests/test_cdasws.py +1414 -0
- cdasws-1.8.11/tests/test_datarequest.py +350 -0
- cdasws-1.8.11/tests/test_timeinterval.py +172 -0
- cdasws-1.8.9/PKG-INFO +0 -130
- cdasws-1.8.9/cdasws.egg-info/PKG-INFO +0 -130
- {cdasws-1.8.9 → cdasws-1.8.11}/cdasws/datarepresentation.py +0 -0
- {cdasws-1.8.9 → cdasws-1.8.11}/cdasws/datarequest.py +0 -0
- {cdasws-1.8.9 → cdasws-1.8.11}/cdasws.egg-info/dependency_links.txt +0 -0
- {cdasws-1.8.9 → cdasws-1.8.11}/cdasws.egg-info/top_level.txt +0 -0
- {cdasws-1.8.9 → cdasws-1.8.11}/setup.cfg +0 -0
cdasws-1.8.11/LICENSE
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
NASA OPEN SOURCE AGREEMENT VERSION 1.3
|
|
2
|
+
|
|
3
|
+
THIS OPEN SOURCE AGREEMENT ("AGREEMENT") DEFINES THE RIGHTS OF USE,
|
|
4
|
+
REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN
|
|
5
|
+
COMPUTER SOFTWARE ORIGINALLY RELEASED BY THE UNITED STATES GOVERNMENT
|
|
6
|
+
AS REPRESENTED BY THE GOVERNMENT AGENCY LISTED BELOW ("GOVERNMENT
|
|
7
|
+
AGENCY"). THE UNITED STATES GOVERNMENT, AS REPRESENTED BY GOVERNMENT
|
|
8
|
+
AGENCY, IS AN INTENDED THIRD-PARTY BENEFICIARY OF ALL SUBSEQUENT
|
|
9
|
+
DISTRIBUTIONS OR REDISTRIBUTIONS OF THE SUBJECT SOFTWARE. ANYONE WHO
|
|
10
|
+
USES, REPRODUCES, DISTRIBUTES, MODIFIES OR REDISTRIBUTES THE SUBJECT
|
|
11
|
+
SOFTWARE, AS DEFINED HEREIN, OR ANY PART THEREOF, IS, BY THAT ACTION,
|
|
12
|
+
ACCEPTING IN FULL THE RESPONSIBILITIES AND OBLIGATIONS CONTAINED IN
|
|
13
|
+
THIS AGREEMENT.
|
|
14
|
+
|
|
15
|
+
Government Agency: National Aeronautics and Space Administration (NASA)
|
|
16
|
+
Government Agency Original Software Designation: GSC-14730-1
|
|
17
|
+
Government Agency Original Software Title: "Space Physics Data Facility Web Services"
|
|
18
|
+
User Registration Requested. Please Visit http://spdf.gsfc.nasa.gov/
|
|
19
|
+
Government Agency Point of Contact for Original Software:
|
|
20
|
+
gsfc-spdf-support@lists.nasa.gov
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
1. DEFINITIONS
|
|
24
|
+
|
|
25
|
+
A. "Contributor" means Government Agency, as the developer of the
|
|
26
|
+
Original Software, and any entity that makes a Modification.
|
|
27
|
+
B. "Covered Patents" mean patent claims licensable by a Contributor
|
|
28
|
+
that are necessarily infringed by the use or sale of its Modification
|
|
29
|
+
alone or when combined with the Subject Software.
|
|
30
|
+
C. "Display" means the showing of a copy of the Subject Software,
|
|
31
|
+
either directly or by means of an image, or any other device.
|
|
32
|
+
D. "Distribution" means conveyance or transfer of the Subject
|
|
33
|
+
Software, regardless of means, to another.
|
|
34
|
+
E. "Larger Work" means computer software that combines Subject
|
|
35
|
+
Software, or portions thereof, with software separate from the Subject
|
|
36
|
+
Software that is not governed by the terms of this Agreement.
|
|
37
|
+
F. "Modification" means any alteration of, including addition to or
|
|
38
|
+
deletion from, the substance or structure of either the Original
|
|
39
|
+
Software or Subject Software, and includes derivative works, as that
|
|
40
|
+
term is defined in the Copyright Statute, 17 USC 101. However, the
|
|
41
|
+
act of including Subject Software as part of a Larger Work does not in
|
|
42
|
+
and of itself constitute a Modification.
|
|
43
|
+
G. "Original Software" means the computer software first released
|
|
44
|
+
under this Agreement by Government Agency with Government Agency
|
|
45
|
+
designation "GSC-14730-1" and entitled
|
|
46
|
+
"Space Physics Data Facility Web Services", including source code,
|
|
47
|
+
object code and accompanying documentation, if any.
|
|
48
|
+
H. "Recipient" means anyone who acquires the Subject Software under
|
|
49
|
+
this Agreement, including all Contributors.
|
|
50
|
+
I. "Redistribution" means Distribution of the Subject Software after a
|
|
51
|
+
Modification has been made.
|
|
52
|
+
J. "Reproduction" means the making of a counterpart, image or copy of
|
|
53
|
+
the Subject Software.
|
|
54
|
+
K. "Sale" means the exchange of the Subject Software for money or
|
|
55
|
+
equivalent value.
|
|
56
|
+
L. "Subject Software" means the Original Software, Modifications, or
|
|
57
|
+
any respective parts thereof.
|
|
58
|
+
M. "Use" means the application or employment of the Subject Software
|
|
59
|
+
for any purpose.
|
|
60
|
+
|
|
61
|
+
2. GRANT OF RIGHTS
|
|
62
|
+
|
|
63
|
+
A. Under Non-Patent Rights: Subject to the terms and conditions of
|
|
64
|
+
this Agreement, each Contributor, with respect to its own contribution
|
|
65
|
+
to the Subject Software, hereby grants to each Recipient a
|
|
66
|
+
non-exclusive, world-wide, royalty-free license to engage in the
|
|
67
|
+
following activities pertaining to the Subject Software:
|
|
68
|
+
|
|
69
|
+
1. Use
|
|
70
|
+
2. Distribution
|
|
71
|
+
3. Reproduction
|
|
72
|
+
4. Modification
|
|
73
|
+
5. Redistribution
|
|
74
|
+
6. Display
|
|
75
|
+
|
|
76
|
+
B. Under Patent Rights: Subject to the terms and conditions of this
|
|
77
|
+
Agreement, each Contributor, with respect to its own contribution to
|
|
78
|
+
the Subject Software, hereby grants to each Recipient under Covered
|
|
79
|
+
Patents a non-exclusive, world-wide, royalty-free license to engage in
|
|
80
|
+
the following activities pertaining to the Subject Software:
|
|
81
|
+
|
|
82
|
+
1. Use
|
|
83
|
+
2. Distribution
|
|
84
|
+
3. Reproduction
|
|
85
|
+
4. Sale
|
|
86
|
+
5. Offer for Sale
|
|
87
|
+
|
|
88
|
+
C. The rights granted under Paragraph B. also apply to the combination
|
|
89
|
+
of a Contributor's Modification and the Subject Software if, at the
|
|
90
|
+
time the Modification is added by the Contributor, the addition of
|
|
91
|
+
such Modification causes the combination to be covered by the Covered
|
|
92
|
+
Patents. It does not apply to any other combinations that include a
|
|
93
|
+
Modification.
|
|
94
|
+
|
|
95
|
+
D. The rights granted in Paragraphs A. and B. allow the Recipient to
|
|
96
|
+
sublicense those same rights. Such sublicense must be under the same
|
|
97
|
+
terms and conditions of this Agreement.
|
|
98
|
+
|
|
99
|
+
3. OBLIGATIONS OF RECIPIENT
|
|
100
|
+
|
|
101
|
+
A. Distribution or Redistribution of the Subject Software must be made
|
|
102
|
+
under this Agreement except for additions covered under paragraph 3H.
|
|
103
|
+
|
|
104
|
+
1. Whenever a Recipient distributes or redistributes the Subject
|
|
105
|
+
Software, a copy of this Agreement must be included with each copy
|
|
106
|
+
of the Subject Software; and
|
|
107
|
+
2. If Recipient distributes or redistributes the Subject Software in
|
|
108
|
+
any form other than source code, Recipient must also make the
|
|
109
|
+
source code freely available, and must provide with each copy of
|
|
110
|
+
the Subject Software information on how to obtain the source code
|
|
111
|
+
in a reasonable manner on or through a medium customarily used for
|
|
112
|
+
software exchange.
|
|
113
|
+
|
|
114
|
+
B. Each Recipient must ensure that the following copyright notice
|
|
115
|
+
appears prominently in the Subject Software:
|
|
116
|
+
|
|
117
|
+
Copyright (c) 2006 United States Government as represented by the
|
|
118
|
+
National Aeronautics and Space Administration. No copyright is claimed
|
|
119
|
+
in the United States under Title 17, U.S.Code. All Other Rights Reserved.
|
|
120
|
+
|
|
121
|
+
C. Each Contributor must characterize its alteration of the Subject
|
|
122
|
+
Software as a Modification and must identify itself as the originator
|
|
123
|
+
of its Modification in a manner that reasonably allows subsequent
|
|
124
|
+
Recipients to identify the originator of the Modification. In
|
|
125
|
+
fulfillment of these requirements, Contributor must include a file
|
|
126
|
+
(e.g., a change log file) that describes the alterations made and the
|
|
127
|
+
date of the alterations, identifies Contributor as originator of the
|
|
128
|
+
alterations, and consents to characterization of the alterations as a
|
|
129
|
+
Modification, for example, by including a statement that the
|
|
130
|
+
Modification is derived, directly or indirectly, from Original
|
|
131
|
+
Software provided by Government Agency. Once consent is granted, it
|
|
132
|
+
may not thereafter be revoked.
|
|
133
|
+
|
|
134
|
+
D. A Contributor may add its own copyright notice to the Subject
|
|
135
|
+
Software. Once a copyright notice has been added to the Subject
|
|
136
|
+
Software, a Recipient may not remove it without the express permission
|
|
137
|
+
of the Contributor who added the notice.
|
|
138
|
+
|
|
139
|
+
E. A Recipient may not make any representation in the Subject Software
|
|
140
|
+
or in any promotional, advertising or other material that may be
|
|
141
|
+
construed as an endorsement by Government Agency or by any prior
|
|
142
|
+
Recipient of any product or service provided by Recipient, or that may
|
|
143
|
+
seek to obtain commercial advantage by the fact of Government Agency's
|
|
144
|
+
or a prior Recipient's participation in this Agreement.
|
|
145
|
+
|
|
146
|
+
F. In an effort to track usage and maintain accurate records of the
|
|
147
|
+
Subject Software, each Recipient, upon receipt of the Subject
|
|
148
|
+
Software, is requested to register with Government Agency by visiting
|
|
149
|
+
the following website: http://opensource.gsfc.nasa.gov/. Recipient's
|
|
150
|
+
name and personal information shall be used for statistical purposes
|
|
151
|
+
only. Once a Recipient makes a Modification available, it is requested
|
|
152
|
+
that the Recipient inform Government Agency at the web site provided
|
|
153
|
+
above how to access the Modification.
|
|
154
|
+
|
|
155
|
+
G. Each Contributor represents that that its Modification is believed
|
|
156
|
+
to be Contributor's original creation and does not violate any
|
|
157
|
+
existing agreements, regulations, statutes or rules, and further that
|
|
158
|
+
Contributor has sufficient rights to grant the rights conveyed by this
|
|
159
|
+
Agreement.
|
|
160
|
+
|
|
161
|
+
H. A Recipient may choose to offer, and to charge a fee for, warranty,
|
|
162
|
+
support, indemnity and/or liability obligations to one or more other
|
|
163
|
+
Recipients of the Subject Software. A Recipient may do so, however,
|
|
164
|
+
only on its own behalf and not on behalf of Government Agency or any
|
|
165
|
+
other Recipient. Such a Recipient must make it absolutely clear that
|
|
166
|
+
any such warranty, support, indemnity and/or liability obligation is
|
|
167
|
+
offered by that Recipient alone. Further, such Recipient agrees to
|
|
168
|
+
indemnify Government Agency and every other Recipient for any
|
|
169
|
+
liability incurred by them as a result of warranty, support, indemnity
|
|
170
|
+
and/or liability offered by such Recipient.
|
|
171
|
+
|
|
172
|
+
I. A Recipient may create a Larger Work by combining Subject Software
|
|
173
|
+
with separate software not governed by the terms of this agreement and
|
|
174
|
+
distribute the Larger Work as a single product. In such case, the
|
|
175
|
+
Recipient must make sure Subject Software, or portions thereof,
|
|
176
|
+
included in the Larger Work is subject to this Agreement.
|
|
177
|
+
|
|
178
|
+
J. Notwithstanding any provisions contained herein, Recipient is
|
|
179
|
+
hereby put on notice that export of any goods or technical data from
|
|
180
|
+
the United States may require some form of export license from the
|
|
181
|
+
U.S. Government. Failure to obtain necessary export licenses may
|
|
182
|
+
result in criminal liability under U.S. laws. Government Agency
|
|
183
|
+
neither represents that a license shall not be required nor that, if
|
|
184
|
+
required, it shall be issued. Nothing granted herein provides any
|
|
185
|
+
such export license.
|
|
186
|
+
|
|
187
|
+
4. DISCLAIMER OF WARRANTIES AND LIABILITIES; WAIVER AND INDEMNIFICATION
|
|
188
|
+
|
|
189
|
+
A. No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY
|
|
190
|
+
WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY,
|
|
191
|
+
INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE
|
|
192
|
+
WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF
|
|
193
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM
|
|
194
|
+
INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR
|
|
195
|
+
FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO
|
|
196
|
+
THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER,
|
|
197
|
+
CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT
|
|
198
|
+
OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY
|
|
199
|
+
OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE.
|
|
200
|
+
FURTHER, GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES
|
|
201
|
+
REGARDING THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE,
|
|
202
|
+
AND DISTRIBUTES IT "AS IS."
|
|
203
|
+
|
|
204
|
+
B. Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS
|
|
205
|
+
AGAINST THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND
|
|
206
|
+
SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF RECIPIENT'S USE OF
|
|
207
|
+
THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES,
|
|
208
|
+
EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM
|
|
209
|
+
PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S USE OF THE SUBJECT
|
|
210
|
+
SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED
|
|
211
|
+
STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
|
|
212
|
+
PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE
|
|
213
|
+
REMEDY FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL
|
|
214
|
+
TERMINATION OF THIS AGREEMENT.
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
5. GENERAL TERMS
|
|
218
|
+
|
|
219
|
+
A. Termination: This Agreement and the rights granted hereunder will
|
|
220
|
+
terminate automatically if a Recipient fails to comply with these
|
|
221
|
+
terms and conditions, and fails to cure such noncompliance within
|
|
222
|
+
thirty (30) days of becoming aware of such noncompliance. Upon
|
|
223
|
+
termination, a Recipient agrees to immediately cease use and
|
|
224
|
+
distribution of the Subject Software. All sublicenses to the Subject
|
|
225
|
+
Software properly granted by the breaching Recipient shall survive any
|
|
226
|
+
such termination of this Agreement.
|
|
227
|
+
|
|
228
|
+
B. Severability: If any provision of this Agreement is invalid or
|
|
229
|
+
unenforceable under applicable law, it shall not affect the validity
|
|
230
|
+
or enforceability of the remainder of the terms of this Agreement.
|
|
231
|
+
|
|
232
|
+
C. Applicable Law: This Agreement shall be subject to United States
|
|
233
|
+
federal law only for all purposes, including, but not limited to,
|
|
234
|
+
determining the validity of this Agreement, the meaning of its
|
|
235
|
+
provisions and the rights, obligations and remedies of the parties.
|
|
236
|
+
|
|
237
|
+
D. Entire Understanding: This Agreement constitutes the entire
|
|
238
|
+
understanding and agreement of the parties relating to release of the
|
|
239
|
+
Subject Software and may not be superseded, modified or amended except
|
|
240
|
+
by further written agreement duly executed by the parties.
|
|
241
|
+
|
|
242
|
+
E. Binding Authority: By accepting and using the Subject Software
|
|
243
|
+
under this Agreement, a Recipient affirms its authority to bind the
|
|
244
|
+
Recipient to all terms and conditions of this Agreement and that that
|
|
245
|
+
Recipient hereby agrees to all terms and conditions herein.
|
|
246
|
+
|
|
247
|
+
F. Point of Contact: Any Recipient contact with Government Agency is
|
|
248
|
+
to be directed to the designated representative as follows:
|
|
249
|
+
feedback@spdf.gsfc.nasa.gov.
|
cdasws-1.8.11/PKG-INFO
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cdasws
|
|
3
|
+
Version: 1.8.11
|
|
4
|
+
Summary: NASA's Coordinated Data Analysis System Web Service Client Library
|
|
5
|
+
Home-page: https://cdaweb.gsfc.nasa.gov/WebServices/REST
|
|
6
|
+
Author: Bernie Harris
|
|
7
|
+
Author-email: NASA-SPDF-Support@nasa.onmicrosoft.com
|
|
8
|
+
License: NOSA
|
|
9
|
+
Keywords: heliophysics,coordinated data analysis,multi-mission,multi-instrument,space physics,spdf,cdaweb
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Environment :: Web Environment
|
|
13
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: License :: OSI Approved :: NASA Open Source Agreement v1.3 (NASA-1.3)
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: python-dateutil>=2.8.0
|
|
24
|
+
Requires-Dist: requests>=2.20
|
|
25
|
+
Requires-Dist: urllib3>=1.24.1
|
|
26
|
+
Provides-Extra: spdm
|
|
27
|
+
Requires-Dist: spacepy>=0.5.0; extra == "spdm"
|
|
28
|
+
Provides-Extra: xarray
|
|
29
|
+
Requires-Dist: cdflib>=0.4.4; extra == "xarray"
|
|
30
|
+
Provides-Extra: cache
|
|
31
|
+
Requires-Dist: requests-cache>=1.2.1; extra == "cache"
|
|
32
|
+
Dynamic: author
|
|
33
|
+
Dynamic: author-email
|
|
34
|
+
Dynamic: classifier
|
|
35
|
+
Dynamic: description
|
|
36
|
+
Dynamic: description-content-type
|
|
37
|
+
Dynamic: home-page
|
|
38
|
+
Dynamic: keywords
|
|
39
|
+
Dynamic: license
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
Dynamic: provides-extra
|
|
42
|
+
Dynamic: requires-dist
|
|
43
|
+
Dynamic: summary
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Synopsis
|
|
47
|
+
|
|
48
|
+
This library provides a simple python interface to the heliophysics data
|
|
49
|
+
and services of
|
|
50
|
+
NASA's [Coordinated Data Analysis System](https://cdaweb.gsfc.nasa.gov/)
|
|
51
|
+
(CDAS). This library implements the client side of the
|
|
52
|
+
[CDAS RESTful web services](https://cdaweb.gsfc.nasa.gov/WebServices/REST/)
|
|
53
|
+
and can return data from any of
|
|
54
|
+
[these datasets](https://cdaweb.gsfc.nasa.gov/misc/Notes.html) in a
|
|
55
|
+
[SpacePy datamodel](https://spacepy.github.io/datamodel.html),
|
|
56
|
+
[xarray.Dataset](https://docs.xarray.dev/en/stable/generated/xarray.Dataset.html), or
|
|
57
|
+
[pandas.DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html)
|
|
58
|
+
with all source and
|
|
59
|
+
[ISTP/SPDF](https://spdf.gsfc.nasa.gov/sp_use_of_cdf.html) metadata.
|
|
60
|
+
Frequently asked questions concerning this library are at
|
|
61
|
+
[FAQ](https://cdaweb.gsfc.nasa.gov/WebServices/REST/py/FAQ.html).
|
|
62
|
+
For more general details about the CDAS web services, see
|
|
63
|
+
https://cdaweb.gsfc.nasa.gov/WebServices/REST/.
|
|
64
|
+
|
|
65
|
+
## Code Example
|
|
66
|
+
|
|
67
|
+
This package contains example code calling most of the available web services.
|
|
68
|
+
To run the included example, do the following
|
|
69
|
+
|
|
70
|
+
python -m cdasws
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
Also, the following [Jupyter notebooks](https://jupyter.org/) demonstrate
|
|
74
|
+
different features of the library:
|
|
75
|
+
|
|
76
|
+
1. [Data Retrieval](https://cdaweb.gsfc.nasa.gov/WebServices/REST/jupyter/CdasWsDataRetrieval.html) ([ipynb file](https://cdaweb.gsfc.nasa.gov/WebServices/REST/jupyter/CdasWsDataRetrieval.ipynb)) demonstrating use of library with results returned in [SpacePy data model](https://spacepy.github.io/datamodel.html), [xarray.Dataset](https://docs.xarray.dev/en/stable/generated/xarray.Dataset.html), and [pandas.DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html). [Launch on Binder](https://binder.opensci.2i2c.cloud/v2/gh/berniegsfc/cdasws-notebooks/main?labpath=CdasWsDataRetrieval.ipynb).
|
|
77
|
+
2. [CDAWeb Binning Example](https://cdaweb.gsfc.nasa.gov/WebServices/REST/jupyter/CdasWsBinningExample.html) ([ipynb file](https://cdaweb.gsfc.nasa.gov/WebServices/REST/jupyter/CdasWsBinningExample.ipynb)) demonstrating use [CDAWeb binning](https://cdaweb.gsfc.nasa.gov/CDAWeb_Binning_readme.html). [Launch on Binder](https://binder.opensci.2i2c.cloud/v2/gh/berniegsfc/cdasws-notebooks/main?labpath=CdasWsBinningExample.ipynb).
|
|
78
|
+
3. [Magnetic Field Line Conjunction Example](https://sscweb.gsfc.nasa.gov/WebServices/REST/jupyter/SscWsConjunctionExample.html) ([ipynb file](https://sscweb.gsfc.nasa.gov/WebServices/REST/jupyter/SscWsConjunctionExample.ipynb)) with related data retrieval/plotting using [cdasws](https://pypi.org/project/cdasws/). [Launch on Binder](https://binder.opensci.2i2c.cloud/v2/gh/berniegsfc/sscws-notebooks/main?labpath=SscWsConjunctionExample.ipynb).
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
And at the bottom of each
|
|
82
|
+
[CDAWeb dataset description](https://cdaweb.gsfc.nasa.gov/misc/Notes.html)
|
|
83
|
+
is a "Data Access Code Examples" link that contains dataset-specific code
|
|
84
|
+
utilizing this package to access the data.
|
|
85
|
+
|
|
86
|
+
## Motivation
|
|
87
|
+
|
|
88
|
+
This library hides the HTTP, JSON/XML, and CDF details of the CDAS web
|
|
89
|
+
services. A python developer only has to deal with python objects and
|
|
90
|
+
methods (primarily the SpacePy data model or xarray.Dataset object with
|
|
91
|
+
full ISTP/SPDF metadata).
|
|
92
|
+
|
|
93
|
+
## Dependencies
|
|
94
|
+
|
|
95
|
+
The only required dependencies are the following:
|
|
96
|
+
|
|
97
|
+
1. [python-dateutil](https://pypi.org/project/python-dateutil/).
|
|
98
|
+
2. [requests](https://pypi.org/project/requests/).
|
|
99
|
+
|
|
100
|
+
If you call the get_data method then **one** of the following two sets
|
|
101
|
+
of additional dependencies are required:
|
|
102
|
+
|
|
103
|
+
1. To have get_data return the data in the SpacePy data model.
|
|
104
|
+
* [SpacePy](https://spacepy.github.io/). Refer to the SpacePy
|
|
105
|
+
documentation for the details of SpacePy's dependencies.
|
|
106
|
+
2. To have get_data return the data in an [xarray.Dataset](https://docs.xarray.dev/en/stable/generated/xarray.Dataset.html) or [pandas.DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html).
|
|
107
|
+
* [cdflib](https://pypi.org/project/cdflib/).
|
|
108
|
+
* [xarray](https://pypi.org/project/xarray/).
|
|
109
|
+
|
|
110
|
+
If you want to take advantage of HTTP caching, then install the following:
|
|
111
|
+
|
|
112
|
+
1. [requests-cache](https://pypi.org/project/requests-cache/).
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
## Installation
|
|
116
|
+
|
|
117
|
+
As noted in the dependencies above, if you intend to call the get_data
|
|
118
|
+
method, you must install **one** of the following options.
|
|
119
|
+
|
|
120
|
+
1. [SpacePy](https://spacepy.github.io/).
|
|
121
|
+
|
|
122
|
+
$ pip install -U spacepy
|
|
123
|
+
|
|
124
|
+
2. [cdflib](https://pypi.org/project/cdflib/) and [xarray](https://pypi.org/project/xarray/).
|
|
125
|
+
|
|
126
|
+
$ pip install -U cdflib
|
|
127
|
+
$ pip install -U xarray
|
|
128
|
+
|
|
129
|
+
Then, to install this package
|
|
130
|
+
|
|
131
|
+
$ pip install -U cdasws
|
|
132
|
+
|
|
133
|
+
or to include the optional cache package
|
|
134
|
+
|
|
135
|
+
$ pip install -U cdasws[cache]
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## API Reference
|
|
139
|
+
|
|
140
|
+
Refer to
|
|
141
|
+
[cdasws package API reference](https://cdaweb.gsfc.nasa.gov/WebServices/REST/py/cdasws/index.html)
|
|
142
|
+
|
|
143
|
+
or use the standard python help mechanism.
|
|
144
|
+
|
|
145
|
+
from cdasws import CdasWs
|
|
146
|
+
help(CdasWs)
|
|
147
|
+
|
|
148
|
+
## Tests
|
|
149
|
+
|
|
150
|
+
The tests directory contains
|
|
151
|
+
[unittest](https://docs.python.org/3/library/unittest.html)
|
|
152
|
+
tests.
|
|
153
|
+
|
|
154
|
+
## Contributors
|
|
155
|
+
|
|
156
|
+
Bernie Harris.
|
|
157
|
+
[e-mail](mailto:NASA-SPDF-Support@nasa.onmicrosoft.com) for support.
|
|
158
|
+
|
|
159
|
+
## License
|
|
160
|
+
|
|
161
|
+
This code is licensed under the
|
|
162
|
+
[NASA Open Source Agreement](https://cdaweb.gsfc.nasa.gov/WebServices/NASA_Open_Source_Agreement_1.3.txt) (NOSA).
|
|
@@ -48,9 +48,13 @@ full ISTP/SPDF metadata).
|
|
|
48
48
|
|
|
49
49
|
## Dependencies
|
|
50
50
|
|
|
51
|
-
The only required dependencies are
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
The only required dependencies are the following:
|
|
52
|
+
|
|
53
|
+
1. [python-dateutil](https://pypi.org/project/python-dateutil/).
|
|
54
|
+
2. [requests](https://pypi.org/project/requests/).
|
|
55
|
+
|
|
56
|
+
If you call the get_data method then **one** of the following two sets
|
|
57
|
+
of additional dependencies are required:
|
|
54
58
|
|
|
55
59
|
1. To have get_data return the data in the SpacePy data model.
|
|
56
60
|
* [SpacePy](https://spacepy.github.io/). Refer to the SpacePy
|
|
@@ -59,6 +63,11 @@ dependencies are required:
|
|
|
59
63
|
* [cdflib](https://pypi.org/project/cdflib/).
|
|
60
64
|
* [xarray](https://pypi.org/project/xarray/).
|
|
61
65
|
|
|
66
|
+
If you want to take advantage of HTTP caching, then install the following:
|
|
67
|
+
|
|
68
|
+
1. [requests-cache](https://pypi.org/project/requests-cache/).
|
|
69
|
+
|
|
70
|
+
|
|
62
71
|
## Installation
|
|
63
72
|
|
|
64
73
|
As noted in the dependencies above, if you intend to call the get_data
|
|
@@ -77,6 +86,10 @@ Then, to install this package
|
|
|
77
86
|
|
|
78
87
|
$ pip install -U cdasws
|
|
79
88
|
|
|
89
|
+
or to include the optional cache package
|
|
90
|
+
|
|
91
|
+
$ pip install -U cdasws[cache]
|
|
92
|
+
|
|
80
93
|
|
|
81
94
|
## API Reference
|
|
82
95
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
#
|
|
25
25
|
# NOSA HEADER END
|
|
26
26
|
#
|
|
27
|
-
# Copyright (c) 2018-
|
|
27
|
+
# Copyright (c) 2018-2025 United States Government as represented by
|
|
28
28
|
# the National Aeronautics and Space Administration. No copyright is
|
|
29
29
|
# claimed in the United States under Title 17, U.S.Code. All Other
|
|
30
30
|
# Rights Reserved.
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
Package for accessing the Coordinate Data Analysis System (CDAS)
|
|
36
36
|
web services <https://cdaweb.gsfc.nasa.gov/WebServices/REST/>.<br>
|
|
37
37
|
|
|
38
|
-
Copyright © 2018-
|
|
38
|
+
Copyright © 2018-2025 United States Government as represented by the
|
|
39
39
|
National Aeronautics and Space Administration. No copyright is claimed in
|
|
40
40
|
the United States under Title 17, U.S.Code. All Other Rights Reserved.
|
|
41
41
|
|
|
@@ -102,7 +102,7 @@ try:
|
|
|
102
102
|
except ImportError:
|
|
103
103
|
try:
|
|
104
104
|
import cdflib as cdf
|
|
105
|
-
import xarray as xr
|
|
105
|
+
import xarray as xr # pylint: disable=ungrouped-imports
|
|
106
106
|
CDF_XARRAY_AVAILABLE = True
|
|
107
107
|
def cdf_to_xarray(filename, to_datetime=False, to_unixtime=False,
|
|
108
108
|
fillval_to_nan=False):
|
|
@@ -130,14 +130,21 @@ except ImportError:
|
|
|
130
130
|
xarray.dataset
|
|
131
131
|
An XArray Dataset object.
|
|
132
132
|
"""
|
|
133
|
-
return cdf.cdf_to_xarray(filename, to_datetime=to_datetime,
|
|
133
|
+
return cdf.cdf_to_xarray(filename, to_datetime=to_datetime, # pylint: disable=no-member
|
|
134
134
|
to_unixtime=to_unixtime,
|
|
135
135
|
fillval_to_nan=fillval_to_nan)
|
|
136
136
|
except ImportError:
|
|
137
137
|
CDF_XARRAY_AVAILABLE = False
|
|
138
138
|
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
try:
|
|
141
|
+
import requests_cache
|
|
142
|
+
CACHE_AVAILABLE = True
|
|
143
|
+
except ImportError:
|
|
144
|
+
CACHE_AVAILABLE = False
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
__version__ = "1.8.11"
|
|
141
148
|
|
|
142
149
|
|
|
143
150
|
#
|
|
@@ -231,7 +238,8 @@ class CdasWs:
|
|
|
231
238
|
proxy=None,
|
|
232
239
|
ca_certs=None,
|
|
233
240
|
disable_ssl_certificate_validation=False,
|
|
234
|
-
user_agent=None
|
|
241
|
+
user_agent=None,
|
|
242
|
+
disable_cache=False):
|
|
235
243
|
"""
|
|
236
244
|
Creates an object representing the CDAS web services.
|
|
237
245
|
|
|
@@ -259,6 +267,8 @@ class CdasWs:
|
|
|
259
267
|
Flag indicating whether to validate the SSL certificate.
|
|
260
268
|
user_agent
|
|
261
269
|
A value that is appended to the HTTP User-Agent value.
|
|
270
|
+
disable_cache
|
|
271
|
+
Flag indicating whether to disable HTTP caching.
|
|
262
272
|
"""
|
|
263
273
|
|
|
264
274
|
self.logger = logging.getLogger(type(self).__name__)
|
|
@@ -268,6 +278,7 @@ class CdasWs:
|
|
|
268
278
|
self.logger.debug('ca_certs = %s', ca_certs)
|
|
269
279
|
self.logger.debug('disable_ssl_certificate_validation = %s',
|
|
270
280
|
disable_ssl_certificate_validation)
|
|
281
|
+
self.logger.debug('disable_cache = %s', disable_cache)
|
|
271
282
|
|
|
272
283
|
if endpoint is None:
|
|
273
284
|
self._endpoint = 'https://cdaweb.gsfc.nasa.gov/WS/cdasr/1/dataviews/sp_phys/'
|
|
@@ -288,7 +299,12 @@ class CdasWs:
|
|
|
288
299
|
'User-Agent' : self._user_agent,
|
|
289
300
|
#'Accept-Encoding' : 'gzip' # only beneficial for icdfml responses
|
|
290
301
|
}
|
|
291
|
-
|
|
302
|
+
if CACHE_AVAILABLE and disable_cache is not True:
|
|
303
|
+
self._session = requests_cache.CachedSession('cdasws_cache',
|
|
304
|
+
cache_control=True)
|
|
305
|
+
else:
|
|
306
|
+
self._session = requests.Session()
|
|
307
|
+
|
|
292
308
|
self._session.headers.update(self._request_headers)
|
|
293
309
|
self._session.auth = NullAuth()
|
|
294
310
|
|
|
@@ -961,7 +977,8 @@ class CdasWs:
|
|
|
961
977
|
|
|
962
978
|
url = 'https://doi.org/' + doi
|
|
963
979
|
headers = {'Accept': 'text/x-bibliography; style=apa'}
|
|
964
|
-
response = requests.get(url, headers=headers
|
|
980
|
+
response = requests.get(url, headers=headers,
|
|
981
|
+
timeout=30)
|
|
965
982
|
|
|
966
983
|
return response.text
|
|
967
984
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
#
|
|
25
25
|
# NOSA HEADER END
|
|
26
26
|
#
|
|
27
|
-
# Copyright (c) 2018-
|
|
27
|
+
# Copyright (c) 2018-2025 United States Government as represented by
|
|
28
28
|
# the National Aeronautics and Space Administration. No copyright is
|
|
29
29
|
# claimed in the United States under Title 17, U.S.Code. All Other
|
|
30
30
|
# Rights Reserved.
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
Example Coordinate Data Analysis System (CDAS) web service client.
|
|
35
35
|
Includes example calls to most of the web services.
|
|
36
36
|
|
|
37
|
-
Copyright © 2018-
|
|
37
|
+
Copyright © 2018-2025 United States Government as represented by the
|
|
38
38
|
National Aeronautics and Space Administration. No copyright is claimed in
|
|
39
39
|
the United States under Title 17, U.S.Code. All Other Rights Reserved.
|
|
40
40
|
"""
|
|
@@ -42,6 +42,7 @@ the United States under Title 17, U.S.Code. All Other Rights Reserved.
|
|
|
42
42
|
import sys
|
|
43
43
|
import getopt
|
|
44
44
|
import json
|
|
45
|
+
import time
|
|
45
46
|
import logging
|
|
46
47
|
import logging.config
|
|
47
48
|
from typing import List
|
|
@@ -56,7 +57,7 @@ from cdasws.datarepresentation import DataRepresentation
|
|
|
56
57
|
logging.basicConfig()
|
|
57
58
|
LOGGING_CONFIG_FILE = 'logging_config.json'
|
|
58
59
|
try:
|
|
59
|
-
with open(LOGGING_CONFIG_FILE, 'r') as fd:
|
|
60
|
+
with open(LOGGING_CONFIG_FILE, 'r', encoding='utf-8') as fd:
|
|
60
61
|
logging.config.dictConfig(json.load(fd))
|
|
61
62
|
except BaseException as exc: # pylint: disable=broad-except
|
|
62
63
|
if not isinstance(exc, FileNotFoundError):
|
|
@@ -85,9 +86,10 @@ def print_usage(
|
|
|
85
86
|
-------
|
|
86
87
|
None
|
|
87
88
|
"""
|
|
88
|
-
print('USAGE: {name} [-e url][-d][-c cacerts][-h]'
|
|
89
|
+
print(f'USAGE: {name} [-e url][-d][-c cacerts][-n][-h]')
|
|
89
90
|
print('WHERE: url = CDAS web service endpoint URL')
|
|
90
91
|
print(' -d disables TLS server certificate validation')
|
|
92
|
+
print(' -n disables the use of http caching')
|
|
91
93
|
print(' cacerts = CA certificate filename')
|
|
92
94
|
|
|
93
95
|
|
|
@@ -108,13 +110,14 @@ def example(
|
|
|
108
110
|
containing the CA certificates to use.<br>
|
|
109
111
|
-d or --disable-cert-check to disable verification of the server's
|
|
110
112
|
certificate
|
|
113
|
+
-n or --nocache disables the use of http caching
|
|
111
114
|
-h or --help prints help information.
|
|
112
115
|
"""
|
|
113
116
|
|
|
114
117
|
try:
|
|
115
|
-
opts = getopt.getopt(argv[1:], 'he:c:
|
|
118
|
+
opts = getopt.getopt(argv[1:], 'he:c:dn',
|
|
116
119
|
['help', 'endpoint=', 'cacerts=',
|
|
117
|
-
'disable-cert-check'])[0]
|
|
120
|
+
'disable-cert-check', 'nocache'])[0]
|
|
118
121
|
except getopt.GetoptError:
|
|
119
122
|
print('ERROR: invalid option')
|
|
120
123
|
print_usage(argv[0])
|
|
@@ -125,6 +128,7 @@ def example(
|
|
|
125
128
|
endpoint = ENDPOINT
|
|
126
129
|
ca_certs = None
|
|
127
130
|
disable_ssl_certificate_validation = False
|
|
131
|
+
disable_cache = False
|
|
128
132
|
|
|
129
133
|
for opt, arg in opts:
|
|
130
134
|
if opt in ('-e', '--endpoint'):
|
|
@@ -134,6 +138,8 @@ def example(
|
|
|
134
138
|
elif opt in ('-d', '--disable-cert-check'):
|
|
135
139
|
disable_ssl_certificate_validation = True
|
|
136
140
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
141
|
+
elif opt in ('-n', '--nocache'):
|
|
142
|
+
disable_cache = True
|
|
137
143
|
elif opt in ('-h', '--help'):
|
|
138
144
|
print_usage(argv[0])
|
|
139
145
|
sys.exit()
|
|
@@ -141,7 +147,8 @@ def example(
|
|
|
141
147
|
|
|
142
148
|
cdas = CdasWs(endpoint=endpoint, ca_certs=ca_certs,
|
|
143
149
|
disable_ssl_certificate_validation=
|
|
144
|
-
disable_ssl_certificate_validation,
|
|
150
|
+
disable_ssl_certificate_validation,
|
|
151
|
+
disable_cache = disable_cache, user_agent='Example')
|
|
145
152
|
|
|
146
153
|
print(cdas.get_observatory_groups(
|
|
147
154
|
instrumentType='Magnetic Fields (Balloon)'))
|
|
@@ -163,14 +170,30 @@ def example(
|
|
|
163
170
|
|
|
164
171
|
print('citation = ' + cdas.get_citation('10.48322/541v-1f57'))
|
|
165
172
|
|
|
166
|
-
|
|
173
|
+
dataset = 'MMS1_FPI_BRST_L2_DES-MOMS'
|
|
174
|
+
t0 = time.perf_counter()
|
|
175
|
+
mms_brst_inventory = cdas.get_inventory(dataset,
|
|
167
176
|
timeInterval=TimeInterval(
|
|
168
177
|
'2018-08-30T08:09:53Z',
|
|
169
178
|
'2018-08-30T08:52:00Z'))
|
|
170
|
-
|
|
179
|
+
t1 = time.perf_counter()
|
|
180
|
+
print(f'{dataset} inventory took {t1 - t0}s')
|
|
181
|
+
print(f'{dataset} inventory:')
|
|
171
182
|
for interval in mms_brst_inventory:
|
|
172
183
|
print(' ' + str(interval))
|
|
173
184
|
|
|
185
|
+
t0 = time.perf_counter()
|
|
186
|
+
mms_brst_inventory = cdas.get_inventory(dataset,
|
|
187
|
+
timeInterval=TimeInterval(
|
|
188
|
+
'2018-08-30T08:09:53Z',
|
|
189
|
+
'2018-08-30T08:52:00Z'))
|
|
190
|
+
t1 = time.perf_counter()
|
|
191
|
+
print(f'second {dataset} inventory took {t1 - t0}s')
|
|
192
|
+
print(f'second {dataset} inventory:')
|
|
193
|
+
for interval in mms_brst_inventory:
|
|
194
|
+
print(' ' + str(interval))
|
|
195
|
+
|
|
196
|
+
|
|
174
197
|
doi_inventory = cdas.get_inventory('10.21978/P8T923')
|
|
175
198
|
print('10.21978/P8T923 inventory:')
|
|
176
199
|
for interval in doi_inventory:
|