def rprof_h5(rproffile, colnames):
if not rproffile.is_file():<EOL><INDENT>return None, None<EOL><DEDENT>isteps = []<EOL>with h5py.File(rproffile) as h5f:<EOL><INDENT>dnames = sorted(dname for dname in h5f.keys()<EOL>if dname.startswith('<STR_LIT>'))<EOL>ncols = h5f['<STR_LIT>'].shape[<NUM_LIT:0>]<EOL>h5names = map(bytes.decode, h5f['<STR_LIT>'][len(colnames):])<EOL>_tidy_names(colnames, ncols, h5names)<EOL>data = np.zeros((<NUM_LIT:0>, ncols))<EOL>for dname in dnames:<EOL><INDENT>dset = h5f[dname]<EOL>data = np.concatenate((data, dset[()]))<EOL>isteps.append((dset.attrs['<STR_LIT>'], dset.attrs['<STR_LIT:time>'],<EOL>dset.shape[<NUM_LIT:0>]))<EOL><DEDENT><DEDENT>id_arr = [[], []]<EOL>for istep, _, n_z in isteps:<EOL><INDENT>id_arr[<NUM_LIT:0>].extend(repeat(istep, n_z))<EOL>id_arr[<NUM_LIT:1>].extend(range(n_z))<EOL><DEDENT>df_data = pd.DataFrame(data, index=id_arr, columns=colnames)<EOL>df_times = pd.DataFrame(list(map(itemgetter(<NUM_LIT:1>), isteps)),<EOL>index=map(itemgetter(<NUM_LIT:0>), isteps))<EOL>return df_data, df_times<EOL>
Extract radial profiles data

    If :data:`colnames` is too long, it will be truncated. If it is too short,
    additional column names will be deduced from the content of the file.

    Args:
        rproffile (:class:`pathlib.Path`): path of the rprof.dat file.
        colnames (list of names): names of the variables expected in
            :data:`rproffile`.

    Returns:
        tuple of :class:`pandas.DataFrame`: (profs, times)
            :data:`profs` are the radial profiles, with the variables in
            columns and rows double-indexed with the time step and the radial
            index of numerical cells.

            :data:`times` is the dimensionless time indexed by time steps.