Write G-EQDSK files directly from a single TRANSP CDF file.
Project description
eqdsk-from-cdf
Convert a single TRANSP CDF equilibrium slice into a G-EQDSK file from the command line.
The package is intended for quick local conversion workflows: install the command, point it at a TRANSP CDF file, choose the target time and sign convention explicitly, and write a GEQDSK file that can be checked with the bundled validation sample.
Install
Install from PyPI:
python -m pip install eqdsk-from-cdf
For command-line-only use, pipx is also a good option because it keeps the application and its dependencies isolated:
pipx install eqdsk-from-cdf
If eqdsk-from-cdf is not found after install, make sure ~/.local/bin is on your PATH.
The package requires Python 3.9 or newer.
Quick Start
Convert one TRANSP CDF time slice:
eqdsk-from-cdf run.CDF --time 17.5 --bt-sign 1 --ip-sign 1 --out out.geq
If --out is omitted, the output is written next to the input with a .geq suffix:
eqdsk-from-cdf run.CDF --time 17.5 --bt-sign 1 --ip-sign 1
Check the install with the public bundled sample:
eqdsk-from-cdf validate
validate regenerates a GEQDSK from the bundled sample CDF and compares it against the bundled sample GEQ reference. It does not depend on private reference files.
Main Options
CDF_PATH is the input TRANSP CDF file.
--time SECONDS selects the requested TRANSP time slice in seconds.
--bt-sign {-1,1} sets the toroidal magnetic field sign.
--ip-sign {-1,1} sets the plasma current sign.
--out PATH sets the output GEQDSK path. Without it, run.CDF becomes run.geq.
--nr N and --nz N set the output GEQDSK R and Z grid sizes. The defaults are 129 and 129. Larger grids preserve more spatial detail but produce larger files and take longer to generate. Common choices are 129x129, 257x257, or rectangular grids such as 128x192.
--plot PATH saves a conversion diagnostic plot.
--show displays the diagnostic plot interactively.
Run the built-in help for the full command reference:
eqdsk-from-cdf --help
Sign Convention
Viewed from above the machine, looking along +Z, +1 means counter-clockwise and -1 means clockwise.
Both --bt-sign and --ip-sign are required. This is intentional: the converter does not guess sign conventions silently.
Resolution Examples
Default grid:
eqdsk-from-cdf run.CDF --time 17.5 --bt-sign 1 --ip-sign 1 --out out.geq
Higher resolution square grid:
eqdsk-from-cdf run.CDF --time 17.5 --bt-sign 1 --ip-sign 1 --nr 257 --nz 257 --out out_257.geq
Rectangular grid:
eqdsk-from-cdf run.CDF --time 17.5 --bt-sign 1 --ip-sign 1 --nr 128 --nz 192 --out out_128x192.geq
Diagnostic Plots
Save a plot while converting:
eqdsk-from-cdf run.CDF --time 17.5 --bt-sign 1 --ip-sign 1 --out out.geq --plot conversion.png
Show the same plot interactively:
eqdsk-from-cdf run.CDF --time 17.5 --bt-sign 1 --ip-sign 1 --show
The plot overlays reconstructed moment surfaces, generated Psi(R,Z) contours, boundary, limiter, magnetic axis, and profile curves.
Bundled Sample
Print the installed sample CDF path:
eqdsk-from-cdf sample-path --kind cdf
Print the installed sample GEQ reference path:
eqdsk-from-cdf sample-path --kind geq
Convert the bundled public sample manually:
sample="$(eqdsk-from-cdf sample-path --kind cdf)"
eqdsk-from-cdf "$sample" --time 17.50435 --bt-sign 1 --ip-sign 1 --out sample.geq
Compare GEQDSK Files
Print scalar/profile differences and save a visual comparison:
reference="$(eqdsk-from-cdf sample-path --kind geq)"
eqdsk-from-cdf compare sample.geq "$reference" --output compare.png
If --output is omitted, the comparison plot is shown interactively.
Contour Extraction
Computational contour extraction uses contourpy directly. Matplotlib contour calls are used only for diagnostic plotting.
Development
Install from a local checkout:
./install.sh
Validate an existing command on PATH from a checkout:
./install.sh --check
Run checks before committing:
uv run --extra dev ruff check .
uv run pytest -q
uv build
Test the built wheel like a fresh user before publishing:
uv run --isolated --with dist/eqdsk_from_cdf-0.1.1-py3-none-any.whl eqdsk-from-cdf validate
Release Notes For Maintainers
Work from pypi-main; it is the clean public-history branch. Use feature branches from pypi-main for larger changes.
Before releasing, bump version in pyproject.toml, run the checks above, commit, tag, push, and publish:
git switch pypi-main
uv run --extra dev ruff check .
uv run pytest -q
uv build
git add -A
git commit -m "Release 0.1.1"
git tag v0.1.1
git push
git push origin v0.1.1
uv publish
uv publish needs PyPI credentials. One option is to export a PyPI API token as UV_PUBLISH_TOKEN before publishing:
export UV_PUBLISH_TOKEN="pypi-..."
uv publish
For interactive use, avoid leaving the token in shell history:
read -s UV_PUBLISH_TOKEN
export UV_PUBLISH_TOKEN
uv publish
For long-term use, store the token in a password manager or another secure secret store. If a token is exposed accidentally, revoke it on PyPI and create a new one.
Each PyPI release should have an immutable Git tag, for example v0.1.0, v0.1.1, or v0.2.0.
The public package carries only the bundled sample CDF and bundled sample GEQ used by eqdsk-from-cdf validate. Private reference checks, portability scripts, and scratch generated files should stay local or ignored.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file eqdsk_from_cdf-0.1.1.tar.gz.
File metadata
- Download URL: eqdsk_from_cdf-0.1.1.tar.gz
- Upload date:
- Size: 267.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09de0663af15bace33e5be4e17d5a59ec7bf979f447e33cb3e41b7b7e70e6148
|
|
| MD5 |
dee428ed268b845010a0ac590a9a14a5
|
|
| BLAKE2b-256 |
68c86baffc5abf026f63dd03c8b9f8f01d315af501dbdc104b3f3d37c1838600
|
File details
Details for the file eqdsk_from_cdf-0.1.1-py3-none-any.whl.
File metadata
- Download URL: eqdsk_from_cdf-0.1.1-py3-none-any.whl
- Upload date:
- Size: 145.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3080fc8316b37f6f810a63102c95eacb376adc162b0e5b0b4860c7524fcc912
|
|
| MD5 |
13d0f1f98009a4fef01c30cdf9dd5260
|
|
| BLAKE2b-256 |
323fc4ed892b9e2b1b7b660b6ed238f58f94a90b182538fec5108e2ec8623e72
|