Skip to main content

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.11 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.0-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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eqdsk_from_cdf-0.1.0.tar.gz (198.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eqdsk_from_cdf-0.1.0-py3-none-any.whl (145.1 kB view details)

Uploaded Python 3

File details

Details for the file eqdsk_from_cdf-0.1.0.tar.gz.

File metadata

  • Download URL: eqdsk_from_cdf-0.1.0.tar.gz
  • Upload date:
  • Size: 198.9 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

Hashes for eqdsk_from_cdf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a0b1d2ad38c3933b6f4aa712aee14cdc08ce8e497b7acb64359b36ff1360b85c
MD5 f05f1ca634c1f8295c5c40045f3e9aac
BLAKE2b-256 81f48cf0d3798001188aeb92fc57a6339f34e2738d38ada3f31c00ae3a306a10

See more details on using hashes here.

File details

Details for the file eqdsk_from_cdf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: eqdsk_from_cdf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 145.1 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

Hashes for eqdsk_from_cdf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c12c62a36903a8e97dccf26bc149c5a3a984485be6fed2c5a3e8dbf94a6e2d0
MD5 d26feaf574f40919eb4487a497389302
BLAKE2b-256 67e96d325c2c7bb398ca77037360ceb0a310c89d44561558430e8654c2e92cd3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page