Skip to content

DOC: Add a doctest to calculate density profile #591

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

Merged
merged 4 commits into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions rocketpy/environment/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3077,6 +3077,24 @@ def calculate_density_profile(self):
Returns
-------
None

Examples
--------
Creating an Environment object and calculating the density
at Sea Level:

>>> env = Environment()
>>> env.calculate_density_profile()
>>> env.density(0)
1.225000018124288

Creating an Environment object and calculating the density
at 1000m above Sea Level:

>>> env = Environment()
>>> env.calculate_density_profile()
>>> env.density(1000)
1.1116193933422585
"""
# Retrieve pressure P, gas constant R and temperature T
P = self.pressure
Expand Down