spherapy 0.2.0__py3-none-any.whl
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.
- spherapy/__init__.py +93 -0
- spherapy/__main__.py +17 -0
- spherapy/_version.py +34 -0
- spherapy/data/TLEs/25544.tle +153378 -0
- spherapy/orbit.py +874 -0
- spherapy/timespan.py +436 -0
- spherapy/updater.py +91 -0
- spherapy/util/__init__.py +0 -0
- spherapy/util/celestrak.py +87 -0
- spherapy/util/constants.py +38 -0
- spherapy/util/credentials.py +131 -0
- spherapy/util/elements_u.py +70 -0
- spherapy/util/epoch_u.py +149 -0
- spherapy/util/exceptions.py +7 -0
- spherapy/util/orbital_u.py +72 -0
- spherapy/util/spacetrack.py +272 -0
- spherapy-0.2.0.dist-info/METADATA +211 -0
- spherapy-0.2.0.dist-info/RECORD +22 -0
- spherapy-0.2.0.dist-info/WHEEL +5 -0
- spherapy-0.2.0.dist-info/entry_points.txt +3 -0
- spherapy-0.2.0.dist-info/licenses/LICENSE.md +19 -0
- spherapy-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spherapy
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: An orbital propagator wrapper and TLE fetcher
|
|
5
|
+
Author-email: Robert Mearns <rz.mearns@gmail.com>
|
|
6
|
+
Maintainer-email: Robert Mearns <rz.mearns@gmail.com>
|
|
7
|
+
Project-URL: Documentation, https://rzmearns.github.io/spherapy/
|
|
8
|
+
Project-URL: Repository, https://github.com/rzmearns/spherapy
|
|
9
|
+
Project-URL: Issues, https://github.com/rzmearns/spherapy/issues
|
|
10
|
+
Keywords: satellite,sgp,space,orbit
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE.md
|
|
14
|
+
Requires-Dist: astropy==5.3.4
|
|
15
|
+
Requires-Dist: scipy>=1.8.0
|
|
16
|
+
Requires-Dist: skyfield==1.46
|
|
17
|
+
Requires-Dist: numpy>=1.25.2
|
|
18
|
+
Requires-Dist: progressbar2==4.4.1
|
|
19
|
+
Requires-Dist: hapsira==0.18.0
|
|
20
|
+
Requires-Dist: spacetrack==1.2.0
|
|
21
|
+
Requires-Dist: keyring>=25.0.0
|
|
22
|
+
Requires-Dist: platformdirs==4.3.8
|
|
23
|
+
Requires-Dist: importlib_resources>=6.5.2
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: line-profiler==4.2.0; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest==8.4.1; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-check==2.5.3; extra == "dev"
|
|
28
|
+
Requires-Dist: mypy==1.17.0; extra == "dev"
|
|
29
|
+
Requires-Dist: ruff==0.12.4; extra == "dev"
|
|
30
|
+
Requires-Dist: pre-commit==4.2.0; extra == "dev"
|
|
31
|
+
Requires-Dist: types-requests>=2.32.4; extra == "dev"
|
|
32
|
+
Requires-Dist: types-python-dateutil>=2.9.0; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
## About
|
|
36
|
+
Spherapy is a convenience wrapper around the fantastic libraries [skyfield](https://pypi.org/project/skyfield/), [spacetrack](https://pypi.org/project/spacetrack/), and [hapsira](https://pypi.org/project/hapsira/) (a maintained poliastro fork).
|
|
37
|
+
It provides a consistent and straightforward method to create/propagate orbits without worrying about the implementation details of each library:
|
|
38
|
+
|
|
39
|
+
- historical TLEs for known satellites (skyfield)
|
|
40
|
+
- propagated orbital parameters hypothetical satellites (skyfield)
|
|
41
|
+
- analytical orbital parameters (hapsira)
|
|
42
|
+
- list of positions
|
|
43
|
+
|
|
44
|
+
Addtionaly, it provides a straightforward interface for updating used TLEs via [spacetrack](https://www.space-track.org)
|
|
45
|
+
|
|
46
|
+
Created orbits contain commonly used state variables:
|
|
47
|
+
|
|
48
|
+
- satellite positions in various frames
|
|
49
|
+
- velocities
|
|
50
|
+
- etc.
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
1. install the package
|
|
54
|
+
```bash
|
|
55
|
+
pip install spherapy
|
|
56
|
+
```
|
|
57
|
+
2. configure. see [Configuration](#configuration)
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
- ensure spherapy has been configured, see [Configuration](#configuration)
|
|
61
|
+
- import the spherapy package
|
|
62
|
+
```python
|
|
63
|
+
import spherapy.updater
|
|
64
|
+
import spherapy.timespan
|
|
65
|
+
import spherapy.orbit
|
|
66
|
+
```
|
|
67
|
+
- if using real world satellites; update the desired TLEs (you can also use the TLEs supplied with the package, but these will be out of date).
|
|
68
|
+
- TLE id's can be found using [NORAD's CelesTrak catalogue search](https://celestrak.org/satcat/search.php)
|
|
69
|
+
```python
|
|
70
|
+
updated_TLEs = spherapy.updater.updateTLEs([25544]) #ISS
|
|
71
|
+
TLE_paths = spherapy.updater.getTLEFilePaths([25544], use_packaged=True) #ISS
|
|
72
|
+
```
|
|
73
|
+
- set up a timespan
|
|
74
|
+
```python
|
|
75
|
+
t = spherapy.timespan.TimeSpan(datetime.datetime(2024,10,15,0,0,1),'1S','90M')
|
|
76
|
+
```
|
|
77
|
+
- construct an orbit
|
|
78
|
+
- from a TLE (good practice to update the TLE with the most recent)
|
|
79
|
+
```python
|
|
80
|
+
o = spherapy.orbit.Orbit.fromTLE(t, TLE_paths[0])
|
|
81
|
+
```
|
|
82
|
+
- from orbital parameters
|
|
83
|
+
```python
|
|
84
|
+
o = spherapy.orbit.Orbit.fromAnalyticalOrbitalParam(timespan, body='Earth',
|
|
85
|
+
a=6978,
|
|
86
|
+
ecc=0,
|
|
87
|
+
inc=0,
|
|
88
|
+
raan=0,
|
|
89
|
+
argp=0,
|
|
90
|
+
mean_nu=0,
|
|
91
|
+
name='My Analytical Orbit',
|
|
92
|
+
astrobodies=True)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### Full TLE example (for copy paste)
|
|
96
|
+
```
|
|
97
|
+
import datetime
|
|
98
|
+
import spherapy.updater
|
|
99
|
+
import spherapy.timespan
|
|
100
|
+
import spherapy.orbit
|
|
101
|
+
TLE_paths = spherapy.updater.getTLEFilePaths([25544], use_packaged=True) #ISS
|
|
102
|
+
t = spherapy.timespan.TimeSpan(datetime.datetime(2024,10,15,0,0,1),'1S','90M')
|
|
103
|
+
o = spherapy.orbit.Orbit.fromTLE(t, TLE_paths[0])
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### Full Analytical exmaple (for copy paste)
|
|
107
|
+
```
|
|
108
|
+
import datetime
|
|
109
|
+
import spherapy.timespan
|
|
110
|
+
import spherapy.orbit
|
|
111
|
+
t = spherapy.timespan.TimeSpan(datetime.datetime(2024,10,15,0,0,1),'1S','90M')
|
|
112
|
+
o = spherapy.orbit.Orbit.fromAnalyticalOrbitalParam(timespan, body='Earth',
|
|
113
|
+
a=6978,
|
|
114
|
+
ecc=0,
|
|
115
|
+
inc=0,
|
|
116
|
+
raan=0,
|
|
117
|
+
argp=0,
|
|
118
|
+
mean_nu=0,
|
|
119
|
+
name='My Analytical Orbit',
|
|
120
|
+
astrobodies=True)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## SpaceTrack Credentials
|
|
124
|
+
In order to calculate the position of a historical satellite at any given time, spherapy requires [TLE information](https://en.wikipedia.org/wiki/Two-line_element_set) for each satellite which is accurate for the given time period (or 'epoch').
|
|
125
|
+
TLE data can be obtained from either [Celestrak](https://celestrak.org/) or [Spacetrack](https://www.space-track.org/).
|
|
126
|
+
Celestrak holds only the most recent TLE data for each satellite, while Spacetrack will provide historical TLE data. spherapy will fall back to using Celestrak if it cannot authenticate access to Spacetrack.
|
|
127
|
+
In order to use Spacetrack, you must provide your [Spacetrack credentials](https://www.space-track.org/auth/createAccount) to spherapy.
|
|
128
|
+
|
|
129
|
+
## Configuration
|
|
130
|
+
Configuration for spherapy can either use the default settings, or settings specified in a `spherapy.conf` file.
|
|
131
|
+
|
|
132
|
+
### Default settings
|
|
133
|
+
If the default settings are used, spherapy will use the system user data directory and expect spacetrack credentials to be stored in the system keyring.
|
|
134
|
+
The default data directories are listed in [Directories](#directories)
|
|
135
|
+
|
|
136
|
+
### Custom settings
|
|
137
|
+
Custom settings can be specified in a `spherapy.conf` file.
|
|
138
|
+
This file can be located either in the system user's config file (described in [Directories](#directories)) or at a location specified by the environment variable `SPHERAPY_CONFIG_DIR`.
|
|
139
|
+
|
|
140
|
+
The fields of `spherapy.conf` are described below
|
|
141
|
+
```ini
|
|
142
|
+
[credentials]
|
|
143
|
+
SpacetrackUser = None # the spacetrack user, if left as "None" will source from system keyring
|
|
144
|
+
SpacetrackPasswd = None # the spacetrack password, if left as "None" will source from system keyring
|
|
145
|
+
|
|
146
|
+
[paths]
|
|
147
|
+
# relative paths are assumed to be relative to the location of this file
|
|
148
|
+
# do not quote path
|
|
149
|
+
TLE_path = ./spherapy/data/TLEs # the location where TLE files will be saved, if left empty (""), will default to system user's directory.
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Directories
|
|
153
|
+
If `SPHERAPY_CONFIG_DIR` is not set or `TLE_path` is left empty in `spherapy.conf`, the spherapy default directories will be used:
|
|
154
|
+
|
|
155
|
+
#### Linux
|
|
156
|
+
- TLE data dir:
|
|
157
|
+
``` bash
|
|
158
|
+
/home/{username}/.local/share/spherapy/TLEs
|
|
159
|
+
```
|
|
160
|
+
- config dir:
|
|
161
|
+
``` bash
|
|
162
|
+
/home/{username}/.config/spherapy/spherapy/{spherapy_version}/
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### OSX
|
|
166
|
+
- TLE data dir:
|
|
167
|
+
``` bash
|
|
168
|
+
/Users/{username}/Library/Application Support/spherapy/TLEs
|
|
169
|
+
```
|
|
170
|
+
- config dir:
|
|
171
|
+
``` bash
|
|
172
|
+
/Users/{username}/Library/Application Support/spherapy/{spherapy_version}/
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
#### Windows
|
|
176
|
+
- TLE data dir:
|
|
177
|
+
``` bash
|
|
178
|
+
'C:\\Users\\{username}\\AppData\\Local\\spherapy\\TLEs'
|
|
179
|
+
```
|
|
180
|
+
- config dir:
|
|
181
|
+
``` bash
|
|
182
|
+
'C:\\Users\\{username}\\AppData\\Local\\spherapy\\{spherapy_version}'
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Passwords
|
|
186
|
+
By default spherapy will use the system keyring to store the Spacetrack username and credentials (see [SpaceTrack Credentials](#spacetrack-credentials))
|
|
187
|
+
If a config file is supplied, the credentials in the file will be used.
|
|
188
|
+
|
|
189
|
+
Credentials can be added to the keyring by running the command (in the terminal, not the python shell)
|
|
190
|
+
```
|
|
191
|
+
spherapy-create-credentials
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Configration File Format
|
|
195
|
+
The configuration file `spherapy.conf` should have the following format:
|
|
196
|
+
```ini
|
|
197
|
+
[credentials]
|
|
198
|
+
SpacetrackUser = None
|
|
199
|
+
SpacetrackPasswd = None
|
|
200
|
+
|
|
201
|
+
[paths]
|
|
202
|
+
# relative paths are assumed to be relative to the location of this file
|
|
203
|
+
# do not quote path
|
|
204
|
+
TLE_path =
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Data Storage
|
|
208
|
+
- TLEs
|
|
209
|
+
- TLEs will be stored in the data directory, with a single file for each satellite ID.
|
|
210
|
+
`{sat_id}.tle`, containing all historical TLEs for that satellite.
|
|
211
|
+
- If celestrak is used instead, the file will be saved as a temporary file `{sat_id}.temptle`, which will be overwritten on each fetch from celestrak.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
spherapy/__init__.py,sha256=v1n13-2Uuy8GEWkB_B5mu2tSkAOVEPVP2eF0GixSPtI,2865
|
|
2
|
+
spherapy/__main__.py,sha256=YOcE__6OgX-e7lJ6UpeGS8Iw5igG0jEraTq8KOqGuDA,374
|
|
3
|
+
spherapy/_version.py,sha256=Dg8AmJomLVpjKL6prJylOONZAPRtB86LOce7dorQS_A,704
|
|
4
|
+
spherapy/orbit.py,sha256=MyRa1U5cEdzP1yhFLbp25T1kHqTpZVnj75Siwfe6vbo,32607
|
|
5
|
+
spherapy/timespan.py,sha256=xc5JEYtDcG4zZdsbdW9lcIX_PXzXzNJ-xGD_bCWJFDs,14438
|
|
6
|
+
spherapy/updater.py,sha256=vJspNTn6fa7qpECFLBWOmpCUVhJs_QBeAMa0JDmnmks,3249
|
|
7
|
+
spherapy/data/TLEs/25544.tle,sha256=D-kndlhtWawbxR8tCU-7QZB1VZxROzutUBgc1ZwO4C0,7873403
|
|
8
|
+
spherapy/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
spherapy/util/celestrak.py,sha256=KmcpCCuW30I00FRGBgz7ZUTgQJhGsgSN-LHJ16tJq9s,2273
|
|
10
|
+
spherapy/util/constants.py,sha256=sm53FCsupvkUC3eajfn-haFIqnonJHykOL3klWTikaA,1810
|
|
11
|
+
spherapy/util/credentials.py,sha256=NS5eIdjEOumzZ8BqzRZ9mWp8BhRdfGWbY6qQkMjzS90,4057
|
|
12
|
+
spherapy/util/elements_u.py,sha256=ycHTu0-p6ZNI8WHpNPanGf0a-WOLY7PaWphyG_AEJ28,2058
|
|
13
|
+
spherapy/util/epoch_u.py,sha256=IgSBumtS28JajLLkMLq-ST-qypoicqMdybXoAPTsjmo,3880
|
|
14
|
+
spherapy/util/exceptions.py,sha256=rDqYIhNdKnYBkbkxdhndSYI4mq4ENKtW01jEfZ7Yykk,215
|
|
15
|
+
spherapy/util/orbital_u.py,sha256=GKTNpiMTB7NAX-0TtD3lcHz5rFY2P_91odUnEBX-CJA,1760
|
|
16
|
+
spherapy/util/spacetrack.py,sha256=Kbh8IVgFN1UMegWxI1thxHx2gY5fEJ6ofT692-JmKA8,8165
|
|
17
|
+
spherapy-0.2.0.dist-info/licenses/LICENSE.md,sha256=9a5OXeKpk6GnCRhlQAPa5JQjl3PaFqseA1p2_DhXEbA,1055
|
|
18
|
+
spherapy-0.2.0.dist-info/METADATA,sha256=485HeliZvVHY_Zvj2TjoaU-VD8737CsVspNjZdqX74I,7756
|
|
19
|
+
spherapy-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
20
|
+
spherapy-0.2.0.dist-info/entry_points.txt,sha256=WpE3jlS6iiug9ZqUrAHQuLEhbDTpbnAtBz8b0yXJJOU,150
|
|
21
|
+
spherapy-0.2.0.dist-info/top_level.txt,sha256=X4rv7pGR9bAfVWOokUyHeDb6Z0jfIQCN6zDfh5f2NK4,9
|
|
22
|
+
spherapy-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright © 2025 Robert Mearns
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
spherapy
|