rsfbpic/rsdata/read_field_hdf.py
def read_dr_dz(path_to_file, field_name, n_dump_str):
    """
    Read grid sizes from an HDF5 file.

    Assume openPMD conventions
    Assume 2D mesh of values (ie quasi-3D rz)
    Args:
        path_to_file: location of a specific HDF5 file
        field_name:   name of field associated with grid spacing
        n_dump_str:   dump number (as a string)
    Returns:
        dr:   radial grid spacing dr [m]
        dz:   axial  grid spacing dz [m]
   """
    file = h5py.File(path_to_file,'r')
    data = file.get('data/')
    step = data.get(n_dump_str)
    all_fields = step.get('fields')
    field_h5 = all_fields.get(field_name)

    grid_size = field_h5.attrs["gridSpacing"] * field_h5.attrs["gridUnitSI"]
    dr = grid_size[0]
    dz = grid_size[1]

    return dr, dz

    Read grid sizes from an HDF5 file.

    Assume openPMD conventions
    Assume 2D mesh of values (ie quasi-3D rz)
    Args:
        path_to_file: location of a specific HDF5 file
        field_name:   name of field associated with grid spacing
        n_dump_str:   dump number (as a string)
    Returns:
        dr:   radial grid spacing dr [m]
        dz:   axial  grid spacing dz [m]
   
Read grid sizes from an HDF5 file.
Assume openPMD conventions
Assume 2D mesh of values
Read grid sizes from an HDF5 file . Assume openPMD conventions Assume 2D mesh of values
def read_dr_dz(path_to_file, field_name, n_dump_str):
    file = h5py.File(path_to_file,'r')
    data = file.get('data/')
    step = data.get(n_dump_str)
    all_fields = step.get('fields')
    field_h5 = all_fields.get(field_name)
    grid_size = field_h5.attrs["gridSpacing"] * field_h5.attrs["gridUnitSI"]
    dr = grid_size[0]
    dz = grid_size[1]
    return dr, dz
def read_dr_dz ( path_to_file , field_name , n_dump_str ) : file = h5py . File ( path_to_file , 'r' ) data = file . get ( 'data/' ) step = data . get ( n_dump_str ) all_fields = step . get ( 'fields' ) field_h5 = all_fields . get ( field_name ) grid_size = field_h5 . attrs [ "gridSpacing" ] * field_h5 . attrs [ "gridUnitSI" ] dr = grid_size [ 0 ] dz = grid_size [ 1 ] return dr , dz
Read grid sizes from an HDF5 file.
Read grid sizes from an HDF5 file .
"""
    Read grid sizes from an HDF5 file.

    Assume openPMD conventions
    Assume 2D mesh of values (ie quasi-3D rz)
    Args:
        path_to_file: location of a specific HDF5 file
        field_name:   name of field associated with grid spacing
        n_dump_str:   dump number (as a string)
    Returns:
        dr:   radial grid spacing dr [m]
        dz:   axial  grid spacing dz [m]
   """
radial grid spacing dr [m]
dz:   axial  grid spacing dz [m]
radial grid spacing dr [ m ] dz : axial grid spacing dz [ m ]
dr
path_to_file
location of a specific HDF5 file
location of a specific HDF5 file
field_name
name of field associated with grid spacing
name of field associated with grid spacing
n_dump_str
dump number (as a string)
dump number ( as a string )