Save location details to Observer instance to match the docs. by emirkmo · Pull Request #522 · astropy/astroplan · GitHub
Skip to content

Save location details to Observer instance to match the docs.#522

Merged
bmorris3 merged 12 commits into
astropy:mainfrom
emirkmo:add_elevation
Oct 11, 2022
Merged

Save location details to Observer instance to match the docs.#522
bmorris3 merged 12 commits into
astropy:mainfrom
emirkmo:add_elevation

Conversation

@emirkmo

@emirkmo emirkmo commented Aug 28, 2022

Copy link
Copy Markdown
Contributor

Saves longitude latitude and elevation info to Observer class as properties to match the docs. Adds tests, docstrings, and updates changelog.

Fixes #521 (I also noticed longitude and latitude were missing).

Discussion

The Linked PR addresses by adding longitude, latitude, and elevation methods with @property decorator that are re-calculated from the current self.location which is of type astropy.coordinates.EarthLocation. So that updating the location also updates the parameters. Added a meaningful test that should fail if the underlying function from astropy changes significantly.

@wtgee wtgee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @emirkmo, thanks for the PR! I'll leave the actual decisions to @bmorris3 (and they need to kick-start the workflow tests anyway), but I've made a few comments below.

Comment thread CHANGES.rst Outdated
Comment thread astroplan/tests/test_observer.py Outdated
Comment thread astroplan/tests/test_observer.py Outdated
Comment thread astroplan/observer.py Outdated
Comment on lines +1964 to +1967

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The docstrings here should be changed. These are describing params as if the property could be set, but it cannot (which might wanted to be added, @bmorris3?).

Can you change the docstrings to match a getter property?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, I actually just copied it from the Observer class's own docstring. Is there a preferred style for getter property docstrings? (Otherwise I can try to find an example from the codebase).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok I tried something, but let me know if you have any suggestions on it.

Comment thread astroplan/observer.py Outdated
@emirkmo

emirkmo commented Aug 28, 2022

Copy link
Copy Markdown
Contributor Author

Thanks for the review @wtgee. I did not really find any examples of a @property with proper docstrings in the rest of the astroplan codebase, so let me know if you have any input on how to style them. I tried something and implemented the rest of your changes.

Using the online editor so I hope it worked.

@emirkmo

emirkmo commented Sep 8, 2022

Copy link
Copy Markdown
Contributor Author

Hey @bmorris3 , tagging you in case you haven't seen it. I would appreciate you enabling the workflow for this contribution (and let me know if you have any comments)!

@wtgee wtgee requested a review from bmorris3 September 28, 2022 17:18
@bmorris3

Copy link
Copy Markdown
Contributor

Hi @emirkmo! Apologies for taking my time to review this, it looks great. I'll work on getting the test failures to pass today.

@bmorris3 bmorris3 mentioned this pull request Oct 11, 2022

@bmorris3 bmorris3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remaining failures are unrelated. Looks good!

@emirkmo

emirkmo commented Oct 11, 2022

Copy link
Copy Markdown
Contributor Author

Awesome. Glad it worked out. Happy I could contribute. Keep up the great work.

@bmorris3

Copy link
Copy Markdown
Contributor

@bmorris3 bmorris3 merged commit 0d6fbf5 into astropy:main Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

elevation, longitude, latitude parameters missing from Observer class, contrary to docs.

3 participants