qats.io
#
Sub-package with io for various file formats.
qats.io.csv
#
Readers CSV formatted time series files
Functions overview
|
Read time series data arranged column wise on a comma-separated file. |
|
Read time series names from a comma-separated file. |
API
- read_names(path)#
Read time series names from a comma-separated file.
Notes
The series names are expected found on the header row. Time is expected to be in the first column.
- read_data(path, ind=None)#
Read time series data arranged column wise on a comma-separated file.
- Parameters:
- Returns:
Time and data
- Return type:
array
qats.io.direct_access
#
Readers for various direct access formatted time series files
Functions overview
|
Read cycle distributions from binary direct access formatted '.dis' file. |
|
Read time series names from key-file associated with the direct access (binary) cycle distribution file format '.dis'. |
|
Read time series from binary direct access formatted '.tda' file. |
|
Read time series names from key-file associated with the direct access (binary) time series file format '.tda'. |
|
Read time series from binary direct access formatted '.ts' file. |
|
Read time series names from key-file associated with the direct access (binary) time series file format '.ts'. |
|
Write time series direct access formatted file. |
API
- read_ts_names(path)#
Read time series names from key-file associated with the direct access (binary) time series file format ‘.ts’.
Notes
Names are stored on ASCII file as one name per line. The file is terminated by END.
The associated time series are stored on a binary direct access file with suffix ‘.ts’.
- read_tda_names(path)#
Read time series names from key-file associated with the direct access (binary) time series file format ‘.tda’.
Notes
The associated time series are stored on a binary direct access file with suffix ‘.tda’.
- read_dis_names(path)#
Read time series names from key-file associated with the direct access (binary) cycle distribution file format ‘.dis’.
Notes
The associated cycle distributions are stored on a binary direct access file with suffix ‘.dis’.
- read_ts_data(path, ind=None, verbose=False)#
Read time series from binary direct access formatted ‘.ts’ file.
- Parameters:
- Returns:
Time and data
- Return type:
array
Examples
>>> data = read_ts_data('data.ts') >>> t = data[0,:] # time >>> x1 = data[1,:] # first data series
Notes
Note that 0 is the index of the time array. If
ind
is specified, time array is only included if 0 is included in the specified indices.
- read_tda_data(path, ind=None, verbose=False)#
Read time series from binary direct access formatted ‘.tda’ file.
- Parameters:
- Returns:
Time and data
- Return type:
array
Examples
>>> data = read_tda_data('data.tda') >>> t = data[0,:] # time >>> x1 = data[1,:] # first data series
Notes
Note that 0 is the index of the time array. If
ind
is specified, time array is only included if 0 is included in the specified indices.
- read_dis_data(path, ind=None, verbose=False)#
Read cycle distributions from binary direct access formatted ‘.dis’ file.
- Parameters:
- Returns:
Cycle widths and counts
- Return type:
array
Notes
Note that 0 is the index of the time array. If
ind
is specified, time array is only included if 0 is included in the specified indices.
qats.io.sintef_mat
#
Readers for SINTEF Ocean test data exhange format based on the Matlab .mat file.
Works for matlab file format version <=7.2 and >=7.3.
Functions overview
|
Read time series data from SINTEF Ocean test data exhange format based on the Matlab .mat file. |
|
Read time series names from SINTEF Ocean test data exhange format based on the Matlab .mat file. |
API
- read_names(path)#
Read time series names from SINTEF Ocean test data exhange format based on the Matlab .mat file.
- Parameters:
path (str) – File path
- Returns:
str – Name of the time array
list – Time series names
Examples
>>> tname, names = read_names('data.mat')
- read_data(path: str, names: Optional[Union[List[str], Tuple[str]]] = None)#
Read time series data from SINTEF Ocean test data exhange format based on the Matlab .mat file.
- Parameters:
- Returns:
Time and data
- Return type:
Examples
>>> tname, names = read_names('data.mat') >>> data = read_data('data.mat', [tname, *names]) >>> t = data[tname] # time >>> x1 = data[names[0]] # first data series
qats.io.other
#
Readers for various time series file formats
Functions overview
|
Read time series arranged column wise on ascii formatted file. |
|
Read time series names from an ASCII file with data arranged column-wise. |
|
Write time series arranged column wise on ascii formatted file. |
API
- read_dat_names(path)#
Read time series names from an ASCII file with data arranged column-wise. The names are in the first non-commented row.
Notes
The names are extracted from the header row (the first non-commented row). The comment character is ‘#’. Time is assumed to be in the first column.
- read_dat_data(path, ind=None)#
Read time series arranged column wise on ascii formatted file.
- Parameters:
- Returns:
Time and data
- Return type:
array
Notes
If
ind
is specified, time array is only included if 0 is included in the specified indices.If
ind
is specified, the response arrays (1-D) are stored in the returned 2-D array in the same order as specified. I.e. ifind=[0,10,2,3]
, then the response array with index 10 on .ts file is obtained fromdata[1,:]
.
qats.io.sima
#
Readers for ASCII and direct access formatted time series files exported from SIMA
Functions overview
|
Read time series arranged column wise on ascii formatted file exported from SIMA/RIFLEX Dynmod. |
|
Read time series from binary .bin file exported from RIFLEX Dynmod. |
|
Read time series names from key-files associated with .bin and .asc time-series files exported from SIMA/RIFLEX Dynmod. |
|
Read time series names from key-files associated with '<>_witurb.bin' and '<>_blresp.bin' time-series files exported from SIMA/RIFLEF Dynmod. |
|
Write time series on simo input format |
API
- read_sima_wind_names(path)#
Read time series names from key-files associated with ‘<>_witurb.bin’ and ‘<>_blresp.bin’ time-series files exported from SIMA/RIFLEF Dynmod.
- read_names(path)#
Read time series names from key-files associated with .bin and .asc time-series files exported from SIMA/RIFLEX Dynmod.
Warning
This function is under development, and does not presently handle all kinds of response listings. If an unknown response description is encountered, the key suffix will be DOF<xx>.
- read_bin_data(path, ind=None, verbose=False)#
Read time series from binary .bin file exported from RIFLEX Dynmod.
- Parameters:
- Returns:
Time and data
- Return type:
array
Notes
If
ind
is specified, time array is only included if 0 is included in the specified indices.If
ind
is specified, the response arrays (1-D) are stored in the returned 2-D array in the same order as specified. I.e. ifind=[0,10,2,3]
, then the response array with index 10 on .ts file is obtained fromarr[1,:]
.
- read_ascii_data(path, ind=None, verbose=False)#
Read time series arranged column wise on ascii formatted file exported from SIMA/RIFLEX Dynmod.
- Parameters:
path (str) – Name of the binary file (incl. extension).
ind (list or tuple, optional) – Which columns to read, with 0 being the first. For example, ind=(1,4,5) will extract the 2nd, 5th and 6th columns. The default, None, results in all columns being read.
verbose (bool, optional) – Increase verbosity
- Returns:
Time and data
- Return type:
array
Notes
Time is assummed to be in the first column If
ind
is specified, time array is only included if 0 is included in the specified indices.If
ind
is specified, the response arrays (1-D) are stored in the returned 2-D array in the same order as specified. I.e. ifind=[0,10,2,3]
, then the response array with index 10 on ascii file is obtained fromdata[1,:]
.
qats.io.sima_h5
#
Readers for HDF5 formatted time series files exported from SIMA
Functions overview
|
Extracts time series data from .h5 (or hdf5) file exported from SIMA. |
|
Extracts time series names for h5 data sets containing (or; interpreted as) time series from h5-file exported from SIMA. |
|
Write time series to SIMA HDF5 file. |
API
- read_names(path, verbose=False)#
Extracts time series names for h5 data sets containing (or; interpreted as) time series from h5-file exported from SIMA.
- read_data(path, names=None, verbose=False)#
Extracts time series data from .h5 (or hdf5) file exported from SIMA.
- Parameters:
- Returns:
List of arrays with time and data
- Return type:
Notes
If keys is not specified, all datasets that are interpreted as time series will be read. See also read_h5_keys.
Note that the hdf5 is an extremely flexible file format and this reader is tailored to the SIMA h5 file format.
qats.io.tdms
#
Functions overview
|
Read time series data from Technical Data Management Streaming (TDMS) files typically exported from LabVIEW. |
|
Read time series names from Technical Data Management Streaming (TDMS) file. |
API
- read_names(path)#
Read time series names from Technical Data Management Streaming (TDMS) file.
- Parameters:
path (str) – Path (relative or absolute) to tdms-file
- Returns:
List of time series names (datasets)
- Return type:
References