Repository navigation
ENH: warn when a drag CSV does not form a regular grid - #1239
MateusStano merged 5 commits into
Conversation
Fall back from regular-grid interpolation still loads the table, but now emits a UserWarning so a missing combination, duplicate row, or split float does not silently change drag between tabulated points. Co-authored-by: Charles <CharlesXmf@users.noreply.github.com>
Gui-FernandesBR
left a comment
There was a problem hiding this comment.
please wait @MateusStano 's review as well
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1239 +/- ##
========================================
Coverage 87.04% 87.04%
========================================
Files 130 130
Lines 18130 18130
========================================
+ Hits 15781 15782 +1
+ Misses 2349 2348 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
MateusStano
left a comment
There was a problem hiding this comment.
Thanks! Checked on the PR head: it warns only for tables that are not a full grid (not for a full 2-D grid, a mach,cd table or a headerless file).
One thing before merge: #1232 is merged, so docs/user/rocket/rocket_usage.rst (line 168 on develop) now says "the file still loads and no warning is given". Please update that sentence here, for example "RocketPy warns and interpolates between scattered points instead of along the grid".
Two optional points: the warning points at rocket.py instead of the user's Rocket(...) call (stacklevel=2 stops inside RocketPy), and naming the file in the message would help when a rocket has two drag tables.
PR RocketPy-Team#1232 landed on develop with the drag CSV docs note that this branch needs to update. Co-authored-by: Charles <CharlesXmf@users.noreply.github.com>
PR RocketPy-Team#1232 documented that a non-grid table still loads and no warning is given. This branch now warns, so the note matches that behavior. Co-authored-by: Charles <CharlesXmf@users.noreply.github.com>
Raise stacklevel from 2 to 4 so the warning names the caller's Rocket(...) line, and include the drag file path in the message. Co-authored-by: Charles <CharlesXmf@users.noreply.github.com>
Rocket warns with file_path!r, so backslashes differ from str(Path) on Windows. Check filename plus native or repr path in the warning message. Unblocks PR 1239. Co-authored-by: Charles <CharlesXmf@users.noreply.github.com>
* DOC: backfill the v1.14.0 changelog The changelog automation has not run since #1112, so the PRs merged into develop after it were missing from [Unreleased]. Add them, add the entries for #1225, #1226 and #1227, update the tip-off, tube-fins and parachute-seed entries to what the release ships, and drop the raw commit link, the back-merge entry and the duplicate StochasticFreeFormFins entry. Related to #1209 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDW575d9C9zpS7Z1v2KXVq * DOC: add a Breaking changes section to the v1.14.0 changelog List what changes for a v1.13.0 user: Monte Carlo seeding and numbering, the deprecated static_margin assignment, the parachute trigger ValueError on the rail, the shifted flight results, and the sensor default temperature. Related to #1209 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDW575d9C9zpS7Z1v2KXVq * DOC: bring the v1.14.0 changelog up to date with develop Describe the forecast reuse and the opt-in disk cache that replaced the first cache (#1219), and add the PRs merged after the backfill: #1221, #1222, #1223, #1224, #1231, #1232, #1234, #1239 and #1242. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: MateusStano <mateusstano@usp.br>
Fixes #1238
When a multi-variable drag CSV given to
Rocket(power_off_drag/power_on_drag) is not an exact grid,Rocket.__load_rocket_drag_csvfalls back to scattered interpolation. That still happens, but the fallback now emits aUserWarningso a missing combination, a repeated row, or the same value written two ways (e.g.0.3and0.30000000000000004) is not silent. The warning names the drag file and is issued withstacklevel=4so it points at the caller'sRocket(...)line. The drag coefficient can still change both between and outside the tabulated points; the warning is there so that change is visible.docs/user/rocket/rocket_usage.rstis updated now that #1232 has merged: the previous "no warning is given" sentence now says RocketPy warns and interpolates between scattered points instead of along the grid.CHANGELOG.mdis not updated in this PR. #1228 is collecting v1.14 entries, and the changelog workflow also runs on merge todevelop.How it was verified
Rocket, asserts aUserWarningmatching the new message (including the file path), checks that the warning originates at the test'sRocket(...)line, and checks that the table still loads with non-regular_gridinterpolation and evaluates the remaining points.python3 -m pytest tests/unit/rocket/test_rocket.py -q— 72 passed