Skip to content

ENH: Environment object from EnvironmentAnalysis #813

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ArthurJWH
Copy link
Contributor

This method allows the user to create a Environment object from the EnvironmentAnalysis object

Pull request type

  • Code changes (bugfix, features)

Checklist

  • Tests for the changes have been added (if needed)
  • Docs have been reviewed and added / updated
  • Lint (black rocketpy/ tests/) has passed locally
  • All tests (pytest tests -m slow --runslow) have passed locally
  • CHANGELOG.md has been updated (if relevant)

Current behavior

Issue #657

New behavior

The env method have been added, which creates a Environment object from the data retrieved from the EnvironmentAnalysis class

Breaking change

  • Yes
  • No

This method allows the user to create a ```Environment``` object from the ```EnvironmentAnalysis``` object
@ArthurJWH ArthurJWH self-assigned this May 5, 2025
@ArthurJWH ArthurJWH requested a review from a team as a code owner May 5, 2025 20:42
@ArthurJWH ArthurJWH linked an issue May 5, 2025 that may be closed by this pull request
Copy link

codecov bot commented May 5, 2025

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 79.82%. Comparing base (4df0b38) to head (56dadb4).
Report is 19 commits behind head on develop.

Files with missing lines Patch % Lines
rocketpy/environment/environment_analysis.py 25.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #813      +/-   ##
===========================================
+ Coverage    79.11%   79.82%   +0.70%     
===========================================
  Files           96       98       +2     
  Lines        11575    11962     +387     
===========================================
+ Hits          9158     9549     +391     
+ Misses        2417     2413       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +2889 to +2891
def env(
self, gravity=None, date=None, datum="SIRGAS2000", max_expected_height=80000.0
):
Copy link
Member

Choose a reason for hiding this comment

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

Two points:

  1. The method would benefit a lot from a docstring!
  2. The name could be a lot more clearer. A few options should be: to_rocketpy_environment, to_environment_object, get_environment_object, instantiate_environment_object. I'm giving some very different options because I'd like you to propose what you think would be clearer to the final user. Anything apart from "env" should already be fine.

Copy link
Member

Choose a reason for hiding this comment

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

Please mention [in docs] you're using the average profiles.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I'm just waiting for a response on how to deal with the inversion function before proceeding, because currently there is a problem with the pressure profile. But after the code works, I'll be making the code cleaner (tests, documentation, the name...)

Copy link
Member

Choose a reason for hiding this comment

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

is there anything you need from me?

Copy link
Member

@Gui-FernandesBR Gui-FernandesBR left a comment

Choose a reason for hiding this comment

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

This is really nice. So simple and effective.
Great work @ArthurJWH ! I think you're getting the hang of it...

Some extra points I'd like to add before :

  • could you please update the CHANGELOG?
  • How familiar are you with unit tests?
  • There's an open issue in this repo that may be connected with your PR. Could you please link the PR using the "development" section on the "conversation" section here on GitHub?

@ArthurJWH
Copy link
Contributor Author

This is really nice. So simple and effective. Great work @ArthurJWH ! I think you're getting the hang of it...

Some extra points I'd like to add before :

  • could you please update the CHANGELOG?
  • How familiar are you with unit tests?
  • There's an open issue in this repo that may be connected with your PR. Could you please link the PR using the "development" section on the "conversation" section here on GitHub?

I will update the CHANGELOG soon.
For tests, I just had one test asserting that the method would return an Environment object. But there is this one problem with the pressure profile that, if it is not "bijective", then the invert function would just give an error.
The issue #657 should be already linked, if there is other related issue, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

ENH: Use EnvironmentAnalysis to initialize the Flight class
2 participants