sorcha.readers.HDF5Reader
Classes
A class to read in object data files stored as HDF5 files. |
Module Contents
- class HDF5DataReader(filename, **kwargs)[source]
Bases:
sorcha.readers.ObjectDataReader.ObjectDataReaderA class to read in object data files stored as HDF5 files.
- get_reader_info()[source]
Return a string identifying the current reader name and input information (for logging and output).
- Returns:
name -- The reader information.
- Return type:
string
- _read_rows_internal(block_start=0, block_size=None, **kwargs)[source]
Reads in a set number of rows from the input.
- Parameters:
block_start (integer, optional) -- The 0-indexed row number from which to start reading the data. For example in a CSV file block_start=2 would skip the first two lines after the header and return data starting on row=2. Default=0
block_size (integer, optional) -- the number of rows to read in. Use block_size=None to read in all available data. Default = None
**kwargs (dictionary, optional) -- Extra arguments
- Returns:
res_df -- Dataframe of the object data.
- Return type:
pandas dataframe
- _read_objects_internal(obj_ids, **kwargs)[source]
Read in a chunk of data for given object IDs.
- Parameters:
obj_ids (list) -- A list of object IDs to use.
**kwargs (dictionary, optional) -- Extra arguments
- Returns:
res_df -- The dataframe for the object data.
- Return type:
Pandas dataframe
- _process_and_validate_input_table(input_table, **kwargs)[source]
Perform any input-specific processing and validation on the input table. Modifies the input dataframe in place.
Notes
The base implementation includes filtering that is common to most input types. Subclasses should call super.process_and_validate() to ensure that the ancestor’s validation is also applied.
- Parameters:
input_table (pandas dataframe) -- A loaded table.
**kwargs (dictionary, optional) -- Extra arguments
- Returns:
input_table -- Returns the input dataframe modified in-place.
- Return type:
pandas dataframe