Utils Module

The utils module includes helper functions. The module currently contains a single function to help users convert numeric indexes to datetime indexes. Additional helper functions could be added at a later date.

Note

The names of the functions below are of the convention path.path.function. Only the function name is used when calling the function in MATLAB. For example, to call on mhkit.wave.io.read_NDBC_file simply use read_NDBC_file.

Functions

Description

get_statistics

Calculate mean, max, min and stdev statistics of continuous data for a given statistical window.

excel_to_datetime

Convert Excel datenum format to Python datetime

mhkit.utils.excel_to_datetime(excel_num)

Convert excel datenum format to datetime

Parameters

excel_num (vector) – vector of excel datenums to be converted

Returns

time (DateTimeIndex) – vector of corresponding python datetime values

mhkit.utils.get_statistics(data, freq, varargin)

Calculate mean, max, min and stdev statistics of continuous data for a given statistical window. Default length of statistical window (period) is based on IEC TS 62600-3:2020 ED1. Also allows calculation of statistics for multiple statistical windows of continuous data.

Parameters
  • data (strucutre) – structure of variables to get statistics for with field called time.

  • freq (double or int) – Sample rate of data [Hz]

  • period (double/int) – Statistical window of interest [sec], default = 600

Returns

stats (structure) – Structure with mean, max, min, and stdev of each variable