Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH/DOC: geocentric / geodetic info for sgp4 instrument, metadata improvement #66

Merged
merged 23 commits into from
Oct 29, 2021

Conversation

jklenzing
Copy link
Member

@jklenzing jklenzing commented Aug 6, 2021

Description

Addresses #56, #55, #16

  • Adds conversions to latitude / longitude / altitude to missions_sgp4
  • Improves metadata generation and consistency throughout.
  • Adds boolean kwarg 'one_orbit', which adjusts the output number of points to include a single orbit

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

By loading satellite data and plotting orbits. Example load:

import pysat
sat = pysat.Instrument('missions', 'sgp4', inclination=15,
                               alt_periapsis=400, alt_apoapsis=600)

The output should match expectations, with max latitude corresponding to inclination, and altitude range described by periapsis and apoapsis. Note that both spherical (eg, latitude) and elliposidal(eg, geod_latitude) calculations are included. There remains some discrepancy on the order of 10 km in expectations. This could be due to the methods.convert_from_keplerian method.

Test Configuration:

  • Operating system: Mac OS X 10.15.7
  • Version number: Python 3.8.11
  • Any details about your local setup that are relevant

Checklist:

  • Make sure you are merging into the develop (not main) branch
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • Add a note to CHANGELOG.md, summarizing the changes

@jklenzing
Copy link
Member Author

Putting this up as a draft pull into #60 to show downstream changes. Currently includes lat / long / alt calculations from both spherical and ellipsoidal assumptions for comparison and testing.

@jklenzing jklenzing added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 6, 2021
@jklenzing jklenzing mentioned this pull request Aug 6, 2021
10 tasks
@jklenzing jklenzing changed the base branch from enh/sgp4 to develop August 16, 2021 18:43
@jklenzing jklenzing added this to In progress in Orbital Dynamics Interface via automation Aug 16, 2021
@jklenzing jklenzing marked this pull request as ready for review September 1, 2021 21:31
@jklenzing
Copy link
Member Author

jklenzing commented Sep 1, 2021

Marking this as ready for review, but testing of expected orbits is required. Please try out whatever options you can think of when generating orbits.

@JonathonMSmith
Copy link
Collaborator

not sure if this is because of the way I installed or something, but I only get data when I load dates between 2017-2019

@jklenzing
Copy link
Member Author

jklenzing commented Sep 7, 2021

not sure if this is because of the way I installed or something, but I only get data when I load dates between 2017-2019

It's tied to how we inherit the instrument definition from the core code. Because a file has to exist, we have a fake routine for list files. We should be able to fix this at the instrument level by passing through a wider range of dates here:

list_files = functools.partial(ps_meth.list_files, test_dates=_test_dates)

Replacing the above with

file_date_range = pds.date_range(dt.datetime(2000, 1, 1),
                                 dt.datetime(2030, 12, 31))
list_files = functools.partial(ps_meth.list_files,
                               file_date_range=file_date_range)

should allow a wider range of dates.

@jklenzing
Copy link
Member Author

Conversely, you can set a new range when initializing without changing the code:

sat = pysat.Instrument('missions', 'sgp4', file_date_range=pds.date_range(dt.datetime(2012, 1, 1), dt.datetime(2015, 1, 1))

I keep forgetting about this feature.

@jklenzing jklenzing moved this from In progress to Needs Review in Orbital Dynamics Interface Oct 7, 2021
@rstoneback
Copy link
Collaborator

Back on my awareness list! Will take a look tomorrow. Apologies for the delay.

Copy link
Collaborator

@rstoneback rstoneback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the improvements @jklenzing!

bstar=None, num_samples=None, cadence='1S'):
def load(fnames, tag=None, inst_id=None, TLE1=None, TLE2=None,
alt_periapsis=None, alt_apoapsis=None,
inclination=None, raan=0., arg_periapsis=0., mean_anomaly=0.,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that raan and arg_periapsis etc. are used based on kwarg settings. Seems possible a user may not know when they are used. I'd recommend adding info on the docstring to inclination that it is the key for the other parameters. Info for the other variables should be updated to reflect the new defaults.

@jklenzing
Copy link
Member Author

Thanks @rstoneback. I've updated docstrings and added a test for one of the new options.

@jklenzing jklenzing merged commit 0fa7053 into develop Oct 29, 2021
Orbital Dynamics Interface automation moved this from Needs Review to Done Oct 29, 2021
@jklenzing jklenzing deleted the enh/geospacepy branch October 29, 2021 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
3 participants