cdasws 1.8.10__tar.gz → 1.8.12__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.12/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
+ NASA-SPDF-Support@nasa.onmicrosoft.com
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.12/PKG-INFO ADDED
@@ -0,0 +1,164 @@
1
+ Metadata-Version: 2.4
2
+ Name: cdasws
3
+ Version: 1.8.12
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
+ Note that this package is included in the [HelioCloud](https://heliocloud.org/)
61
+ base image, so there is no need to install it there.
62
+ Frequently asked questions concerning this library are at
63
+ [FAQ](https://cdaweb.gsfc.nasa.gov/WebServices/REST/py/FAQ.html).
64
+ For more general details about the CDAS web services, see
65
+ https://cdaweb.gsfc.nasa.gov/WebServices/REST/.
66
+
67
+ ## Code Example
68
+
69
+ This package contains example code calling most of the available web services.
70
+ To run the included example, do the following
71
+
72
+ python -m cdasws
73
+
74
+ ---
75
+ Also, the following [Jupyter notebooks](https://jupyter.org/) demonstrate
76
+ different features of the library:
77
+
78
+ 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).
79
+ 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).
80
+ 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).
81
+ ---
82
+
83
+ And at the bottom of each
84
+ [CDAWeb dataset description](https://cdaweb.gsfc.nasa.gov/misc/Notes.html)
85
+ is a "Data Access Code Examples" link that contains dataset-specific code
86
+ utilizing this package to access the data.
87
+
88
+ ## Motivation
89
+
90
+ This library hides the HTTP, JSON/XML, and CDF details of the CDAS web
91
+ services. A python developer only has to deal with python objects and
92
+ methods (primarily the SpacePy data model or xarray.Dataset object with
93
+ full ISTP/SPDF metadata).
94
+
95
+ ## Dependencies
96
+
97
+ The only required dependencies are the following:
98
+
99
+ 1. [python-dateutil](https://pypi.org/project/python-dateutil/).
100
+ 2. [requests](https://pypi.org/project/requests/).
101
+
102
+ If you call the get_data method then **one** of the following two sets
103
+ of additional dependencies are required:
104
+
105
+ 1. To have get_data return the data in the SpacePy data model.
106
+ * [SpacePy](https://spacepy.github.io/). Refer to the SpacePy
107
+ documentation for the details of SpacePy's dependencies.
108
+ 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).
109
+ * [cdflib](https://pypi.org/project/cdflib/).
110
+ * [xarray](https://pypi.org/project/xarray/).
111
+
112
+ If you want to take advantage of HTTP caching, then install the following:
113
+
114
+ 1. [requests-cache](https://pypi.org/project/requests-cache/).
115
+
116
+
117
+ ## Installation
118
+
119
+ As noted in the dependencies above, if you intend to call the get_data
120
+ method, you must install **one** of the following options.
121
+
122
+ 1. [SpacePy](https://spacepy.github.io/).
123
+
124
+ $ pip install -U spacepy
125
+
126
+ 2. [cdflib](https://pypi.org/project/cdflib/) and [xarray](https://pypi.org/project/xarray/).
127
+
128
+ $ pip install -U cdflib
129
+ $ pip install -U xarray
130
+
131
+ Then, to install this package
132
+
133
+ $ pip install -U cdasws
134
+
135
+ or to include the optional cache package
136
+
137
+ $ pip install -U cdasws[cache]
138
+
139
+
140
+ ## API Reference
141
+
142
+ Refer to
143
+ [cdasws package API reference](https://cdaweb.gsfc.nasa.gov/WebServices/REST/py/cdasws/index.html)
144
+
145
+ or use the standard python help mechanism.
146
+
147
+ from cdasws import CdasWs
148
+ help(CdasWs)
149
+
150
+ ## Tests
151
+
152
+ The tests directory contains
153
+ [unittest](https://docs.python.org/3/library/unittest.html)
154
+ tests.
155
+
156
+ ## Contributors
157
+
158
+ Bernie Harris.
159
+ [e-mail](mailto:NASA-SPDF-Support@nasa.onmicrosoft.com) for support.
160
+
161
+ ## License
162
+
163
+ This code is licensed under the
164
+ [NASA Open Source Agreement](https://cdaweb.gsfc.nasa.gov/WebServices/NASA_Open_Source_Agreement_1.3.txt) (NOSA).
@@ -13,6 +13,8 @@ and can return data from any of
13
13
  [pandas.DataFrame](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html)
14
14
  with all source and
15
15
  [ISTP/SPDF](https://spdf.gsfc.nasa.gov/sp_use_of_cdf.html) metadata.
16
+ Note that this package is included in the [HelioCloud](https://heliocloud.org/)
17
+ base image, so there is no need to install it there.
16
18
  Frequently asked questions concerning this library are at
17
19
  [FAQ](https://cdaweb.gsfc.nasa.gov/WebServices/REST/py/FAQ.html).
18
20
  For more general details about the CDAS web services, see
@@ -48,9 +50,13 @@ full ISTP/SPDF metadata).
48
50
 
49
51
  ## Dependencies
50
52
 
51
- The only required dependencies are python-dateutil and requests. If you
52
- call the get_data method then **one** of the following two sets of additional
53
- dependencies are required:
53
+ The only required dependencies are the following:
54
+
55
+ 1. [python-dateutil](https://pypi.org/project/python-dateutil/).
56
+ 2. [requests](https://pypi.org/project/requests/).
57
+
58
+ If you call the get_data method then **one** of the following two sets
59
+ of additional dependencies are required:
54
60
 
55
61
  1. To have get_data return the data in the SpacePy data model.
56
62
  * [SpacePy](https://spacepy.github.io/). Refer to the SpacePy
@@ -59,6 +65,11 @@ dependencies are required:
59
65
  * [cdflib](https://pypi.org/project/cdflib/).
60
66
  * [xarray](https://pypi.org/project/xarray/).
61
67
 
68
+ If you want to take advantage of HTTP caching, then install the following:
69
+
70
+ 1. [requests-cache](https://pypi.org/project/requests-cache/).
71
+
72
+
62
73
  ## Installation
63
74
 
64
75
  As noted in the dependencies above, if you intend to call the get_data
@@ -77,6 +88,10 @@ Then, to install this package
77
88
 
78
89
  $ pip install -U cdasws
79
90
 
91
+ or to include the optional cache package
92
+
93
+ $ pip install -U cdasws[cache]
94
+
80
95
 
81
96
  ## API Reference
82
97
 
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env python3
2
+
3
+ #
4
+ # NOSA HEADER START
5
+ #
6
+ # The contents of this file are subject to the terms of the NASA Open
7
+ # Source Agreement (NOSA), Version 1.3 only (the "Agreement"). You may
8
+ # not use this file except in compliance with the Agreement.
9
+ #
10
+ # You can obtain a copy of the agreement at
11
+ # docs/NASA_Open_Source_Agreement_1.3.txt
12
+ # or
13
+ # https://cdaweb.gsfc.nasa.gov/WebServices/NASA_Open_Source_Agreement_1.3.txt.
14
+ #
15
+ # See the Agreement for the specific language governing permissions
16
+ # and limitations under the Agreement.
17
+ #
18
+ # When distributing Covered Code, include this NOSA HEADER in each
19
+ # file and include the Agreement file at
20
+ # docs/NASA_Open_Source_Agreement_1.3.txt. If applicable, add the
21
+ # following below this NOSA HEADER, with the fields enclosed by
22
+ # brackets "[]" replaced with your own identifying information:
23
+ # Portions Copyright [yyyy] [name of copyright owner]
24
+ #
25
+ # NOSA HEADER END
26
+ #
27
+ # Copyright (c) 2018-2025 United States Government as represented by
28
+ # the National Aeronautics and Space Administration. No copyright is
29
+ # claimed in the United States under Title 17, U.S.Code. All Other
30
+ # Rights Reserved.
31
+ #
32
+
33
+
34
+ """
35
+ Package for accessing the Coordinate Data Analysis System (CDAS)
36
+ web services <https://cdaweb.gsfc.nasa.gov/WebServices/REST/>.<br>
37
+
38
+ Copyright &copy; 2018-2025 United States Government as represented by the
39
+ National Aeronautics and Space Administration. No copyright is claimed in
40
+ the United States under Title 17, U.S.Code. All Other Rights Reserved.
41
+
42
+ Notes
43
+ -----
44
+ <ul>
45
+ <li>Due to rate limiting implemented by the CDAS web services, an
46
+ attempt to make simultaneous requests from many threads is likely
47
+ to actually reduce performance. At this time, it is best to make
48
+ calls from five or fewer threads.</li>
49
+ <li>Since CDAS data has datetime values with a UTC timezone, all
50
+ client provided datetime values should have a timezone of UTC.
51
+ If a given value's timezone is not UTC, the value is adjusted to
52
+ UTC. If a given value has no timezone (is naive), a UTC timezone
53
+ is set.</li>
54
+ </ul>
55
+ """
56
+
57
+
58
+ __version__ = "1.8.12"
59
+
60
+
61
+ #
62
+ # Limit on the number of times an HTTP request which returns a
63
+ # 429 or 503 status with a Retry-After header will be retried.
64
+ #
65
+ RETRY_LIMIT = 100
66
+
67
+ #
68
+ # XML schema namespace
69
+ #
70
+ NS = 'http://cdaweb.gsfc.nasa.gov/schema'
71
+ #
72
+ # XHTML schema namespace
73
+ #
74
+ XHTML_NS = 'http://www.w3.org/1999/xhtml'
75
+ #
76
+ # All namespaces found in responses.
77
+ #
78
+ NAMESPACES = {
79
+ 'cdas': NS,
80
+ 'xhtml': XHTML_NS
81
+ }
82
+ #
83
+ # For backward compatibility with cdasws versions < 1.8.12.
84
+ #
85
+ from cdasws.cdasws import *
@@ -24,7 +24,7 @@
24
24
  #
25
25
  # NOSA HEADER END
26
26
  #
27
- # Copyright (c) 2018-2024 United States Government as represented by
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 &copy; 2018-2024 United States Government as represented by the
37
+ Copyright &copy; 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,12 +42,13 @@ 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
48
49
  import urllib3
49
50
  #import matplotlib.pyplot as plt
50
- from cdasws import CdasWs
51
+ from cdasws.cdasws import CdasWs
51
52
  from cdasws.timeinterval import TimeInterval
52
53
  from cdasws.datarequest import GraphOptions, ImageFormat, Overplot, TextFormat
53
54
  from cdasws.datarepresentation import DataRepresentation
@@ -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]'.format(name=name))
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:d',
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, user_agent='Example')
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
- mms_brst_inventory = cdas.get_inventory('MMS1_FPI_BRST_L2_DES-MOMS',
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
- print('MMS1_FPI_BRST_L2_DES-MOMS inventory:')
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: