polyfemos.front.sohplot.sohplot.SOHPlot

class polyfemos.front.sohplot.sohplot.SOHPlot(station_id='', sohpar_name='', startdate='', enddate='', headerdate='', outlierremfunc=None, remove_identicals=False, remove_irrationals=False, advanced_outlier_removal=False, fext='stf', track_datalen=False)[source]

Bases: object

Class for parsing and plotting the state of health data of given station and sohpar combination.

Reads soh text files (the format is fixed). Plots the data from startdate to enddate. Creates statistical summary of the data. Removal of irrational values and advanced outlier removal possible.

Public Methods

__init__(station_id='', sohpar_name='', startdate='', enddate='', headerdate='', outlierremfunc=None, remove_identicals=False, remove_irrationals=False, advanced_outlier_removal=False, fext='stf', track_datalen=False)[source]

On initialization of SOHPlot, the data and header information are collected from the sohtextfiles. Optionally, irrational and outlying values are removed.

startdate, enddate and headerdate are parsed into python date instances using parse_date() function.

Parameters
  • station_id (str) – Station id in format NETWORK.STATION, for example: FN.MSF

  • sohpar_name (str) – State of health parameter available in sohtextfile.

  • startdate (str) – The first date of the plotting timespan

  • enddate (str) – The last date of the plotting timespan

  • headerdate (str) – The header information of this date’s sohtextfile is used.

  • outlierremfunc (func) – Defaults to None. If no value is given, outlierremfunc for advanced outlier removal is retrieved using summary_outlierremfuncs(). For more info see outlier_removal().

  • remove_identicals (bool, optional) – defaults to False. If True, values with identical x and y values are removed. see DataContainer for more info

  • remove_irrationals (bool, optional) – defaults to False, see remove_irrationals() for more info.

  • advanced_outlier_removal (bool, optional) – defaults to False

  • fext (str, optional) – defaults to “stf”, select “stf” or “csv”, defines the datafile format which is read

  • track_datalen (bool, optional) – Defaults to False, If True, the amount of datapoints, nans, etc., is monitored.

get_info()[source]
Return type

list

Returns

A list containing info notes

get_plot_components(decimate=True)[source]
Parameters

decimate (bool, optional) – defaults to True, see _get_plot()

Return type

str, str

Returns

script and div html blocks, see components() for more information.

get_statistics_dict()[source]
Return type

dict

Returns

see get_statistics_dict() for more info

get_statistics_table()[source]
Return type

list

Returns

see get_statistics_table() for more info

Private Methods

_get_csv_filepath(date, extension='.csv', force=False)[source]
Parameters
Return type

str

Returns

Filepath following the filepathformat defined in YAML config files.

_get_filepath(date, fpf, extension, force=False)[source]
Parameters
  • date (UTCDateTime) – is constructed from the root and fpf, ‘root/fpf(args)’

  • fpf (func) – filepath format function

  • extension (str) – file extension

  • force (bool) – see filepath()

Return type

str

Returns

path to file

_get_plot(decimate=True)[source]

Creates a 2D bokeh figure, time in x axis. By default, the data is plotted as a line, lines are separated if any number of nan values are between continuous set of valid values. If line consists of only one value, cross marker used instead of a line. Colors are as follows:

  • Red, actual data

  • Brighter red, horizontal lines defined by H_LINES

  • Dark green, outlier datapoints

Parameters

decimate (bool, optional) – defaults to True. If True, data is decimated.

Return type

Figure

Returns

_get_stf_filepath(date)[source]
Parameters

date (UTCDateTime) –

Return type

str

Returns

Filepath following the filepathformat defined in YAML config files.

_read_csv_data()[source]

Reads the data from sohcsv files.

_read_header(nez=False)[source]

Reads and parses the header information from the sohtextfile. Header block ends when ‘DATA’ text is encountered.

Parameters

nez (bool, optional) – defaults to False, for UWV to NEZ conversion, sensor information from the stf header is needed.

_read_stf_data(nez=False)[source]

Reads and parses the data from sohtextfiles.

Parameters

nez (bool, optional) – defaults to False. If selected sohpar is N, E or Z offset, values for U, W and V offsets has to be read. For information about UWV to NEZ conversion see UWVOffsets