sscws 2.4__tar.gz → 2.4.2__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: sscws
3
- Version: 2.4
3
+ Version: 2.4.2
4
4
  Summary: NASA's Satellite Situation Center Web Service Client Library
5
5
  Home-page: https://sscweb.gsfc.nasa.gov/WebServices/REST
6
6
  Author: Bernie Harris
@@ -14,9 +14,8 @@ Classifier: Environment :: Web Environment
14
14
  Classifier: Intended Audience :: End Users/Desktop
15
15
  Classifier: Intended Audience :: Developers
16
16
  Classifier: Intended Audience :: System Administrators
17
- Classifier: Operating System :: MacOS :: MacOS X
18
- Classifier: Operating System :: Microsoft :: Windows
19
- Classifier: Operating System :: POSIX
17
+ Classifier: License :: OSI Approved :: NASA Open Source Agreement v1.3 (NASA-1.3)
18
+ Classifier: Operating System :: OS Independent
20
19
  Classifier: Programming Language :: Python
21
20
  Classifier: Topic :: Scientific/Engineering :: Physics
22
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
@@ -28,9 +27,11 @@ License-File: LICENSE
28
27
 
29
28
  ## Synopsis
30
29
 
31
- This library provides a simple python interface to
32
30
  NASA's [Satellite Situation Center](https://sscweb.gsfc.nasa.gov/)
33
- (SSC). This library implements the client side of the
31
+ (SSC) is a system to cast geocentric spacecraft location information
32
+ into a framework of (empirical) geophysical regions and mappings of
33
+ spacecraft locations along lines of the Earth's magnetic field.
34
+ This library implements the client side of the
34
35
  [SSC RESTful web services](https://sscweb.gsfc.nasa.gov/WebServices/REST/).
35
36
  For more general details about the SSC web services, see
36
37
  https://sscweb.gsfc.nasa.gov/WebServices/REST/.
@@ -60,7 +61,7 @@ different features of the library:
60
61
  4. [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/).
61
62
 
62
63
  These notebooks are also available on
63
- [Binder](https://mybinder.org/v2/gh/berniegsfc/sscws-notebooks/main).
64
+ [Binder](https://binder.opensci.2i2c.cloud/v2/gh/berniegsfc/sscws-notebooks/main).
64
65
 
65
66
  ## Motivation
66
67
 
@@ -1,9 +1,11 @@
1
1
 
2
2
  ## Synopsis
3
3
 
4
- This library provides a simple python interface to
5
4
  NASA's [Satellite Situation Center](https://sscweb.gsfc.nasa.gov/)
6
- (SSC). This library implements the client side of the
5
+ (SSC) is a system to cast geocentric spacecraft location information
6
+ into a framework of (empirical) geophysical regions and mappings of
7
+ spacecraft locations along lines of the Earth's magnetic field.
8
+ This library implements the client side of the
7
9
  [SSC RESTful web services](https://sscweb.gsfc.nasa.gov/WebServices/REST/).
8
10
  For more general details about the SSC web services, see
9
11
  https://sscweb.gsfc.nasa.gov/WebServices/REST/.
@@ -33,7 +35,7 @@ different features of the library:
33
35
  4. [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/).
34
36
 
35
37
  These notebooks are also available on
36
- [Binder](https://mybinder.org/v2/gh/berniegsfc/sscws-notebooks/main).
38
+ [Binder](https://binder.opensci.2i2c.cloud/v2/gh/berniegsfc/sscws-notebooks/main).
37
39
 
38
40
  ## Motivation
39
41
 
@@ -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="sscws",
13
- version="2.4",
13
+ version="2.4.2",
14
14
  description="NASA's Satellite Situation Center Web Service Client Library",
15
15
  long_description=README,
16
16
  long_description_content_type="text/markdown",
@@ -25,7 +25,7 @@ setup(
25
25
  install_requires=["python-dateutil>=2.8.0", "requests>=2.20", "numpy>=1.19.4"],
26
26
  extras_require={
27
27
  'plot': ["matplotlib>=3.3.2"],
28
- 'cdf': ["cdflib>=0.4.9,<1.0"]
28
+ 'cdf': ["cdflib>=0.4.9"]
29
29
  },
30
30
  keywords=["heliophysics", "satellites", "trajectories", "orbits", "location", "conjunctions", "earth magnetic field", "ephemeris", "space physics", "spdf", "ssc"],
31
31
  classifiers=[
@@ -35,10 +35,8 @@ setup(
35
35
  "Intended Audience :: End Users/Desktop",
36
36
  "Intended Audience :: Developers",
37
37
  "Intended Audience :: System Administrators",
38
- # "License :: OSI Approved :: NASA Open Source Agreement",
39
- "Operating System :: MacOS :: MacOS X",
40
- "Operating System :: Microsoft :: Windows",
41
- "Operating System :: POSIX",
38
+ "License :: OSI Approved :: NASA Open Source Agreement v1.3 (NASA-1.3)",
39
+ "Operating System :: OS Independent",
42
40
  "Programming Language :: Python",
43
41
  "Topic :: Scientific/Engineering :: Physics",
44
42
  "Topic :: Software Development :: Libraries :: Python Modules"
@@ -55,7 +55,7 @@ Notes
55
55
  """
56
56
 
57
57
 
58
- __version__ = "2.4"
58
+ __version__ = "2.4.2"
59
59
 
60
60
 
61
61
  #
@@ -46,7 +46,7 @@ import xml.etree.ElementTree as ET
46
46
  import logging
47
47
  import logging.config
48
48
  from typing import List
49
- from datetime import timedelta
49
+ #from datetime import timedelta
50
50
  import time
51
51
  import urllib3
52
52
  import numpy as np
@@ -65,7 +65,7 @@ from sscws.sscws import SscWs
65
65
  from sscws.bfieldmodels import BFieldModel, Tsyganenko89cBFieldModel
66
66
  try:
67
67
  from sscws.cdf import Cdf
68
- CDF_AVAILABLE = True
68
+ CDF_AVAILABLE = True
69
69
  except ImportError:
70
70
  CDF_AVAILABLE = False
71
71
  from sscws.conjunctions import BoxConjunctionArea, ConditionOperator,\
@@ -297,30 +297,6 @@ def example(
297
297
  print('skipping get_locations2')
298
298
 
299
299
 
300
- """
301
- cdf = Cdf()
302
- cdf.open('themisa_20230523085913_101794.cdf')
303
- #for name in cdf.get_variable_names():
304
- # var_info = cdf.get_variable_info(name)
305
- # print(var_info)
306
- # data = cdf.get_variable_data(name, 0, var_info['Last_Rec'])
307
- # print(data)
308
-
309
- #stop_altitude = cdf.get_b_trace_stop_altitude()
310
- #print('stop_altitude:', stop_altitude)
311
- #sat_name = cdf.get_satellite_name()
312
- #print('sat_name:', sat_name)
313
- sat_data = cdf.get_satellite_data()
314
- #print('sat_data:', sat_data)
315
- result = {
316
- 'Data': np.empty(1, dtype=object)
317
- }
318
- result['Data'][0] = sat_data
319
- #print('result = ', result)
320
- SscWs.print_locations_result(result)
321
- return
322
- """
323
-
324
300
  # A conjunction query request
325
301
  query_request = create_example_query_request()
326
302
  #print('request:')
@@ -342,6 +318,35 @@ def example(
342
318
 
343
319
  # pylint: enable=too-many-locals,too-many-branches,too-many-statements
344
320
 
321
+
322
+ def test_cdf(
323
+ ) -> None:
324
+ """
325
+ Tests reading an ssc cdf and printing some values.
326
+
327
+ """
328
+ cdf = Cdf()
329
+ cdf.open('themisa_20230523085913_101794.cdf')
330
+ #for name in cdf.get_variable_names():
331
+ # var_info = cdf.get_variable_info(name)
332
+ # print(var_info)
333
+ # data = cdf.get_variable_data(name, 0, var_info['Last_Rec'])
334
+ # print(data)
335
+
336
+ stop_altitude = cdf.get_b_trace_stop_altitude()
337
+ print('stop_altitude:', stop_altitude)
338
+ #sat_name = cdf.get_satellite_name()
339
+ #print('sat_name:', sat_name)
340
+ sat_data = cdf.get_satellite_data()
341
+ #print('sat_data:', sat_data)
342
+ result = {
343
+ 'Data': np.empty(1, dtype=object)
344
+ }
345
+ result['Data'][0] = sat_data
346
+ #print('result = ', result)
347
+ SscWs.print_locations_result(result)
348
+
349
+
345
350
  #########################
346
351
  def create_swarma_btrace_request(
347
352
  ) -> ET:
@@ -547,4 +552,5 @@ def create_example_query_request(
547
552
 
548
553
 
549
554
  if __name__ == '__main__':
555
+ #test_cdf()
550
556
  example(sys.argv)
@@ -173,7 +173,11 @@ class Cdf:
173
173
  A list of the variable names.
174
174
  """
175
175
 
176
- return self._info['rVariables'] + self._info['zVariables']
176
+ try:
177
+ return self._info['rVariables'] + self._info['zVariables']
178
+ except TypeError:
179
+ # cdflib >= 1.0
180
+ return self._info.rVariables + self._info.zVariables
177
181
 
178
182
 
179
183
  def get_variable_info(
@@ -266,7 +270,12 @@ class Cdf:
266
270
  str
267
271
  Value of the Source_name global attribute.
268
272
  """
269
- return self._global_attributes['Source_name']
273
+ name = self._global_attributes['Source_name']
274
+
275
+ if isinstance(name, list): # cdflib >= 1.0
276
+ name = name[0]
277
+
278
+ return name
270
279
 
271
280
 
272
281
  def get_satellite_name(
@@ -300,7 +309,12 @@ class Cdf:
300
309
 
301
310
  for name in self.get_variable_names():
302
311
  var_info = self.get_variable_info(name)
303
- data = self.get_variable_data(name, 0, var_info['Last_Rec'])
312
+ try:
313
+ last_rec = var_info['Last_Rec']
314
+ except TypeError:
315
+ # cdflib >= 1.0
316
+ last_rec = var_info.Last_Rec
317
+ data = self.get_variable_data(name, 0, last_rec)
304
318
 
305
319
  matcher = XYZ_PATTERN.match(name)
306
320
 
@@ -348,7 +362,12 @@ class Cdf:
348
362
 
349
363
  name = 'Epoch'
350
364
  var_info = self.get_variable_info(name)
351
- epoch = self.get_variable_data(name, 0, var_info['Last_Rec'])
365
+ try:
366
+ last_rec = var_info['Last_Rec']
367
+ except TypeError:
368
+ # cdflib >= 1.0
369
+ last_rec = var_info.Last_Rec
370
+ epoch = self.get_variable_data(name, 0, last_rec)
352
371
 
353
372
  datetimes = cdflib.cdfepoch.to_datetime(epoch)
354
373
 
@@ -377,7 +396,12 @@ class Cdf:
377
396
 
378
397
  for name in self.get_variable_names():
379
398
  var_info = self.get_variable_info(name)
380
- data = self.get_variable_data(name, 0, var_info['Last_Rec'])
399
+ try:
400
+ last_rec = var_info['Last_Rec']
401
+ except TypeError:
402
+ # cdflib >= 1.0
403
+ last_rec = var_info.Last_Rec
404
+ data = self.get_variable_data(name, 0, last_rec)
381
405
 
382
406
  matcher = B_TRACE_PATTERN.match(name)
383
407
 
@@ -429,7 +453,12 @@ class Cdf:
429
453
  """
430
454
 
431
455
  var_info = self.get_variable_info(name)
432
- return self.get_variable_data(name, 0, var_info['Last_Rec'])
456
+ try:
457
+ last_rec = var_info['Last_Rec']
458
+ except TypeError:
459
+ # cdflib >= 1.0
460
+ last_rec = var_info.Last_Rec
461
+ return self.get_variable_data(name, 0, last_rec)
433
462
 
434
463
 
435
464
  def get_spacecraft_region(
@@ -514,7 +514,7 @@ class SscWs:
514
514
  are compatible with `SscWs.get_locations` except that the numpy
515
515
  array of datetime.datetime values are returned as a numpy array
516
516
  of numpy.datetime64 values. This method requires the
517
- cdflib < 1.0 module to be installed.
517
+ cdflib module to be installed.
518
518
 
519
519
  See Also
520
520
  --------
@@ -1008,7 +1008,12 @@ class SscWs:
1008
1008
  print(f"{'Time':25s} {'B Strength GSE':^30s}")
1009
1009
  print(f"{'':25s} {'X':^9s} {'Y':^9s} {'Z':^9s}")
1010
1010
  for index in range(min_len):
1011
- print((f"{data['Time'][index].isoformat():25s} "
1011
+ bgse_time = data['Time'][index]
1012
+ try:
1013
+ iso_time = bgse_time.isoformat()
1014
+ except AttributeError:
1015
+ iso_time = str(bgse_time)
1016
+ print((f"{iso_time:25s} "
1012
1017
  f"{data['BGseX'][index]:9.6f} "
1013
1018
  f"{data['BGseY'][index]:9.6f} "
1014
1019
  f"{data['BGseZ'][index]:9.6f}"))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sscws
3
- Version: 2.4
3
+ Version: 2.4.2
4
4
  Summary: NASA's Satellite Situation Center Web Service Client Library
5
5
  Home-page: https://sscweb.gsfc.nasa.gov/WebServices/REST
6
6
  Author: Bernie Harris
@@ -14,9 +14,8 @@ Classifier: Environment :: Web Environment
14
14
  Classifier: Intended Audience :: End Users/Desktop
15
15
  Classifier: Intended Audience :: Developers
16
16
  Classifier: Intended Audience :: System Administrators
17
- Classifier: Operating System :: MacOS :: MacOS X
18
- Classifier: Operating System :: Microsoft :: Windows
19
- Classifier: Operating System :: POSIX
17
+ Classifier: License :: OSI Approved :: NASA Open Source Agreement v1.3 (NASA-1.3)
18
+ Classifier: Operating System :: OS Independent
20
19
  Classifier: Programming Language :: Python
21
20
  Classifier: Topic :: Scientific/Engineering :: Physics
22
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
@@ -28,9 +27,11 @@ License-File: LICENSE
28
27
 
29
28
  ## Synopsis
30
29
 
31
- This library provides a simple python interface to
32
30
  NASA's [Satellite Situation Center](https://sscweb.gsfc.nasa.gov/)
33
- (SSC). This library implements the client side of the
31
+ (SSC) is a system to cast geocentric spacecraft location information
32
+ into a framework of (empirical) geophysical regions and mappings of
33
+ spacecraft locations along lines of the Earth's magnetic field.
34
+ This library implements the client side of the
34
35
  [SSC RESTful web services](https://sscweb.gsfc.nasa.gov/WebServices/REST/).
35
36
  For more general details about the SSC web services, see
36
37
  https://sscweb.gsfc.nasa.gov/WebServices/REST/.
@@ -60,7 +61,7 @@ different features of the library:
60
61
  4. [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/).
61
62
 
62
63
  These notebooks are also available on
63
- [Binder](https://mybinder.org/v2/gh/berniegsfc/sscws-notebooks/main).
64
+ [Binder](https://binder.opensci.2i2c.cloud/v2/gh/berniegsfc/sscws-notebooks/main).
64
65
 
65
66
  ## Motivation
66
67
 
@@ -3,7 +3,7 @@ requests>=2.20
3
3
  numpy>=1.19.4
4
4
 
5
5
  [cdf]
6
- cdflib<1.0,>=0.4.9
6
+ cdflib>=0.4.9
7
7
 
8
8
  [plot]
9
9
  matplotlib>=3.3.2
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes