Python function cis.read_data() equivalent in Julia

raman_kumar
Sat, 08 Jun 2024 11:08:46 +0000
Data

I want to write Python function cis.read_data() equivalent in Julia.

def read_data(data_list, read_function):
    """
    Wrapper for calling an HDF reading function for each dataset, and then concatenating the result.
    :param list data_list: A list of data objects to read
    :param callable or str read_function: A function for reading the data, or 'SD' or 'VD' for default reading routines.
    :return: A single numpy array of concatenated data values.
    """
    if callable(read_function):
        out = utils.concatenate([read_function(i) for i in data_list])
    elif read_function == 'VD':
        out = utils.concatenate([hdf_vd.get_data(i) for i in data_list])
    elif read_function == 'SD':
        out = utils.concatenate([hdf_sd.get_data(i) for i in data_list])
    else:
        raise ValueError("Invalid read-function: {}, please supply a callable read "
                         "function, 'VD' or 'SD' only".format(read_function))
    return out

I have to read a part of data from a hdf5 file and i will use a config file for selecting that part of data.

and the config file of Athena++ is
sane00.athinput (click for more details)
11 posts - 3 participants