Skip to content

Commit

Permalink
Merge pull request #122 from pysat/maint/meta_header
Browse files Browse the repository at this point in the history
MAINT: Meta header for propagators
  • Loading branch information
jklenzing authored Nov 20, 2024
2 parents fe73ca4 + 593b81f commit 882b59b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
numpy_ver: ["latest"]
include:
- python-version: "3.10"
numpy_ver: "1.23"
numpy_ver: "1.24"
os: "ubuntu-latest"

name: Python ${{ matrix.python-version }} on ${{ matrix.os }} with numpy ${{ matrix.numpy_ver }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ __pycache__/

# Distribution / packaging
.Python
.python-version
env/
build/
develop-eggs/
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).

## [0.3.6] - 2024-XX-XX
* Maintenance
* Update meta headers to include orbital info used in propagation

## [0.3.5] - 2024-07-16
* Maintenance
* Update workflows coveralls usage
Expand Down
9 changes: 8 additions & 1 deletion pysatMissions/instruments/missions_sgp4.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,17 @@ def load(fnames, tag=None, inst_id=None, tle1=None, tle2=None,
eccentricity, np.radians(arg_periapsis),
np.radians(inclination), np.radians(mean_anomaly),
mean_motion, np.radians(raan))
# Set header level metadata
header = {'alt_periapsis': alt_periapsis, 'alt_apoapsis': alt_apoapsis,
'arg_periapsis': arg_periapsis, 'bstar': bstar,
'inclination': inclination, 'mean_anomaly': mean_anomaly,
'raan': raan}
else:
# Otherwise, use TLEs
satellite = sapi.Satrec.twoline2rv(line1, line2, sapi.WGS72)
mean_motion = satellite.mm
# Set header level metadata
header = {'tle1': line1, 'tle2': line2}

if one_orbit:
ind = times <= (2 * np.pi / mean_motion * 60)
Expand Down Expand Up @@ -261,7 +268,7 @@ def load(fnames, tag=None, inst_id=None, tle1=None, tle2=None,
data.index.name = 'Epoch'

# Create metadata corresponding to variables in load routine
meta = pysat.Meta()
meta = pysat.Meta(header_data=header)
meta['Epoch'] = {
meta.labels.units: 'Milliseconds since 1970-1-1',
meta.labels.notes: 'UTC time at middle of geophysical measurement.',
Expand Down
11 changes: 10 additions & 1 deletion pysatMissions/instruments/missions_skyfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,20 @@ def load(fnames, tag=None, inst_id=None, tle1=None, tle2=None,
eccentricity, np.radians(arg_periapsis),
np.radians(inclination), np.radians(mean_anomaly),
mean_motion, np.radians(raan))

# Set header level metadata
header = {'alt_periapsis': alt_periapsis, 'alt_apoapsis': alt_apoapsis,
'arg_periapsis': arg_periapsis, 'bstar': bstar,
'inclination': inclination, 'mean_anomaly': mean_anomaly,
'raan': raan}
else:
# Otherwise, use TLEs
satrec = sapi.Satrec.twoline2rv(line1, line2, sapi.WGS84)
mean_motion = satrec.mm

# Set header level metadata
header = {'tle1': line1, 'tle2': line2}

if one_orbit:
ind = times <= (2 * np.pi / mean_motion * 60)
times = times[ind]
Expand Down Expand Up @@ -250,7 +259,7 @@ def load(fnames, tag=None, inst_id=None, tle1=None, tle2=None,
data.index.name = 'Epoch'

# Create metadata corresponding to variables in load routine
meta = pysat.Meta()
meta = pysat.Meta(header_data=header)
meta['Epoch'] = {
meta.labels.units: 'Milliseconds since 1970-1-1',
meta.labels.notes: 'UTC time at middle of geophysical measurement.',
Expand Down

0 comments on commit 882b59b

Please sign in to comment.