cdasws 1.8.10__py3-none-any.whl → 1.8.12__py3-none-any.whl
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/__init__.py +5 -2293
- cdasws/__main__.py +33 -10
- cdasws/cdasws.py +1833 -320
- cdasws/timeinterval.py +5 -5
- {cdasws-1.8.10.dist-info → cdasws-1.8.12.dist-info}/METADATA +40 -13
- cdasws-1.8.12.dist-info/RECORD +13 -0
- {cdasws-1.8.10.dist-info → cdasws-1.8.12.dist-info}/WHEEL +1 -1
- {cdasws-1.8.10.dist-info → cdasws-1.8.12.dist-info/licenses}/LICENSE +1 -1
- cdasws-1.8.10.dist-info/RECORD +0 -13
- {cdasws-1.8.10.dist-info → cdasws-1.8.12.dist-info}/top_level.txt +0 -0
cdasws/__main__.py
CHANGED
|
@@ -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,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]'
|
|
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:
|