cdasws 1.8.12__tar.gz → 1.8.13__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cdasws
3
- Version: 1.8.12
3
+ Version: 1.8.13
4
4
  Summary: NASA's Coordinated Data Analysis System Web Service Client Library
5
5
  Home-page: https://cdaweb.gsfc.nasa.gov/WebServices/REST
6
6
  Author: Bernie Harris
@@ -16,6 +16,7 @@ Classifier: Intended Audience :: System Administrators
16
16
  Classifier: License :: OSI Approved :: NASA Open Source Agreement v1.3 (NASA-1.3)
17
17
  Classifier: Operating System :: OS Independent
18
18
  Classifier: Programming Language :: Python
19
+ Classifier: Programming Language :: Python :: 3
19
20
  Classifier: Topic :: Scientific/Engineering :: Physics
20
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
22
  Description-Content-Type: text/markdown
@@ -24,7 +24,7 @@
24
24
  #
25
25
  # NOSA HEADER END
26
26
  #
27
- # Copyright (c) 2018-2025 United States Government as represented by
27
+ # Copyright (c) 2018-2026 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 &copy; 2018-2025 United States Government as represented by the
38
+ Copyright &copy; 2018-2026 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
 
@@ -55,7 +55,7 @@ Notes
55
55
  """
56
56
 
57
57
 
58
- __version__ = "1.8.12"
58
+ __version__ = "1.8.13"
59
59
 
60
60
 
61
61
  #
@@ -82,4 +82,4 @@ NAMESPACES = {
82
82
  #
83
83
  # For backward compatibility with cdasws versions < 1.8.12.
84
84
  #
85
- from cdasws.cdasws import *
85
+ from cdasws.cdasws import * # pylint: disable=wrong-import-position
@@ -24,7 +24,7 @@
24
24
  #
25
25
  # NOSA HEADER END
26
26
  #
27
- # Copyright (c) 2018-2025 United States Government as represented by
27
+ # Copyright (c) 2018-2026 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-2025 United States Government as represented by the
37
+ Copyright &copy; 2018-2026 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
  """
@@ -52,6 +52,7 @@ from cdasws.cdasws import CdasWs
52
52
  from cdasws.timeinterval import TimeInterval
53
53
  from cdasws.datarequest import GraphOptions, ImageFormat, Overplot, TextFormat
54
54
  from cdasws.datarepresentation import DataRepresentation
55
+ from cdasws.doi import get_doi_landing_page_url
55
56
 
56
57
 
57
58
  logging.basicConfig()
@@ -147,7 +148,7 @@ def example(
147
148
 
148
149
  cdas = CdasWs(endpoint=endpoint, ca_certs=ca_certs,
149
150
  disable_ssl_certificate_validation=
150
- disable_ssl_certificate_validation,
151
+ disable_ssl_certificate_validation,
151
152
  disable_cache = disable_cache, user_agent='Example')
152
153
 
153
154
  print(cdas.get_observatory_groups(
@@ -166,7 +167,7 @@ def example(
166
167
  #print(' ', json.dumps(dataset, indent=4))
167
168
 
168
169
  print('DOI landing page:',
169
- cdas.get_doi_landing_page_url('10.48322/e0dc-0h53'))
170
+ get_doi_landing_page_url('10.48322/e0dc-0h53'))
170
171
 
171
172
  print('citation = ' + cdas.get_citation('10.48322/541v-1f57'))
172
173
 
@@ -24,7 +24,7 @@
24
24
  #
25
25
  # NOSA HEADER END
26
26
  #
27
- # Copyright (c) 2018-2025 United States Government as represented by
27
+ # Copyright (c) 2018-2026 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
  Module for accessing the Coordinate Data Analysis System (CDAS)
36
36
  web services <https://cdaweb.gsfc.nasa.gov/WebServices/REST/>.<br>
37
37
 
38
- Copyright &copy; 2018-2025 United States Government as represented by the
38
+ Copyright &copy; 2018-2026 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
 
@@ -60,19 +60,19 @@ import os
60
60
  import platform
61
61
  import logging
62
62
  import re
63
- from importlib.util import find_spec
63
+ #from importlib.util import find_spec
64
64
  import urllib.parse
65
65
  from urllib.parse import urlparse
66
- import json
66
+ #import json
67
67
  from operator import itemgetter
68
68
  import time
69
- from datetime import datetime, timedelta, timezone
69
+ from datetime import datetime, timedelta
70
70
  import xml.etree.ElementTree as ET
71
71
  from tempfile import mkstemp
72
72
  from typing import Any, Callable, Dict, List, Tuple, Union
73
73
 
74
74
  import requests
75
- import dateutil.parser
75
+ #import dateutil.parser
76
76
 
77
77
  from cdasws.datarepresentation import DataRepresentation
78
78
  from cdasws.datarequest import AudioRequest, DataRequest
@@ -80,6 +80,8 @@ from cdasws.datarequest import CdfFormat, CdfRequest, Compression
80
80
  from cdasws.datarequest import ImageFormat, GraphOptions, GraphRequest
81
81
  from cdasws.datarequest import TextFormat, TextRequest, ThumbnailRequest
82
82
  from cdasws.timeinterval import TimeInterval
83
+ from cdasws.doi import get_doi_landing_page_url
84
+ from cdasws import __version__, RETRY_LIMIT, NAMESPACES as NS
83
85
 
84
86
 
85
87
  # requires python >= 3.4
@@ -143,8 +145,6 @@ try:
143
145
  except ImportError:
144
146
  CACHE_AVAILABLE = False
145
147
 
146
- from cdasws import __version__, RETRY_LIMIT, NAMESPACES as NS
147
-
148
148
 
149
149
  def _get_data_progress(
150
150
  progress: float,
@@ -919,6 +919,9 @@ class CdasWs:
919
919
  Returns a URL to the given Digital Object Identifier's landing
920
920
  page (metadata for the DOI).
921
921
 
922
+ Note: this method is deprecated. You should call
923
+ doi.get_doi_landing_page_url directly.
924
+
922
925
  Parameters
923
926
  ----------
924
927
  doi
@@ -929,9 +932,7 @@ class CdasWs:
929
932
  A URL to the DOI's landing page.
930
933
  """
931
934
 
932
- if not doi.startswith('http'):
933
- return 'https://doi.org/' + doi
934
- return doi
935
+ return get_doi_landing_page_url(doi)
935
936
 
936
937
 
937
938
  @staticmethod
@@ -24,7 +24,7 @@
24
24
  #
25
25
  # NOSA HEADER END
26
26
  #
27
- # Copyright (c) 2019-2024 United States Government as represented by
27
+ # Copyright (c) 2019-2026 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.
@@ -36,7 +36,7 @@ Package defining classes to represent the DataRequestEntity and its
36
36
  sub-classes from
37
37
  <https://cdaweb.gsfc.nasa.gov/WebServices/REST/CDAS.xsd>.<br>
38
38
 
39
- Copyright &copy; 2019-2024 United States Government as represented by the
39
+ Copyright &copy; 2019-2026 United States Government as represented by the
40
40
  National Aeronautics and Space Administration. No copyright is claimed in
41
41
  the United States under Title 17, U.S.Code. All Other Rights Reserved.
42
42
  """
@@ -350,7 +350,6 @@ class DataRequest(metaclass=ABCMeta): # pylint: disable=too-few-public-methods
350
350
  string XML representation of this object.
351
351
  """
352
352
 
353
- #return ET.tostring(self.xml_element(), encoding="utf-8", method='xml', xml_declaration=True)
354
353
  return ET.tostring(self.xml_element(), encoding="utf-8", method='xml')
355
354
 
356
355
 
@@ -0,0 +1,127 @@
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) 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
+ Module defines utility functions related to Digital Object Identifiers
36
+ (DOI).<br>
37
+
38
+ Copyright &copy; 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
+
43
+
44
+ def get_canonical_doi(
45
+ doi: str
46
+ ) -> str:
47
+ """
48
+ Returns a canonical representation (no leading https://doi.org/ and
49
+ lower case) Digital Object Identifier (DOI) value.
50
+
51
+ Parameters
52
+ ----------
53
+ doi
54
+ digital object identifier.
55
+ Returns
56
+ -------
57
+ str
58
+ The canonical DOI value.
59
+ """
60
+ return doi.replace('https://doi.org/', '').lower()
61
+
62
+
63
+ def get_doi_landing_page_url(
64
+ doi: str
65
+ ) -> str:
66
+ """
67
+ Returns a URL to the given Digital Object Identifier's landing
68
+ page (metadata for the DOI).
69
+
70
+ Parameters
71
+ ----------
72
+ doi
73
+ digital object identifier.
74
+ Returns
75
+ -------
76
+ str
77
+ A URL to the DOI's landing page.
78
+ """
79
+
80
+ if not doi.startswith('http'):
81
+ return 'https://doi.org/' + doi
82
+ return doi
83
+
84
+
85
+ def get_doi_badge_url(
86
+ doi: str
87
+ ) -> str:
88
+ """
89
+ Returns a URL to the given Digital Object Identifier's badge.
90
+
91
+ Parameters
92
+ ----------
93
+ doi
94
+ digital object identifier.
95
+ Returns
96
+ -------
97
+ str
98
+ A URL to the DOI's badge.
99
+ """
100
+
101
+ canonical_doi = get_canonical_doi(doi)
102
+
103
+ return 'https://img.shields.io/badge/DOI-' + \
104
+ canonical_doi.replace('-', '--') + '-blue'
105
+
106
+
107
+ def get_doi_hdp_url(
108
+ doi: str
109
+ ) -> str:
110
+ """
111
+ Returns a URL to the given Digital Object Identifier's Heliophysics
112
+ Data Portal (HDP) page.
113
+
114
+ Parameters
115
+ ----------
116
+ doi
117
+ digital object identifier.
118
+ Returns
119
+ -------
120
+ str
121
+ A URL to the DOI's HDP page.
122
+ """
123
+
124
+ canonical_doi = get_canonical_doi(doi)
125
+
126
+ return 'https://heliophysicsdata.gsfc.nasa.gov/WS/hdp/1/Spase/' \
127
+ 'NumericalData;DisplayData?DOI=' + canonical_doi
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cdasws
3
- Version: 1.8.12
3
+ Version: 1.8.13
4
4
  Summary: NASA's Coordinated Data Analysis System Web Service Client Library
5
5
  Home-page: https://cdaweb.gsfc.nasa.gov/WebServices/REST
6
6
  Author: Bernie Harris
@@ -16,6 +16,7 @@ Classifier: Intended Audience :: System Administrators
16
16
  Classifier: License :: OSI Approved :: NASA Open Source Agreement v1.3 (NASA-1.3)
17
17
  Classifier: Operating System :: OS Independent
18
18
  Classifier: Programming Language :: Python
19
+ Classifier: Programming Language :: Python :: 3
19
20
  Classifier: Topic :: Scientific/Engineering :: Physics
20
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
22
  Description-Content-Type: text/markdown
@@ -6,6 +6,7 @@ cdasws/__main__.py
6
6
  cdasws/cdasws.py
7
7
  cdasws/datarepresentation.py
8
8
  cdasws/datarequest.py
9
+ cdasws/doi.py
9
10
  cdasws/timeinterval.py
10
11
  cdasws.egg-info/PKG-INFO
11
12
  cdasws.egg-info/SOURCES.txt
@@ -14,4 +15,5 @@ cdasws.egg-info/requires.txt
14
15
  cdasws.egg-info/top_level.txt
15
16
  tests/test_cdasws.py
16
17
  tests/test_datarequest.py
18
+ tests/test_doi.py
17
19
  tests/test_timeinterval.py
@@ -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.12",
13
+ version="1.8.13",
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",
@@ -40,6 +40,7 @@ setup(
40
40
  "License :: OSI Approved :: NASA Open Source Agreement v1.3 (NASA-1.3)",
41
41
  "Operating System :: OS Independent",
42
42
  "Programming Language :: Python",
43
+ "Programming Language :: Python :: 3",
43
44
  "Topic :: Scientific/Engineering :: Physics",
44
45
  "Topic :: Software Development :: Libraries :: Python Modules"
45
46
  ],
@@ -24,7 +24,7 @@
24
24
  #
25
25
  # NOSA HEADER END
26
26
  #
27
- # Copyright (c) 2019-2025 United States Government as represented by
27
+ # Copyright (c) 2019-2026 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.
@@ -33,7 +33,7 @@
33
33
  """
34
34
  Module for unittest of the CdasWs class.<br>
35
35
 
36
- Copyright &copy; 2019-2025 United States Government as represented by the
36
+ Copyright &copy; 2019-2026 United States Government as represented by the
37
37
  National Aeronautics and Space Administration. No copyright is claimed in
38
38
  the United States under Title 17, U.S.Code. All Other Rights Reserved.
39
39
  """
@@ -1406,7 +1406,7 @@ class TestCdasWs(unittest.TestCase):
1406
1406
  doi = '10.48322/541v-1f57'
1407
1407
  result = \
1408
1408
  self._cdas.get_citation(doi)
1409
- self.assertEqual(result, 'Nakamura, R., Torkar, K. M., Jeszenszky, H., &amp; Burch, J. L. (2022). <i>MMS 1 Active Spacecraft Potential Control (ASPOC), Sensors 1 and 2, Level 2 (L2), Survey Mode, 1 s Data</i> [Data set]. NASA Space Physics Data Facility. https://doi.org/10.48322/541V-1F57')
1409
+ self.assertEqual(result, 'Nakamura, R., Torkar, K. M., Jeszenszky, H., &amp; Burch, J. L. (2022). <i>MMS 1 Active Spacecraft Potential Control (ASPOC), Sensors 1 and 2, Level 2 (L2), Survey Mode, 1 s Data</i> [Data set]. Laboratory for Atmospheric and Space Physics; Space Physics Data Facility. https://doi.org/10.48322/541V-1F57')
1410
1410
 
1411
1411
 
1412
1412
  if __name__ == '__main__':
@@ -0,0 +1,94 @@
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) 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
+ Module for unittest of the doi functions.<br>
35
+
36
+ Copyright &copy; 2025 United States Government as represented by the
37
+ National Aeronautics and Space Administration. No copyright is claimed in
38
+ the United States under Title 17, U.S.Code. All Other Rights Reserved.
39
+ """
40
+
41
+ import unittest
42
+ from cdasws.doi import *
43
+
44
+ #from context import cdasws # pylint: disable=unused-import
45
+
46
+
47
+
48
+ class TestTimeInterval(unittest.TestCase):
49
+ """
50
+ Class for unittest of doi module functions.
51
+ """
52
+
53
+ def __init__(self, *args, **kwargs):
54
+ super(TestTimeInterval, self).__init__(*args, **kwargs)
55
+
56
+
57
+ def test_get_canonical_doi(self):
58
+ """
59
+ Test for get_canonical_doi function.
60
+ """
61
+
62
+ self.assertEqual(get_canonical_doi('https://doi.org/ABC/123'), 'abc/123')
63
+ self.assertEqual(get_canonical_doi('XYZ/321'), 'xyz/321')
64
+
65
+
66
+ def test_get_doi_landing_page_url(self):
67
+ """
68
+ Test for get_doi_landing_page_url function.
69
+ """
70
+
71
+ self.assertEqual(get_doi_landing_page_url('https://doi.org/ABC/123'), 'https://doi.org/ABC/123')
72
+ self.assertEqual(get_doi_landing_page_url('ABC/123'), 'https://doi.org/ABC/123')
73
+
74
+
75
+ def test_get_doi_badge_url(self):
76
+ """
77
+ Test for get_doi_badge_url function.
78
+ """
79
+
80
+ self.assertEqual(get_doi_badge_url('https://doi.org/ABC/123'), 'https://img.shields.io/badge/DOI-abc/123-blue')
81
+ self.assertEqual(get_doi_badge_url('XYZ/321'), 'https://img.shields.io/badge/DOI-xyz/321-blue')
82
+ self.assertEqual(get_doi_badge_url('XYZ/123-321'), 'https://img.shields.io/badge/DOI-xyz/123--321-blue')
83
+
84
+
85
+ def test_get_doi_hdp_url(self):
86
+ """
87
+ Test for get_doi_hdp_url function.
88
+ """
89
+
90
+ self.assertEqual(get_doi_hdp_url('https://doi.org/ABC/123'), 'https://heliophysicsdata.gsfc.nasa.gov/WS/hdp/1/Spase/NumericalData;DisplayData?DOI=abc/123')
91
+
92
+
93
+ if __name__ == '__main__':
94
+ unittest.main()
File without changes
File without changes
File without changes
File without changes