Point-file JSON validity, interactive-plot readout fix, and plot-style docs - #159
Merged
Merged
Conversation
…gures The '#' alternate form suppresses trailing-zero removal and keeps the decimal point, so e.g. 732029.47 was written as '732029.' - which json.load rejects. Such values now get one more significant figure (732029.5). Both committed point files were affected; nothing in the repo reads them back, which is why this survived. Known limitation, deliberately unchanged: NaN values are still written as bare NaN tokens, which Python's json accepts but strict parsers do not; allow_nan=False would instead crash writes on real NaN data.
CoordinateFormatter did float(array.sel(...).item()); on a pint-backed array item() returns a Quantity, and float() on one raises DimensionalityError on every mouse move under --show. The shipped example fills with Q (dimensionless), which is why this went unnoticed. The array is now dequantified on construction and the readout shows the units.
Notably: the fill variable's units are appended to cbar_label automatically, so a label already containing units renders them twice, while contour and axis labels are used verbatim.
MishaVeldhoen
force-pushed
the
point_file_and_plotting_tidy_ups
branch
from
September 10, 2026 22:13
4f3619c to
d909bc3
Compare
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.
Three independent fixes off
main, found while verifying a plugin's outputs against the #153 → #155 stack (none is caused by that stack; all are pre-existing).Point files are now valid JSON.
_RoundingFloatformatted floats withf"{x:#.6g}"; the#alternate form suppresses trailing-zero removal, so a float whose integer part uses all six significant figures was written as732029.— rejected byjson.load. Both committed point files were affected; nothing in the repo reads them back, which is why it survived. Such values now get one extra significant figure (732029.5—#.6gends in.exactly when the integer part has six digits, and at#.7gthat case always gains a digit after the point). The regenerated reference files differ by exactly the two broken lines. Known limitation, deliberately unchanged: bareNaNtokens remain (Python'sjsonaccepts them;allow_nan=Falsewould instead crash writes on real NaN data).Interactive popcon plots no longer crash on mouse-over for unitful fill variables.
CoordinateFormattercalledfloat()onarray.sel(...).item(), which is a pintQuantityfor any quantified field — aDimensionalityErroron every mouse move under--show. Invisible until now because both example plot styles fill with dimensionlessQand the only test used an unquantified array. The array is dequantified on construction and the readout now shows the units (z=1.23 [MW]); tested with a quantified array.New docs page
plot_styles.rst, a reference for the plot-style yaml keys — previously undocumented beyond incidental notebook usage. Notably: the fill variable's units are appended tocbar_labelautomatically, so a label which already contains units renders them twice, while contour and axis labels are used verbatim. A pointer comment now sits next tocbar_labelin the example style file.Gates: bare
pytest -q156 passed (includes the doc notebooks);regression_results.pythenpytest tests/test_regression_against_cases.pyclean;ruff check/ruff format --checkclean;mypy cfspopconat the 58-errors-in-5-files baseline;variable_consistency_checker.pyexit 0; docs-n -W, doctest and linkcheck clean.