cdasws 1.8.3__tar.gz → 1.8.5__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.3 → cdasws-1.8.5}/PKG-INFO +1 -1
- {cdasws-1.8.3 → cdasws-1.8.5}/cdasws/__init__.py +46 -13
- {cdasws-1.8.3 → cdasws-1.8.5}/cdasws/__main__.py +6 -2
- {cdasws-1.8.3 → cdasws-1.8.5}/cdasws/datarequest.py +1 -0
- {cdasws-1.8.3 → cdasws-1.8.5}/cdasws.egg-info/PKG-INFO +1 -1
- {cdasws-1.8.3 → cdasws-1.8.5}/setup.py +1 -1
- {cdasws-1.8.3 → cdasws-1.8.5}/README.md +0 -0
- {cdasws-1.8.3 → cdasws-1.8.5}/cdasws/datarepresentation.py +0 -0
- {cdasws-1.8.3 → cdasws-1.8.5}/cdasws/timeinterval.py +0 -0
- {cdasws-1.8.3 → cdasws-1.8.5}/cdasws.egg-info/SOURCES.txt +0 -0
- {cdasws-1.8.3 → cdasws-1.8.5}/cdasws.egg-info/dependency_links.txt +0 -0
- {cdasws-1.8.3 → cdasws-1.8.5}/cdasws.egg-info/requires.txt +0 -0
- {cdasws-1.8.3 → cdasws-1.8.5}/cdasws.egg-info/top_level.txt +0 -0
- {cdasws-1.8.3 → cdasws-1.8.5}/setup.cfg +0 -0
|
@@ -83,17 +83,17 @@ from cdasws.timeinterval import TimeInterval
|
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
# requires python >= 3.4
|
|
86
|
-
if find_spec('spacepy.datamodel') is not None:
|
|
87
|
-
import spacepy.datamodel as spdm # type: ignore
|
|
88
|
-
SPDM_AVAILABLE = True
|
|
89
|
-
else:
|
|
90
|
-
SPDM_AVAILABLE = False
|
|
91
|
-
# python < 3.4
|
|
92
|
-
#try:
|
|
86
|
+
#if find_spec('spacepy.datamodel') is not None:
|
|
93
87
|
# import spacepy.datamodel as spdm # type: ignore
|
|
94
88
|
# SPDM_AVAILABLE = True
|
|
95
|
-
#
|
|
89
|
+
#else:
|
|
96
90
|
# SPDM_AVAILABLE = False
|
|
91
|
+
# python < 3.4
|
|
92
|
+
try:
|
|
93
|
+
import spacepy.datamodel as spdm # type: ignore
|
|
94
|
+
SPDM_AVAILABLE = True
|
|
95
|
+
except ImportError:
|
|
96
|
+
SPDM_AVAILABLE = False
|
|
97
97
|
|
|
98
98
|
try:
|
|
99
99
|
from cdflib.xarray import cdf_to_xarray
|
|
@@ -137,7 +137,7 @@ except ImportError:
|
|
|
137
137
|
CDF_XARRAY_AVAILABLE = False
|
|
138
138
|
|
|
139
139
|
|
|
140
|
-
__version__ = "1.8.
|
|
140
|
+
__version__ = "1.8.5"
|
|
141
141
|
|
|
142
142
|
|
|
143
143
|
#
|
|
@@ -933,6 +933,30 @@ class CdasWs:
|
|
|
933
933
|
return doi
|
|
934
934
|
|
|
935
935
|
|
|
936
|
+
@staticmethod
|
|
937
|
+
def get_citation(
|
|
938
|
+
doi: str
|
|
939
|
+
) -> str:
|
|
940
|
+
"""
|
|
941
|
+
Returns the citation from doi.org for the given DOI.
|
|
942
|
+
|
|
943
|
+
Parameters
|
|
944
|
+
----------
|
|
945
|
+
doi
|
|
946
|
+
digital object identifier.
|
|
947
|
+
Returns
|
|
948
|
+
-------
|
|
949
|
+
str
|
|
950
|
+
The citation from doi.org for the given DOI.
|
|
951
|
+
"""
|
|
952
|
+
|
|
953
|
+
url = 'https://doi.org/' + doi
|
|
954
|
+
headers = {'Accept': 'text/x-bibliography; style=apa'}
|
|
955
|
+
response = requests.get(url, headers=headers)
|
|
956
|
+
|
|
957
|
+
return response.text
|
|
958
|
+
|
|
959
|
+
|
|
936
960
|
def get_inventory(
|
|
937
961
|
self,
|
|
938
962
|
identifier: str,
|
|
@@ -1557,8 +1581,8 @@ class CdasWs:
|
|
|
1557
1581
|
If an Exception is raise by either the spdm.fromCDF() or
|
|
1558
1582
|
cdflib.cdf_to_xarray() functions.
|
|
1559
1583
|
ModuleNotFoundError
|
|
1560
|
-
If
|
|
1561
|
-
modules are installed.
|
|
1584
|
+
If the required spacepy.datamodel or the cdflib and xarray
|
|
1585
|
+
modules are not installed.
|
|
1562
1586
|
"""
|
|
1563
1587
|
if data_representation is None:
|
|
1564
1588
|
if SPDM_AVAILABLE:
|
|
@@ -1569,6 +1593,14 @@ class CdasWs:
|
|
|
1569
1593
|
raise ModuleNotFoundError(
|
|
1570
1594
|
'neither the spacepy.datamodel nor the cdflib and '
|
|
1571
1595
|
'xarray modules are installed')
|
|
1596
|
+
|
|
1597
|
+
if data_representation is DataRepresentation.SPACEPY and \
|
|
1598
|
+
not SPDM_AVAILABLE:
|
|
1599
|
+
raise ModuleNotFoundError('spacepy module must be installed')
|
|
1600
|
+
if data_representation is DataRepresentation.XARRAY and \
|
|
1601
|
+
not CDF_XARRAY_AVAILABLE:
|
|
1602
|
+
raise ModuleNotFoundError('cdflib and xarray modules must be installed')
|
|
1603
|
+
|
|
1572
1604
|
if data_representation is DataRepresentation.SPACEPY:
|
|
1573
1605
|
return spdm.fromCDF(filename)
|
|
1574
1606
|
if data_representation is DataRepresentation.XARRAY:
|
|
@@ -1768,8 +1800,9 @@ class CdasWs:
|
|
|
1768
1800
|
progress_user_value) != 0:
|
|
1769
1801
|
return (status, None)
|
|
1770
1802
|
except:
|
|
1771
|
-
self.logger.error('Exception from read_data(%s): %s',
|
|
1772
|
-
tmp_filename, sys.exc_info()[0]
|
|
1803
|
+
self.logger.error('Exception from read_data(%s): %s, %s',
|
|
1804
|
+
tmp_filename, sys.exc_info()[0],
|
|
1805
|
+
sys.exc_info()[1])
|
|
1773
1806
|
self.logger.error('CDF file has been retained.')
|
|
1774
1807
|
raise
|
|
1775
1808
|
return (status, data)
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
#
|
|
25
25
|
# NOSA HEADER END
|
|
26
26
|
#
|
|
27
|
-
# Copyright (c) 2018-
|
|
27
|
+
# Copyright (c) 2018-2024 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-2024 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
|
"""
|
|
@@ -138,6 +138,7 @@ def example(
|
|
|
138
138
|
print_usage(argv[0])
|
|
139
139
|
sys.exit()
|
|
140
140
|
|
|
141
|
+
|
|
141
142
|
cdas = CdasWs(endpoint=endpoint, ca_certs=ca_certs,
|
|
142
143
|
disable_ssl_certificate_validation=
|
|
143
144
|
disable_ssl_certificate_validation, user_agent='Example')
|
|
@@ -160,6 +161,8 @@ def example(
|
|
|
160
161
|
print('DOI landing page:',
|
|
161
162
|
cdas.get_doi_landing_page_url('10.48322/e0dc-0h53'))
|
|
162
163
|
|
|
164
|
+
print('citation = ' + cdas.get_citation('10.48322/541v-1f57'))
|
|
165
|
+
|
|
163
166
|
mms_brst_inventory = cdas.get_inventory('MMS1_FPI_BRST_L2_DES-MOMS',
|
|
164
167
|
timeInterval=TimeInterval(
|
|
165
168
|
'2018-08-30T08:09:53Z',
|
|
@@ -200,6 +203,7 @@ def example(
|
|
|
200
203
|
# 'sigmaMultiplier': 4,
|
|
201
204
|
# 'overrideDefaultBinning': True
|
|
202
205
|
#}
|
|
206
|
+
dataRepresentation=DataRepresentation.SPACEPY
|
|
203
207
|
)
|
|
204
208
|
# cdas.get_data('10.21978/P8PG8V', ['BT'],
|
|
205
209
|
# '1987-09-24T00:00:00Z', '1987-09-24T01:00:00Z'
|
|
@@ -10,7 +10,7 @@ README = (HERE / "README.md").read_text()
|
|
|
10
10
|
# This call to setup() does all the work
|
|
11
11
|
setup(
|
|
12
12
|
name="cdasws",
|
|
13
|
-
version="1.8.
|
|
13
|
+
version="1.8.5",
|
|
14
14
|
description="NASA's Coordinated Data Analysis System Web Service Client Library",
|
|
15
15
|
long_description=README,
|
|
16
16
|
long_description_content_type="text/markdown",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|