cdasws 1.8.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cdasws
3
- Version: 1.8.4
3
+ Version: 1.8.5
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
@@ -137,7 +137,7 @@ except ImportError:
137
137
  CDF_XARRAY_AVAILABLE = False
138
138
 
139
139
 
140
- __version__ = "1.8.4"
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 neither the spacepy.datamodel nor the cdflib and xarray
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-2023 United States Government as represented by
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-2023 United States Government as represented by the
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'
@@ -211,6 +211,7 @@ class CdfFormat(enum.Enum):
211
211
  ZIP_CDFML = "ZipCDFML"
212
212
  ICDFML = "ICDFML"
213
213
  NETCDF = "NetCdf"
214
+ CDFJSON = "CdfJson"
214
215
 
215
216
 
216
217
  class CdfRequest(DataRequest): # pylint: disable=too-few-public-methods
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cdasws
3
- Version: 1.8.4
3
+ Version: 1.8.5
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
@@ -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.4",
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