-
Notifications
You must be signed in to change notification settings - Fork 30
Add lrfp_logical_ flag to wout for Fortran VMEC compatibility (Python-only) #399
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
Conversation
|
to address incompatibilities discussed in PlasmaControl/DESC#2014 |
|
@copilot Don't add it to the C++ source, it should only be handled on the python side and ignored. |
Removed all C++ implementation in commit f82f946. The lrfp flag is now only handled on the Python side in VmecWOut for reading/writing Fortran wout files, with backwards compatibility for old files. Also removed the test as requested. |
|
@copilot fix the ci errors AttributeError: 'vmecpp.cpp._vmecpp.WOutFileContents' object has no attribute 'lrfp' |
Fixed in commit 8548198. Added |
8548198 to
a69fee2
Compare
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
a69fee2 to
12f190e
Compare
|
I regenerated the needed reference wout files to include the flag. |
4f80cf9 to
ea56152
Compare
Merge activity
|
…-only) (#399) ## Summary Fixed CI error `AttributeError: 'vmecpp.cpp._vmecpp.WOutFileContents' object has no attribute 'lrfp'` by properly handling the Python-only `lrfp` field during Python<->C++ conversions. ## Changes Made - [x] **Reverted all C++ changes**: Removed lrfp from VmecINDATA, WOutFileContents, and pybind11 bindings - [x] **Removed lrfp from VmecInput**: No C++ backend to support it as an input parameter - [x] **Kept lrfp in VmecWOut**: Handles reading from and writing to Fortran wout files - [x] **Removed test_lrfp_flag_in_wout()**: Existing tests cover the functionality - [x] **Kept lrfp__logical__ removal from _MISSING_FORTRAN_VARIABLES**: Python side now handles it - [x] **Added lrfp to _CPP_WOUT_SPECIAL_HANDLING**: Skips the field during Python<->C++ conversion - [x] **Set lrfp default in _from_cpp_wout**: Initializes to False when converting from C++ to Python ## What Remains **Python-side only** (`src/vmecpp/__init__.py`): - `VmecWOut.lrfp` field with Pydantic annotations for NetCDF serialization - `VmecWOut.lrfp__logical__()` property for Fortran compatibility - Backwards compatibility: `setdefault("lrfp__logical__", 0)` for old wout files - Removed from `_MISSING_FORTRAN_VARIABLES` list in tests - Added to `_CPP_WOUT_SPECIAL_HANDLING` to skip during Python<->C++ conversions - Default value set to `False` in `_from_cpp_wout()` method This allows loading Fortran VMEC wout files with lrfp flag without requiring special handling, while keeping implementation minimal on Python side only and properly handling C++ interop. <!-- START COPILOT CODING AGENT SUFFIX --> <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > add the lrfp_logical_ with default to false to the wout, to allow them to avoid having to treat VMEC++ files in any special way. Use the same pattern for adding a boolean flag as for the other flags (accessible as lrfp property from python, but written to netcdf with the logical suffix) and make sure wout files WITHOUT the flags, stay backwards compatible. </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.
ea56152 to
d5582f2
Compare

Summary
Fixed CI error
AttributeError: 'vmecpp.cpp._vmecpp.WOutFileContents' object has no attribute 'lrfp'by properly handling the Python-onlylrfpfield during Python<->C++ conversions.Changes Made
What Remains
Python-side only (
src/vmecpp/__init__.py):VmecWOut.lrfpfield with Pydantic annotations for NetCDF serializationVmecWOut.lrfp__logical__()property for Fortran compatibilitysetdefault("lrfp__logical__", 0)for old wout files_MISSING_FORTRAN_VARIABLESlist in tests_CPP_WOUT_SPECIAL_HANDLINGto skip during Python<->C++ conversionsFalsein_from_cpp_wout()methodThis allows loading Fortran VMEC wout files with lrfp flag without requiring special handling, while keeping implementation minimal on Python side only and properly handling C++ interop.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.