bulum.io.idx_io_native module

IO functions for IDX format (binary) written in native Python.

read_idx(filename, skip_header_bytes: bool | None = None) TimeseriesDataframe

Read IDX file.

Parameters:
  • filename – Name of the IDX file.

  • skip_header_bytes (bool, optional) – Whether to skip header bytes in the corresponding OUTs file (related to the compiler used for IQQM). If set to None, attempt to detect the presence of header bytes automatically.

Return type:

utils.TimeseriesDataframe

write_idx_native(df: DataFrame, filepath, type='None', units='None') None

Writer for .IDX and corresponding .OUT binary files written in native Python. Currently only supports daily data (date flag 0), as with the reader read_idx().

Assumes that data are homogeneous in units and type e.g. Precipitation & mm resp., or Flow & ML/d.

Parameters:
  • df (pd.Dataframe) – DataFrame as per the output of read_idx().

  • filepath – Path to the IDX file to be written to including .IDX extension.

  • units (str, optional) – Units for data in df.

  • type (str, optional) – Data specifier for data in df, e.g. Gauged Flow, Precipitation, etc.