pencil.io.fort2h5

Contains the functions to read old Fortran binary simulation data and write snapshots in hdf5 (data/allprocs/VAR*.h5 files), video slices to data/slices/uu1_xy.h5, etc. and averages to data/averages/xy.h5, etc

Functions

var2h5(newdir, olddir, allfile_names, todatadir, ...)

Copy a simulation snapshot set written in Fortran binary to hdf5.

slices2h5(newdir, olddir, grid[, todatadir, ...])

Copy a simulation set of video slices written in Fortran binary to hdf5.

aver2h5(newdir, olddir[, todatadir, fromdatadir, l2D, ...])

Copy a simulation set of video slices written in Fortran binary to hdf5.

sim2h5([newdir, olddir, varfile_names, todatadir, ...])

Copy a simulation object written in Fortran binary to hdf5.

Module Contents

pencil.io.fort2h5.var2h5(newdir, olddir, allfile_names, todatadir, fromdatadir, snap_by_proc, precision, lpersist, quiet, nghost, settings, param, grid, x, y, z, lshear, lremove_old_snapshots, indx, trimall=False, l_mpi=False, driver=None, comm=None, rank=0, size=1)

Copy a simulation snapshot set written in Fortran binary to hdf5.

call signature:

var2h5(newdir, olddir, allfile_names, todatadir, fromdatadir, snap_by_proc,

precision, lpersist, quiet, nghost, settings, param, grid, x, y, z, lshear, lremove_old_snapshots, indx, trimall=False, l_mpi=False, driver=None, comm=None, rank=0, size=1

)

Keyword arguments:

newdir:

String path to simulation destination directory.

olddir:

String path to simulation destination directory.

allfile_names:

A list of names of the snapshot files to be written, e.g. VAR0.

todatadir:

Directory to which the data is stored.

fromdatadir:

Directory from which the data is collected.

snap_by_proc:

Read and write snapshots by procdir of the fortran binary tree

precision:

Single ‘f’ or double ‘d’ precision for new data.

lpersist:

option to include persistent variables from snapshots.

quiet

Option not to print output.

nghost:

Number of ghost zones.

settings

simulation properties.

param

simulation Param object.

grid

simulation Grid object.

xyz:

xyz arrays of the domain with ghost zones.

lshear:

Flag for the shear.

lremove_old_snapshots:

If True the old snapshots will be deleted once the new snapshot has been saved.

indx:

List of variable indices in the f-array.

trimall:

Strip ghost zones from snapshots

l_mpi:

Applying MPI parallel process

driver:

HDF5 file io driver either None or mpio

comm:

MPI library calls

rank:

Integer ID of processor

size:

Number of MPI processes

pencil.io.fort2h5.slices2h5(newdir, olddir, grid, todatadir='data/slices', fromdatadir='data', precision='d', quiet=True, lremove_old_slices=False, lsplit_slices=False, l_mpi=False, driver=None, comm=None, rank=0, size=1, vlarge=1000000000)

Copy a simulation set of video slices written in Fortran binary to hdf5.

call signature:

slices2h5(newdir, olddir, grid,

todatadir=’data/slices’, fromdatadir=’data’, precision=’d’, quiet=True, lremove_old_slices=False, lsplit_slices=False, l_mpi=False, driver=None, comm=None, rank=0, size=1, vlarge=1000000000):

Keyword arguments:

newdir:

String path to simulation destination directory.

olddir:

String path to simulation destination directory.

grid

simulation Grid object.

todatadir:

Directory to which the data is stored.

fromdatadir:

Directory from which the data is collected.

precision:

Single ‘f’ or double ‘d’ precision for new data.

quiet:

Option not to print output.

lremove_old_slices:

If True the old video slices will be deleted once the new slices have been saved.

lsplit_slices:

Read the video slices in iterative chunks for large memory

l_mpi:

Applying MPI parallel process

driver:

HDF5 file io driver either None or mpio

comm:

MPI library calls

rank:

Integer ID of processor

size:

Number of MPI processes

vlarge:

Limit size of file without chunking

pencil.io.fort2h5.aver2h5(newdir, olddir, todatadir='data/averages', fromdatadir='data', l2D=True, precision='d', quiet=True, lremove_old_averages=False, aver_by_proc=False, laver2D=False, l_mpi=False, driver=None, comm=None, rank=0, size=1)

Copy a simulation set of video slices written in Fortran binary to hdf5.

call signature:

aver2h5(newdir, olddir,

todatadir=’data/averages’, fromdatadir=’data’, l2D=True, precision=’d’, quiet=True, lremove_old_averages=False, aver_by_proc=False, laver2D=False, l_mpi=False, driver=None, comm=None, rank=0, size=1):

Keyword arguments:

newdir:

String path to simulation destination directory.

olddir:

String path to simulation destination directory.

todatadir:

Directory to which the data is stored.

fromdatadir:

Directory from which the data is collected.

l2D

Option to include 2D averages if the file sizes are not too large

precision:

Single ‘f’ or double ‘d’ precision for new data.

quiet

Option not to print output.

lremove_old_averages:

If True the old averages data will be deleted once the new h5 data has been saved.

aver_by_proc

Option to read old binary files by processor and write in parallel

laver2D

If True apply to each plane_list ‘y’, ‘z’ and load each variable sequentially

l_mpi:

Applying MPI parallel process

driver:

HDF5 file io driver either None or mpio

comm:

MPI library calls

rank:

Integer ID of processor

size:

Number of MPI processes

pencil.io.fort2h5.sim2h5(newdir='.', olddir='.', varfile_names=None, todatadir='data/allprocs', fromdatadir='data', precision='d', nghost=3, lpersist=True, x=None, y=None, z=None, lshear=False, snap_by_proc=False, aver_by_proc=False, lremove_old_snapshots=False, lremove_old_slices=False, lread_all_videoslices=False, vlarge=100000000, lremove_old_averages=False, execute=False, quiet=True, l2D=True, lvars=True, lvids=True, laver=True, laver2D=False, lremove_deprecated_vids=False, lsplit_slices=False)

Copy a simulation object written in Fortran binary to hdf5. The default is to copy all snapshots from/to the current simulation directory. Optionally the old files can be removed to

call signature:

sim2h5(newdir=’.’, olddir=’.’, varfile_names=None,

todatadir=’data/allprocs’, fromdatadir=’data’, precision=’d’, nghost=3, lpersist=False, x=None, y=None, z=None, lshear=False, snap_by_proc=False, aver_by_proc=False, lremove_old_snapshots=False, lremove_old_slices=False, lread_all_videoslices=True, lremove_old_averages=False, execute=False, quiet=True, l2D=True, lvars=True, lvids=True, laver=True)

Keyword arguments:

olddir:

String path to simulation source directory. Path may be relative or absolute.

newdir:

String path to simulation destination directory. Path may be relative or absolute.

varfile_names:

A list of names of the snapshot files to be written, e.g. VAR0 If None all varfiles in olddir+’/data/proc0/’ will be converted

todatadir:

Directory to which the data is stored.

fromdatadir:

Directory from which the data is collected.

precision:

Single ‘f’ or double ‘d’ precision for new data.

nghost:

Number of ghost zones. TODO: handle switching size of ghost zones.

lpersist:

option to include persistent variables from snapshots.

xyz:

xyz arrays of the domain with ghost zones. This will normally be obtained from Grid object, but facility to redefine an alternative grid value.

lshear:

Flag for the shear.

execute:

optional confirmation required if lremove_old.

lremove_old_snapshots:

If True the old snapshot data will be deleted once the new h5 data has been saved.

lremove_old_slices:

If True the old video slice data will be deleted once the new h5 data has been saved.

lremove_old_averages:

If True the old averages data will be deleted once the new h5 data has been saved.

aver_by_proc

Option to read old binary files by processor and write in parallel

laver2D

If True apply to each plane_list ‘y’, ‘z’ and load each variable sequentially

l_mpi:

Applying MPI parallel process

driver:

HDF5 file io driver either None or mpio

comm:

MPI library calls

rank:

Integer ID of processor

size:

Number of MPI processes