ENH: Resolve pressure_ISA discretization bounds TODO#1056
Open
Gui-FernandesBR wants to merge 9 commits into
Open
ENH: Resolve pressure_ISA discretization bounds TODO#1056Gui-FernandesBR wants to merge 9 commits into
Gui-FernandesBR wants to merge 9 commits into
Conversation
Gui-FernandesBR
commented
Jul 9, 2026
Resolve conflicts in favor of develop for structure, preserving the pressure_ISA discretization change (#1056): - CHANGELOG.md: move the #1056 entry to the [Unreleased] > Changed section (it is not part of the released v1.13.0). - test_flight.py: adopt develop's npt.assert_allclose(atol, rtol) style; merged freestream values stay within rtol=1e-4. - test_environment.py: keep both the new ISA discretization test and develop's pressure-conversion-factor tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…test Derive the pressure_ISA discretization bounds from the standard-atmosphere layer table (geopotential_height[0]/[-1]) instead of hardcoding -2000/80000, and document why the grid is split around sea level. Strengthen the discretization test with physical-sanity assertions (strictly increasing altitude, strictly decreasing pressure, sea level sampled). No change in numeric output. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…-from-2k # Conflicts: # CHANGELOG.md
The finer spline knots shift density at 1000 m by ~1e-4 (density at sea level is unchanged since 0 m is still sampled exactly). Update the calculate_density_profile doctest expected value accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
stream_velocity_z at apogee is a residual of the apogee-time estimation: it is physically ~0 but swings by ~1e-4 m/s across platforms/NumPy versions and atmosphere discretizations (e.g. -8.9e-8 on py3.10 with the new ISA grid, -2.0e-4 with the old grid, +2.6e-4 on py3.14). The previous atol=1e-5 was tighter than this numerical noise, making the assertion flaky. Use atol=1e-3, which is physically negligible (vertical speed peaks above 200 m/s) while still catching real regressions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CI installs ruff unpinned; ruff 0.16 formats fenced Python blocks in Markdown by default, so `ruff format --check .` now flags README.md on every PR. Reformat the affected snippets (indentation, quotes, call wrapping) to unblock the lint check. No semantic changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CI runs pylint unpinned; three messages were attributable to this PR: - C0415 import-outside-toplevel: move the tools import to the test module top level. - R0915 too-many-statements: keep the discretization block compact so pressure_ISA stays within the 25-statement limit. - C0302 too-many-lines: the terser block keeps environment.py under the 3050-line module limit. np.append over two linspaces yields the same grid as the previous np.concatenate, so all numeric results are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1056 +/- ##
===========================================
+ Coverage 82.18% 82.36% +0.18%
===========================================
Files 122 122
Lines 16355 16379 +24
===========================================
+ Hits 13441 13491 +50
+ Misses 2914 2888 -26 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
This PR resolves a long-standing
TODOinrocketpy/environment/environment.py. Thepressure_ISAmodel was discretized starting at0 m, but the International Standard Atmosphere (ISO 2533) is defined all the way down to-2000 mgeopotential. Sampling from0 mmeant sub-sea-level pressures were spline-extrapolated rather than computed from the model.What changed
pressure_ISAis now discretized across the full valid ISA range — from the lowest to the highest geopotential layer (-2000 m→80000 mgeopotential), converted to geometric height viageopotential_height_to_geometric_height.~-1999 mup to0 m) and the wider region above it (90 points from0 mto~81016 m).geopotential_height[0]/[-1]), so there are no hardcoded magic numbers, and the intent is documented in comments.Impact
pressure_ISAnow follows the ISA model instead of extrapolating. Example:pressure_ISA(-1500 m)goes from~117966 Pa(old, extrapolated) to~120696 Pa(new, correct) — a ~2.3% correction.~1e-4relative, which moves trajectory quantities by~1e-5relative (e.g. calisto apogee free-stream speed0.464151 → 0.464162, density at 1000 m1.11151 → 1.11162).calculate_density_profiledoctest expected value was updated for the new density at 1000 m (sea-level density is unchanged, since0 mis still sampled exactly).Tests
test_pressure_isa_discretization_boundsverifies the discretization bounds, point count, sea-level sampling, and physical monotonicity (altitude increasing, pressure decreasing).test_freestream_speed_at_apogee: relaxed thestream_velocity_z-at-apogee tolerance from1e-5to1e-3. That quantity is a numerically noisy~0residual of apogee-time estimation (it swings by~1e-4across platforms/NumPy versions and discretizations, and was already close to flaky).1e-3 m/sis physically negligible (vertical speed peaks above200 m/s) while still catching real regressions.Note: unrelated lint fix (README)
CI installs
ruffunpinned, andruff 0.16now formats fenced Python blocks inside Markdown by default, soruff format --check .started flaggingREADME.mdon every open PR (since ~2026-07-22), unrelated to this change. To keep this PR's lint check green, the affected README snippets were reformatted (indentation/quotes/call-wrapping, no semantic change). A more durable fix would be to pinruffinlinters.ymlin a separate PR.Checklist
pressure_ISAdiscretization bounds inrocketpy/environment/environment.pycalculate_density_profiledoctest for the new densitystream_velocity_zapogee assertion robust (py3.14)CHANGELOG.mdCloses the
pressure_ISAdiscretizationTODO.