# spacetrack_files
This module allows you to download and parse Starlink ephemeris files.
## Setup
Simply add this module via `pip`
```
pip install spacetrack_files
```
## Using
You can:
- Download any available public files from SpaceTrack
- Parse Starlink ephemeris
### Downloading public files
### Downloading public files from SpaceTrack
Script below retrieves all public files and downloads them.
```py
import os
from spacetrack_files.api import SpaceTrackApi
api = SpaceTrackApi('your_username', 'your_password')
dirs = api.getDirsList()
base_download_path = '.'
for download_path in dirs:
if not os.path.exists(download_path):
os.mkdir(download_path)
fs = api.getDirsWithFiles()
downloading_files = fs[download_path]
for file in downloading_files:
file_download_path = os.path.join(base_download_path, download_path, file)
if os.path.exists(file_download_path):
continue
api.downloadFile(file, file_download_path)
```
### Parsing Starlink ephemeris
It's as simple as this:
```py
from spacetrack_files.files import EphemerisFile
# DO NOT RENAME FILE
eph = EphemerisFile('MEME_54190_STARLINK-5281_2210828_Operational_1375864140_UNCLASSIFIED.txt')
```
Keep in mind: module's using filename to parse satellite name, NORAD ID, classification and operational status. **Thus do not rename file**.
Ephemeris structure:
```py
@dataclass
class Ephemeris:
epoch_j2000: str
epoch: datetime
position: np.array
speed: np.array
corr_values: np.array
```
Variables `position` and `speed` are 3-dim vectors. `corr_values` is matrix 3x7.
You can also get ephemeris in DataFrame format:
```py
df = eph.to_dataframe()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Flexlug/spacetrack_files",
"name": "spacetrack-files",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "spacetrack ephemeris starlink",
"author": "Flexlug",
"author_email": "flexlug@outlook.com",
"download_url": "https://files.pythonhosted.org/packages/1f/6f/119eed81a07268cc710c51e64600b47612281f2c0841b0b5c783926f7965/spacetrack_files-0.0.3.tar.gz",
"platform": null,
"description": "# spacetrack_files\n\nThis module allows you to download and parse Starlink ephemeris files.\n\n## Setup\n\nSimply add this module via `pip`\n\n```\npip install spacetrack_files\n```\n\n## Using\n\nYou can:\n\n- Download any available public files from SpaceTrack\n- Parse Starlink ephemeris\n\n### Downloading public files\n\n### Downloading public files from SpaceTrack\n\nScript below retrieves all public files and downloads them.\n\n```py\nimport os\nfrom spacetrack_files.api import SpaceTrackApi\n\napi = SpaceTrackApi('your_username', 'your_password')\ndirs = api.getDirsList()\n\nbase_download_path = '.'\n\nfor download_path in dirs:\n if not os.path.exists(download_path):\n os.mkdir(download_path)\n\n fs = api.getDirsWithFiles()\n downloading_files = fs[download_path]\n\n for file in downloading_files:\n file_download_path = os.path.join(base_download_path, download_path, file)\n if os.path.exists(file_download_path):\n continue\n api.downloadFile(file, file_download_path)\n```\n\n### Parsing Starlink ephemeris\n\nIt's as simple as this:\n\n```py\nfrom spacetrack_files.files import EphemerisFile\n\n# DO NOT RENAME FILE\neph = EphemerisFile('MEME_54190_STARLINK-5281_2210828_Operational_1375864140_UNCLASSIFIED.txt') \n```\n\nKeep in mind: module's using filename to parse satellite name, NORAD ID, classification and operational status. **Thus do not rename file**.\n\nEphemeris structure:\n\n```py\n@dataclass\nclass Ephemeris:\n epoch_j2000: str\n epoch: datetime\n position: np.array\n speed: np.array\n corr_values: np.array\n```\n\nVariables `position` and `speed` are 3-dim vectors. `corr_values` is matrix 3x7.\n\nYou can also get ephemeris in DataFrame format:\n\n```py\ndf = eph.to_dataframe()\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Simple module for ephemeris download and parse",
"version": "0.0.3",
"project_urls": {
"GitHub": "https://github.com/Flexlug",
"Homepage": "https://github.com/Flexlug/spacetrack_files"
},
"split_keywords": [
"spacetrack",
"ephemeris",
"starlink"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "352f4b298cf1c791ae9ac960dbfb78cf5738faddbd3a6d603f917a111c262b20",
"md5": "ec75180f69d8836dacd539d5b9883333",
"sha256": "83cdc3da79d7392bcfad8eecbce616bd6ed3f473a8a6c637081ddb3e25ad16cb"
},
"downloads": -1,
"filename": "spacetrack_files-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ec75180f69d8836dacd539d5b9883333",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5601,
"upload_time": "2023-11-02T21:32:17",
"upload_time_iso_8601": "2023-11-02T21:32:17.914501Z",
"url": "https://files.pythonhosted.org/packages/35/2f/4b298cf1c791ae9ac960dbfb78cf5738faddbd3a6d603f917a111c262b20/spacetrack_files-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1f6f119eed81a07268cc710c51e64600b47612281f2c0841b0b5c783926f7965",
"md5": "26370fa6b5e5a487331fdcb1e1d9e1c2",
"sha256": "6881bcf785610a0e64ea9e633f36778294897b9bdb75704e15bbc03d134ad807"
},
"downloads": -1,
"filename": "spacetrack_files-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "26370fa6b5e5a487331fdcb1e1d9e1c2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4839,
"upload_time": "2023-11-02T21:32:21",
"upload_time_iso_8601": "2023-11-02T21:32:21.182101Z",
"url": "https://files.pythonhosted.org/packages/1f/6f/119eed81a07268cc710c51e64600b47612281f2c0841b0b5c783926f7965/spacetrack_files-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-02 21:32:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Flexlug",
"github_project": "spacetrack_files",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "spacetrack-files"
}