Repository navigation
Convert to psc output format v1 - #43
Merged
Merged
Conversation
v1/ is written by psc with psc_output_version 1.0.0; legacy/ is the same run written by the pre-1.0.0 writer. The runs are deterministic, so the legacy files convert to exactly the v1 files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
psc now writes each component as its own (z, y, x) variable with cell-centered x/y/z coords and a time variable, so decode_psc() only needs to check the version and squeeze a single time step. Legacy files are rejected with a pointer to pscpy.convert. The species_names, length and corner args are gone since the file now carries everything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Converts legacy psc .bp output (all components in one 4-d variable) to psc_output_version 1.0.0, matching what the new psc writer produces: per-component (z, y, x) variables, cell-centered x/y/z coords, and time as a variable. Run as python -m pscpy.convert. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
psc computes corner + (i + .5) * dx, which the compiler contracts into a fused multiply-add, so doing it with two roundings in python can be off by one ulp (e.g. y with corner -0.4, length 0.8, 16 cells). math.fma needs Python 3.13, so emulate it with exact Fraction arithmetic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With nargs="+", --species e i followed by the input files swallowed the files as species names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each future format update gets its own converter module next to it (e.g. convert/v1_to_v2), run as python -m pscpy.convert.<from>_to_<to>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It used psc.PSC_OUTPUT_VERSION, which would start stamping legacy->v1 output as v2 once that constant is bumped for the next format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unused now that each converter owns the version it writes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both are now written by psc's dedicated pscpy_sample script (the legacy/ run with the pre-1.0.0 writer), on a smaller 1x8x4 domain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ounding The new sample's cell widths are exactly representable, so naive and fma-rounded centers agree; keep the values psc wrote for the old sample. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Step 1 of legacy and v1 gauss (dive, rho) and continuity (d_rho, dt_divj) output from the same pscpy_sample runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bitwise-matching psc's fma-contracted coordinates isn't something to rely on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Compute cell centers with plain numpy arithmetic instead of emulating psc's fma rounding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The new samples are BP5, so request that engine instead of BP4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…samples The old samples' quirks (float32 data, time/step as 1-element arrays, unprefixed ib/im) are now written directly with _write_legacy; the rest of what the old-sample tests checked is covered by test_matches_psc_v1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Old legacy output that no test uses any more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
numpy 2.5 requires Python >=3.12 and its stubs use PEP 695 type statements, which mypy rejects with python_version = 3.10. CI's fresh hook env picked up numpy 2.5.3 and failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
Collaborator
Author
|
The codecov failure seems innocuous to me, all the flagged lines are just trivial error cases. @germasch do you want them to be covered? |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use typing_extensions.deprecated since warnings.deprecated needs Python 3.13. Tests that still exercise decode_psc ignore its DeprecationWarning, which pytest otherwise turns into an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
In psc-code/psc#407, the output format of field bp data changed significantly. This PR:
decode_pscto support only the new output version (v1), and deprecates itpython3 -m pscpy.convert.legacy_to_v1 -hto see options)psc_pscpy_samplecase psc#411It is also a breaking change for downstream users, because thetdimension is nowtime.This PR was largely done by Claude, but does not yet add a
CLAUDE.mdfile.