Exporting#
Use the unified export command:
nf2-export model.nf2 --format vtk --out model.vtk --metrics j alpha
nf2-export "series/*.nf2" --format hdf5 --out-dir exports --overwrite
nf2-export multi_height.nf2 --format height --out height_surfaces.npz
Supported formats:
vtkfor Cartesian and spherical checkpointsnpzfor Cartesian checkpointshdf5for Cartesian checkpointsfitsfor Cartesian checkpointsheightfor learned multi-height surface mappings
For single files, use --out. For multiple inputs or glob patterns, use --out-dir.
Every export includes the magnetic field evaluated from the NF2 checkpoint. The --metrics option adds derived quantities to the output. Metric names, default metrics, and scalar/vector array keys are shared between Cartesian and spherical exports. Use only the quantities needed for the next analysis step because derivative-heavy or field-line quantities can increase runtime and memory use.
Export A Cartesian Result#
nf2-export "./runs/sharp_cea_377/extrapolation_result.nf2" \
--format vtk \
--out "./runs/sharp_cea_377/exports/field.vtk" \
--Mm_per_pixel 0.72 \
--height_range 0 80 \
--metrics j alpha free_energy_fft
Use --format npz for Python analysis or --format hdf5 for a portable scientific data file. VTK output is useful for ParaView.
Export A Spherical Result#
nf2-export "./runs/spherical_hmi/extrapolation_result.nf2" \
--format vtk \
--out "./runs/spherical_hmi/exports/field.vtk" \
--metrics j alpha energy spherical_energy_gradient
Spherical checkpoints currently export through VTK only. Spherical VTK files include the magnetic field, spherical coordinate scalars, and any requested scalar or vector export quantities that match the sampled spherical grid.
Export A Series#
nf2-export "./runs/multi_height_series/*.nf2" \
--format hdf5 \
--out-dir "./runs/multi_height_series/exports" \
--Mm_per_pixel 0.72 \
--height_range 0 100 \
--metrics j alpha free_energy_fft \
--overwrite
Cartesian exports accept --Mm_per_pixel, --height_range, --x_range, and --y_range. Spherical VTK export detects spherical checkpoints automatically and accepts --radius_range, --latitude_range, --longitude_range, and --pixels_per_solRad.
Height-surface exports use --Mm_per_pixel and require a checkpoint with a height transform and height_mapping entries.
Export Quantities#
Pass one or more names after --metrics:
nf2-export "./runs/case/extrapolation_result.nf2" \
--format npz \
--out "./runs/case/field.npz" \
--Mm_per_pixel 0.72 \
--height_range 0 80 \
--metrics j alpha energy free_energy_fft
Available derived quantities are:
|
Exported array key |
Notes |
|---|---|---|
|
|
Current-density magnitude ` |
|
|
Current-density vector. |
|
|
Force-free alpha, computed as `(J . B) / |
|
|
Vertical magnetic tension-related derivative. |
|
|
Magnetic energy density in |
|
|
Cartesian vertical magnetic-energy gradient. |
|
|
Spherical radial magnetic-energy gradient. |
|
|
Cartesian free magnetic energy density using the default potential-field method. |
|
|
Free magnetic energy density using the Cartesian FFT potential field. |
|
|
Free magnetic energy density using the direct potential-field method. |
|
|
Magnetic helicity diagnostic; requires vector-potential output from compatible checkpoints. |
|
|
LOS field, transverse-field magnitude, and azimuth components. |
|
|
Squashing factor and twist diagnostics; requires optional GPU/CuPy/FastQSL dependencies. |
Exported array keys now match the requested metric name wherever a metric produces one quantity. squashing_factor also writes twist because the field-line calculation naturally produces both diagnostics.
Use --metrics j j_vec ... when you want both the current-density magnitude and the full current-density vector in the exported file.
Available export quantities and quality metrics are also listed in the generated export and metrics reference.