tatc 3.2.0__tar.gz → 3.2.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.
Files changed (31) hide show
  1. {tatc-3.2.0/src/tatc.egg-info → tatc-3.2.2}/PKG-INFO +19 -42
  2. {tatc-3.2.0 → tatc-3.2.2}/README.md +13 -23
  3. {tatc-3.2.0 → tatc-3.2.2}/pyproject.toml +7 -23
  4. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/__init__.py +1 -1
  5. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/analysis/__init__.py +3 -0
  6. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/analysis/coverage.py +2 -2
  7. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/analysis/latency.py +12 -14
  8. tatc-3.2.2/src/tatc/analysis/ro_coverage.py +255 -0
  9. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/analysis/track.py +36 -27
  10. tatc-3.2.2/src/tatc/generation/__init__.py +10 -0
  11. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/generation/cells.py +9 -9
  12. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/generation/points.py +11 -11
  13. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/schemas/instrument.py +1 -1
  14. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/schemas/satellite.py +1 -1
  15. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/utils.py +60 -55
  16. {tatc-3.2.0 → tatc-3.2.2/src/tatc.egg-info}/PKG-INFO +19 -42
  17. {tatc-3.2.0 → tatc-3.2.2}/src/tatc.egg-info/SOURCES.txt +1 -0
  18. {tatc-3.2.0 → tatc-3.2.2}/src/tatc.egg-info/requires.txt +5 -20
  19. tatc-3.2.0/src/tatc/generation/__init__.py +0 -10
  20. {tatc-3.2.0 → tatc-3.2.2}/LICENSE +0 -0
  21. {tatc-3.2.0 → tatc-3.2.2}/setup.cfg +0 -0
  22. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/analysis/dop.py +0 -0
  23. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/constants.py +0 -0
  24. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/resources/de421.bsp +0 -0
  25. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/schemas/__init__.py +0 -0
  26. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/schemas/architecture.py +0 -0
  27. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/schemas/orbit.py +0 -0
  28. {tatc-3.2.0 → tatc-3.2.2}/src/tatc/schemas/point.py +0 -0
  29. {tatc-3.2.0 → tatc-3.2.2}/src/tatc.egg-info/dependency_links.txt +0 -0
  30. {tatc-3.2.0 → tatc-3.2.2}/src/tatc.egg-info/top_level.txt +0 -0
  31. {tatc-3.2.0 → tatc-3.2.2}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tatc
3
- Version: 3.2.0
3
+ Version: 3.2.2
4
4
  Summary: Tradespace Analysis Toolkit for Constellations (TAT-C)
5
5
  Author-email: "Paul T. Grogan" <paul.grogan@asu.edu>
6
6
  License: BSD License
@@ -11,17 +11,20 @@ Project-URL: Issues, https://github.com/code-lab-org/tatc/issues
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Operating System :: OS Independent
13
13
  Classifier: Development Status :: 4 - Beta
14
- Requires-Python: <3.11,>=3.9
14
+ Requires-Python: <3.13,>=3.8
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
- Requires-Dist: geopandas>=0.14
17
+ Requires-Dist: geopandas>=0.13.2
18
+ Requires-Dist: joblib
18
19
  Requires-Dist: numba
19
20
  Requires-Dist: numpy
20
21
  Requires-Dist: pandas
21
22
  Requires-Dist: pydantic>=2.6
23
+ Requires-Dist: pyproj
22
24
  Requires-Dist: shapely>=2
23
25
  Requires-Dist: skyfield>=1.48
24
26
  Requires-Dist: sgp4
27
+ Requires-Dist: typing-extensions
25
28
  Provides-Extra: dev
26
29
  Requires-Dist: black[jupyter]>=24.2; extra == "dev"
27
30
  Requires-Dist: coverage; extra == "dev"
@@ -31,13 +34,11 @@ Requires-Dist: pytest; extra == "dev"
31
34
  Provides-Extra: docs
32
35
  Requires-Dist: autodoc_pydantic>=2; extra == "docs"
33
36
  Requires-Dist: docutils; extra == "docs"
34
- Requires-Dist: myst-parser; extra == "docs"
35
- Requires-Dist: nbsphinx; extra == "docs"
37
+ Requires-Dist: myst-nb; extra == "docs"
36
38
  Requires-Dist: sphinx>=7; extra == "docs"
37
39
  Requires-Dist: sphinx-rtd-theme; extra == "docs"
38
40
  Provides-Extra: examples
39
41
  Requires-Dist: ipykernel; extra == "examples"
40
- Requires-Dist: joblib; extra == "examples"
41
42
  Requires-Dist: matplotlib; extra == "examples"
42
43
  Provides-Extra: osse
43
44
  Requires-Dist: netcdf4; extra == "osse"
@@ -46,20 +47,6 @@ Requires-Dist: rioxarray; extra == "osse"
46
47
  Requires-Dist: scipy; extra == "osse"
47
48
  Requires-Dist: scikit-learn; extra == "osse"
48
49
  Requires-Dist: seaborn; extra == "osse"
49
- Provides-Extra: app
50
- Requires-Dist: aiofiles; extra == "app"
51
- Requires-Dist: aiohttp; extra == "app"
52
- Requires-Dist: aiosqlite; extra == "app"
53
- Requires-Dist: celery[librabbitmq,redis]; extra == "app"
54
- Requires-Dist: fastapi>=0.110.0; extra == "app"
55
- Requires-Dist: fastapi-users[sqlalchemy]; extra == "app"
56
- Requires-Dist: geojson-pydantic; extra == "app"
57
- Requires-Dist: msgpack-asgi; extra == "app"
58
- Requires-Dist: python-dotenv; extra == "app"
59
- Requires-Dist: tzlocal; extra == "app"
60
- Requires-Dist: uvicorn[standard]; extra == "app"
61
- Provides-Extra: appdev
62
- Requires-Dist: httpx; extra == "appdev"
63
50
 
64
51
  # Tradespace Analysis Toolkit for Constellations (TAT-C)
65
52
 
@@ -67,9 +54,9 @@ The Tradespace Analysis Toolkit for Constellations (TAT-C) provides low-level
67
54
  data structures and functions for systems engineering analysis and design of
68
55
  Earth-observing space missions suitable for pre-Phase A concept studies.
69
56
 
70
- Documentation: https://tatc.readthedocs.io
57
+ Documentation: [https://tatc.readthedocs.io](https://tatc.readthedocs.io)
71
58
 
72
- Repository: https://github.com/code-lab-org/tatc
59
+ Repository: [https://github.com/code-lab-org/tatc](https://github.com/code-lab-org/tatc)
73
60
 
74
61
  ## Installation
75
62
 
@@ -79,28 +66,17 @@ pip install -e .
79
66
  ```
80
67
 
81
68
  Note: the following optional dependencies are available with bracket notation:
82
- * `pip install -e .[dev]`: for development (unit testing, coverage, and linting)
83
- * `pip install -e .[docs]`: for generating documentation
84
- * `pip install -e .[examples]`: for running optional examples
85
- * `pip install -e .[osse]`: for running optional observing system simulation experiment (OSSE) examples
86
- * `pip install -e .[app]`: for running the web application
87
- * `pip install -e .[appdev]`: for development (unit testing) of the web application
69
+ * `pip install -e ".[dev]"`: for development (unit testing, coverage, and linting)
70
+ * `pip install -e ".[docs]"`: for generating documentation
71
+ * `pip install -e ".[examples]"`: for running optional examples
72
+ * `pip install -e ".[osse]"`: for running optional observing system simulation experiment (OSSE) examples
88
73
 
89
- Multiple optional dependencies can be installed with a comma-separated list (e.g., `pip install -e .[dev,examples]`)
74
+ Multiple optional dependencies can be installed with a comma-separated list (e.g., `pip install -e ".[dev,examples]"`)
90
75
 
91
76
  ## Development Tools
92
77
 
93
78
  Development tools are applicable when working with the source code.
94
79
 
95
- ### Docker and Docker-Compose
96
-
97
- TAT-C includes a Dockerfile (`Dockerfile`) that specifies build targets for a base runtime (the TAT-C library), an application server, and a distributed task worker.
98
-
99
- To build images, run:
100
- ```shell
101
- docker build -t tatc .
102
- ```
103
-
104
80
  ### Unit Tests
105
81
 
106
82
  Run unit tests with:
@@ -139,10 +115,11 @@ Paul T. Grogan <paul.grogan@asu.edu>
139
115
 
140
116
  This project was supported in part by the National Aeronautics and Space
141
117
  Administration (NASA) Earth Science Division (ESD) Earth Science Technology
142
- Office (ESTO) Advanced Information Systems Technology (AIST) program under
143
- grant numbers: NNX17AE06G, 80NSSC17K0586, 80NSSC20K1118, 80NSSC21K1515,
144
- 80NSSC22K1705 and 80NSSC24K0575 and NASA Jet Propulsion Laboratory
145
- contracts: 1074657, 1689594, 1686623, 1705655.
118
+ Office (ESTO) Advanced Information Systems Technology (AIST) program.
119
+ Financial support is acknowledged under NASA grant numbers: NNX17AE06G,
120
+ 80NSSC17K0586, 80NSSC20K1118, 80NSSC21K1515, 80NSSC22K1705, 80NSSC24K0575,
121
+ 80NSSC24K0921; NASA Jet Propulsion Laboratory subcontracts: 1689594, 1686623,
122
+ 1704657, 1705655; Texas A \& M University subaward M2403907.
146
123
 
147
124
  Current Project Team
148
125
  * PI: Paul T. Grogan <paul.grogan@asu.edu>
@@ -4,9 +4,9 @@ The Tradespace Analysis Toolkit for Constellations (TAT-C) provides low-level
4
4
  data structures and functions for systems engineering analysis and design of
5
5
  Earth-observing space missions suitable for pre-Phase A concept studies.
6
6
 
7
- Documentation: https://tatc.readthedocs.io
7
+ Documentation: [https://tatc.readthedocs.io](https://tatc.readthedocs.io)
8
8
 
9
- Repository: https://github.com/code-lab-org/tatc
9
+ Repository: [https://github.com/code-lab-org/tatc](https://github.com/code-lab-org/tatc)
10
10
 
11
11
  ## Installation
12
12
 
@@ -16,28 +16,17 @@ pip install -e .
16
16
  ```
17
17
 
18
18
  Note: the following optional dependencies are available with bracket notation:
19
- * `pip install -e .[dev]`: for development (unit testing, coverage, and linting)
20
- * `pip install -e .[docs]`: for generating documentation
21
- * `pip install -e .[examples]`: for running optional examples
22
- * `pip install -e .[osse]`: for running optional observing system simulation experiment (OSSE) examples
23
- * `pip install -e .[app]`: for running the web application
24
- * `pip install -e .[appdev]`: for development (unit testing) of the web application
19
+ * `pip install -e ".[dev]"`: for development (unit testing, coverage, and linting)
20
+ * `pip install -e ".[docs]"`: for generating documentation
21
+ * `pip install -e ".[examples]"`: for running optional examples
22
+ * `pip install -e ".[osse]"`: for running optional observing system simulation experiment (OSSE) examples
25
23
 
26
- Multiple optional dependencies can be installed with a comma-separated list (e.g., `pip install -e .[dev,examples]`)
24
+ Multiple optional dependencies can be installed with a comma-separated list (e.g., `pip install -e ".[dev,examples]"`)
27
25
 
28
26
  ## Development Tools
29
27
 
30
28
  Development tools are applicable when working with the source code.
31
29
 
32
- ### Docker and Docker-Compose
33
-
34
- TAT-C includes a Dockerfile (`Dockerfile`) that specifies build targets for a base runtime (the TAT-C library), an application server, and a distributed task worker.
35
-
36
- To build images, run:
37
- ```shell
38
- docker build -t tatc .
39
- ```
40
-
41
30
  ### Unit Tests
42
31
 
43
32
  Run unit tests with:
@@ -76,10 +65,11 @@ Paul T. Grogan <paul.grogan@asu.edu>
76
65
 
77
66
  This project was supported in part by the National Aeronautics and Space
78
67
  Administration (NASA) Earth Science Division (ESD) Earth Science Technology
79
- Office (ESTO) Advanced Information Systems Technology (AIST) program under
80
- grant numbers: NNX17AE06G, 80NSSC17K0586, 80NSSC20K1118, 80NSSC21K1515,
81
- 80NSSC22K1705 and 80NSSC24K0575 and NASA Jet Propulsion Laboratory
82
- contracts: 1074657, 1689594, 1686623, 1705655.
68
+ Office (ESTO) Advanced Information Systems Technology (AIST) program.
69
+ Financial support is acknowledged under NASA grant numbers: NNX17AE06G,
70
+ 80NSSC17K0586, 80NSSC20K1118, 80NSSC21K1515, 80NSSC22K1705, 80NSSC24K0575,
71
+ 80NSSC24K0921; NASA Jet Propulsion Laboratory subcontracts: 1689594, 1686623,
72
+ 1704657, 1705655; Texas A \& M University subaward M2403907.
83
73
 
84
74
  Current Project Team
85
75
  * PI: Paul T. Grogan <paul.grogan@asu.edu>
@@ -92,4 +82,4 @@ Project Alumni
92
82
  * Lindsay Portelli
93
83
  * Matthew Sabatini
94
84
  * Evan Abel
95
- * Sigfried Hache
85
+ * Sigfried Hache
@@ -12,7 +12,7 @@ authors = [
12
12
  {name = "Paul T. Grogan", email = "paul.grogan@asu.edu"}
13
13
  ]
14
14
  readme = "README.md"
15
- requires-python = ">=3.9, <3.11"
15
+ requires-python = ">=3.8, <3.13"
16
16
  license = {text = "BSD License"}
17
17
  classifiers = [
18
18
  "Programming Language :: Python :: 3",
@@ -20,14 +20,17 @@ classifiers = [
20
20
  "Development Status :: 4 - Beta"
21
21
  ]
22
22
  dependencies = [
23
- "geopandas >= 0.14",
23
+ "geopandas >= 0.13.2",
24
+ "joblib",
24
25
  "numba",
25
26
  "numpy",
26
27
  "pandas",
27
28
  "pydantic >= 2.6",
29
+ "pyproj",
28
30
  "shapely >= 2",
29
31
  "skyfield >= 1.48",
30
- "sgp4"
32
+ "sgp4",
33
+ "typing-extensions",
31
34
  ]
32
35
  dynamic = ["version"]
33
36
 
@@ -39,7 +42,6 @@ Issues = "https://github.com/code-lab-org/tatc/issues"
39
42
 
40
43
  [tool.setuptools.packages.find]
41
44
  where = ["src"]
42
- exclude = ["tests."]
43
45
 
44
46
  [tool.setuptools.package-data]
45
47
  "tatc" = ["resources/*.bsp"]
@@ -55,14 +57,12 @@ dev = [
55
57
  docs = [
56
58
  "autodoc_pydantic >= 2",
57
59
  "docutils",
58
- "myst-parser",
59
- "nbsphinx",
60
+ "myst-nb",
60
61
  "sphinx >= 7",
61
62
  "sphinx-rtd-theme"
62
63
  ]
63
64
  examples = [
64
65
  "ipykernel",
65
- "joblib",
66
66
  "matplotlib"
67
67
  ]
68
68
  osse = [
@@ -73,22 +73,6 @@ osse = [
73
73
  "scikit-learn",
74
74
  "seaborn"
75
75
  ]
76
- app = [
77
- "aiofiles",
78
- "aiohttp",
79
- "aiosqlite",
80
- "celery[librabbitmq,redis]",
81
- "fastapi >= 0.110.0",
82
- "fastapi-users[sqlalchemy]",
83
- "geojson-pydantic",
84
- "msgpack-asgi",
85
- "python-dotenv",
86
- "tzlocal",
87
- "uvicorn[standard]"
88
- ]
89
- appdev = [
90
- "httpx"
91
- ]
92
76
 
93
77
  [tool.setuptools.dynamic]
94
78
  version = {attr = "tatc.__version__"}
@@ -9,4 +9,4 @@ from . import constants
9
9
  from . import utils
10
10
  from . import resources
11
11
 
12
- __version__ = "3.2.0"
12
+ __version__ = "3.2.2"
@@ -9,6 +9,9 @@ from .coverage import (
9
9
  reduce_observations,
10
10
  grid_observations,
11
11
  )
12
+ from .ro_coverage import (
13
+ collect_ro_observations,
14
+ )
12
15
  from .track import (
13
16
  collect_orbit_track,
14
17
  collect_ground_track,
@@ -345,8 +345,8 @@ def collect_observations(
345
345
  gdf["sat_sunlit"] = _get_satellite_sunlit_series(gdf, sat)
346
346
  # append solar altitude/azimuth columns
347
347
  sun_altaz = _get_solar_altaz_series(gdf)
348
- gdf["sun_alt"] = sun_altaz.apply(lambda r: r[0].degrees)
349
- gdf["sun_az"] = sun_altaz.apply(lambda r: r[1].degrees)
348
+ gdf["solar_alt"] = sun_altaz.apply(lambda r: r[0].degrees)
349
+ gdf["solar_az"] = sun_altaz.apply(lambda r: r[1].degrees)
350
350
  # append local solar time column
351
351
  gdf["solar_time"] = _get_solar_time_series(gdf)
352
352
  else:
@@ -126,19 +126,17 @@ def compute_latencies(
126
126
 
127
127
  Returns:
128
128
  geopandas.GeoDataFrame: The data frame of collected latency results, sorted by the 'observed'
129
- column in ascending order. It includes
130
- the following columns:
131
- - 'point_id' (int64): Identifier for the observation point.
132
- - 'geometry' (geometry): Geometry representing the observation point.
133
- - 'satellite' (object): Name or identifier of the satellite.
134
- - 'instrument' (object): Name or identifier of the instrument.
135
- - 'sat_alt' (float64): Altitude of the satellite at the time of observation.
136
- - 'sat_az' (float64): Azimuth of the satellite at the time of observation.
137
- - 'station' (object): Name or identifier of the ground station for downlink.
138
- - 'downlinked' (datetime64[ns, UTC]): Timestamp when the observation data was downlinked.
139
- - 'latency' (timedelta64[ns]): Latency between observation and downlink.
140
- - 'observed' (datetime64[ns, UTC]): Timestamp when the observation was made.
141
-
129
+ column in ascending order. It includes the following columns:
130
+ - 'point_id' (int64): Identifier for the observation point.
131
+ - 'geometry' (geometry): Geometry representing the observation point.
132
+ - 'satellite' (object): Name or identifier of the satellite.
133
+ - 'instrument' (object): Name or identifier of the instrument.
134
+ - 'sat_alt' (float64): Altitude of the satellite at the time of observation.
135
+ - 'sat_az' (float64): Azimuth of the satellite at the time of observation.
136
+ - 'station' (object): Name or identifier of the ground station for downlink.
137
+ - 'downlinked' (datetime64[ns, UTC]): Timestamp when the observation data was downlinked.
138
+ - 'latency' (timedelta64[ns]): Latency between observation and downlink.
139
+ - 'observed' (datetime64[ns, UTC]): Timestamp when the observation was made.
142
140
  """
143
141
  if observations.empty or downlinks.empty:
144
142
  return _get_empty_latency_frame()
@@ -202,7 +200,7 @@ def compute_latencies(
202
200
 
203
201
  # set CRS if observations is a GeoDataFrame and has a defined CRS
204
202
  if isinstance(observations, gpd.GeoDataFrame) and observations.crs:
205
- obs.crs = observations.crs
203
+ obs.set_crs(observations.crs)
206
204
 
207
205
  # sort observations by observed time
208
206
  obs.sort_values(by="observed", inplace=True)
@@ -0,0 +1,255 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Methods to perform radio occultation (RO) coverage analysis.
4
+
5
+ @author: Paul T. Grogan <paul.grogan@asu.edu>
6
+ """
7
+
8
+ from typing import List, Tuple, Union
9
+ from datetime import datetime
10
+ from itertools import chain
11
+
12
+ import geopandas as gpd
13
+ import numpy as np
14
+ from shapely.geometry import MultiPoint, Point
15
+ from skyfield.api import EarthSatellite, wgs84, Distance, Velocity, Time
16
+ from skyfield.positionlib import ICRF
17
+
18
+ from ..schemas.satellite import Satellite
19
+
20
+ from ..constants import timescale
21
+
22
+
23
+ def _collect_ro_series(
24
+ transmitter: Satellite,
25
+ ts: Time,
26
+ rx_pv: ICRF,
27
+ rx_n_u: List[float],
28
+ max_azimuth: float,
29
+ range_elevation: Tuple[float],
30
+ ):
31
+ # construct transmitter
32
+ tx_tle = transmitter.orbit.to_tle()
33
+ tx = EarthSatellite(tx_tle.tle[0], tx_tle.tle[1], transmitter.name)
34
+ # transmitter position (x_tx), velocity (v_tx)
35
+ tx_pv = tx.at(ts)
36
+ # relative position, velocity of transmitter from receiver
37
+ # x_(rx,tx) = x_tx - x_rx; v_(rx,tx) = v_tx - v_rx
38
+ rx_tx_pv = tx_pv - rx_pv
39
+ # tangent point position (m)
40
+ # x_tp = x_tx - x_(rx,tx) . [ x_tx . x_(rx,tx) ] / || x_(rx,tx) ||
41
+ tp_p = tx_pv.position.m - np.einsum(
42
+ "ij,j->ij",
43
+ rx_tx_pv.position.m,
44
+ np.divide(
45
+ np.einsum("ij,ij->j", tx_pv.position.m, rx_tx_pv.position.m),
46
+ np.einsum("ij,ij->j", rx_tx_pv.position.m, rx_tx_pv.position.m),
47
+ ),
48
+ )
49
+ # tangent point velocity (m/s) - derived using chain rule
50
+ # v_tp = v_tx - v_(rx,tx) . [ x_tx . x_(rx,tx) ] / || x_(rx,tx) ||
51
+ # - x_(rx,tx) . [
52
+ # [ v_tx . x_(rx,tx) ] + [ x_tx . v_(rx,tx) ] ] / || x_(rx,tx) || ]
53
+ # - 2 * [ v_(rx,tx) . x_(rx,tx) ] * [ x_tx . x_(rx,tx) ] / || x_(rx,tx) ||^2
54
+ # ]
55
+ tp_v = (
56
+ tx_pv.velocity.m_per_s
57
+ - np.einsum(
58
+ "ij,j->ij",
59
+ rx_tx_pv.velocity.m_per_s,
60
+ np.divide(
61
+ np.einsum("ij,ij->j", tx_pv.position.m, rx_tx_pv.position.m),
62
+ np.einsum("ij,ij->j", rx_tx_pv.position.m, rx_tx_pv.position.m),
63
+ ),
64
+ )
65
+ - np.einsum(
66
+ "ij,j->ij",
67
+ rx_tx_pv.position.m,
68
+ (
69
+ np.divide(
70
+ (
71
+ np.einsum(
72
+ "ij,ij->j", tx_pv.velocity.m_per_s, rx_tx_pv.position.m
73
+ )
74
+ + np.einsum(
75
+ "ij,ij->j", tx_pv.position.m, rx_tx_pv.velocity.m_per_s
76
+ )
77
+ ),
78
+ np.einsum("ij,ij->j", rx_tx_pv.position.m, rx_tx_pv.position.m),
79
+ )
80
+ - 2
81
+ * np.divide(
82
+ np.multiply(
83
+ np.einsum(
84
+ "ij,ij->j", rx_tx_pv.velocity.m_per_s, rx_tx_pv.position.m
85
+ ),
86
+ np.einsum("ij,ij->j", tx_pv.position.m, rx_tx_pv.position.m),
87
+ ),
88
+ np.power(
89
+ np.einsum("ij,ij->j", rx_tx_pv.position.m, rx_tx_pv.position.m),
90
+ 2,
91
+ ),
92
+ )
93
+ ),
94
+ )
95
+ )
96
+ # intersecting (-1) or parallel (+1) view of tangent point
97
+ tp_sign = np.sign(
98
+ np.einsum("ij,ij->j", tp_p - tx_pv.position.m, tp_p - rx_pv.position.m)
99
+ )
100
+ # relative transmitter position from receiver in receiver orbit plane
101
+ rx_tx_p_rx_plane = rx_tx_pv.position.m - np.einsum(
102
+ "ij,j->ij", rx_n_u, np.einsum("ij,ij->j", rx_n_u, rx_tx_pv.position.m)
103
+ )
104
+ # transmitter azimuth angle in receiver body-fixed frame
105
+ rx_tx_azimuth = np.degrees(
106
+ np.arccos(
107
+ np.divide(
108
+ np.einsum("ij,ij->j", rx_tx_p_rx_plane, rx_pv.velocity.m_per_s),
109
+ np.multiply(
110
+ np.linalg.norm(rx_tx_p_rx_plane, axis=0),
111
+ np.linalg.norm(rx_pv.velocity.m_per_s, axis=0),
112
+ ),
113
+ )
114
+ )
115
+ )
116
+ # occultation observations
117
+ occ_obs = []
118
+ # occultation arc
119
+ occ_arc = None
120
+ # valid if tangent point intersects and transmitter view angle below maximum
121
+ valid = np.logical_and(
122
+ tp_sign < 0, rx_tx_azimuth % (180 - max_azimuth) < max_azimuth
123
+ )
124
+ # events occur when validity changes value
125
+ is_event = np.diff(valid)
126
+ # loop over valid times
127
+ for j in np.nonzero(valid)[0]:
128
+ # tangent point inertial position
129
+ tpp_icrf = ICRF(
130
+ Distance(m=tp_p[:, j]).au,
131
+ Velocity(km_per_s=tp_v[:, j] / 1000).au_per_d,
132
+ ts[j],
133
+ 399,
134
+ )
135
+ # tangent point geodetic position
136
+ tpp_geo = wgs84.geographic_position_of(tpp_icrf)
137
+ # check if the tangent point height is within elevation range
138
+ if (
139
+ tpp_geo.elevation.m > range_elevation[0]
140
+ and tpp_geo.elevation.m < range_elevation[1]
141
+ ):
142
+ if occ_arc is None:
143
+ # start of new RO observation
144
+ occ_arc = {
145
+ "tx": tx.name,
146
+ "is_rising": rx_tx_azimuth[j] < max_azimuth,
147
+ "points": [],
148
+ }
149
+
150
+ # azimuth of transmitter from geodetic tangent point (clockwise from North)
151
+ tp_tx_azmimuth = (tx - tpp_geo).at(ts[j]).altaz()[1].degrees
152
+
153
+ occ_arc["points"].append(
154
+ {
155
+ "time": ts[j].utc_datetime(),
156
+ "tangent_point": tpp_geo,
157
+ "rx_tx_azimuth": rx_tx_azimuth[j] % (180 - max_azimuth),
158
+ "tp_tx_azimuth": tp_tx_azmimuth,
159
+ }
160
+ )
161
+ if j + 1 >= len(ts) or is_event[j]:
162
+ # end of RO observation due to validity or boundary constraint
163
+ occ_obs.append(occ_arc)
164
+ occ_arc = None
165
+ elif occ_arc is not None:
166
+ # end of RO observation due to elevation constraints
167
+ occ_obs.append(occ_arc)
168
+ occ_arc = None
169
+ return occ_obs
170
+
171
+
172
+ def collect_ro_observations(
173
+ receiver: Satellite,
174
+ transmitters: Union[Satellite, List[Satellite]],
175
+ times: List[datetime],
176
+ sample_elevation: float = 0,
177
+ max_azimuth: float = 65,
178
+ range_elevation: Tuple[float] = (-200e3, 60e3),
179
+ ) -> gpd.GeoDataFrame:
180
+ """
181
+ Collects Radio Occultation (RO) observations.
182
+
183
+ Args:
184
+ receiver (Satellite): the satellite with a RO receiver.
185
+ transmitters (typing.Union[Satellite,typing.List[Satellite]]): the satellite(s) with a RO transmitter.
186
+ times (typing.List[datetime.datetime]): The list of datetimes to sample.
187
+ sample_elevation: (float): the elevation (m) at which to sample observation attributes.
188
+ max_azimuth (float): the maximum transmitter azimuth angle (from receiver body-fixed frame) for a valid obsevation.
189
+ range_elevation: (typing.Tuple[float]): the lower and upper bound on tangent point elevation (m) for a valid observation.
190
+ """
191
+ # construct receiver
192
+ rx_tle = receiver.orbit.to_tle()
193
+ rx = EarthSatellite(rx_tle.tle[0], rx_tle.tle[1], receiver.name)
194
+ # define time steps
195
+ ts = timescale.from_datetimes(times)
196
+ # receiver position, velocity
197
+ rx_pv = rx.at(ts)
198
+ # unit vector normal to receiver orbit plane
199
+ rx_n_u = np.einsum(
200
+ "iik->ik",
201
+ np.cross(rx_pv.position.m.T[:, None, :], rx_pv.velocity.m_per_s.T[None, :, :]),
202
+ ).T
203
+ rx_n_u = np.divide(rx_n_u, np.linalg.norm(rx_n_u, axis=0))
204
+ # generate observations
205
+ obs = list(
206
+ chain.from_iterable(
207
+ [
208
+ _collect_ro_series(
209
+ transmitter, ts, rx_pv, rx_n_u, max_azimuth, range_elevation
210
+ )
211
+ for transmitter in (
212
+ transmitters if isinstance(transmitters, list) else [transmitters]
213
+ )
214
+ ]
215
+ )
216
+ )
217
+ # format results
218
+ return gpd.GeoDataFrame(
219
+ [
220
+ {
221
+ "receiver": receiver.name,
222
+ "transmitter": o["tx"],
223
+ "is_rising": o["is_rising"],
224
+ "geometry": MultiPoint(
225
+ [
226
+ [
227
+ point["tangent_point"].longitude.degrees,
228
+ point["tangent_point"].latitude.degrees,
229
+ point["tangent_point"].elevation.m,
230
+ ]
231
+ for point in o["points"]
232
+ ]
233
+ ),
234
+ "position": Point(
235
+ o["points"][sample_index]["tangent_point"].longitude.degrees,
236
+ o["points"][sample_index]["tangent_point"].latitude.degrees,
237
+ o["points"][sample_index]["tangent_point"].elevation.m,
238
+ ),
239
+ "rx_tx_azimuth": o["points"][sample_index]["rx_tx_azimuth"],
240
+ "tp_tx_azimuth": o["points"][sample_index]["tp_tx_azimuth"],
241
+ "start": o["points"][0]["time"],
242
+ "end": o["points"][-1]["time"],
243
+ "time": o["points"][sample_index]["time"],
244
+ }
245
+ for o in obs
246
+ for sample_index in [
247
+ min(
248
+ range(len(o["points"])),
249
+ key=lambda i: abs(
250
+ o["points"][i]["tangent_point"].elevation.m - sample_elevation
251
+ ),
252
+ )
253
+ ]
254
+ ]
255
+ ).sort_values("time", ignore_index=True)