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
andheaderdate
are parsed into pythondate
instances usingparse_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 usingsummary_outlierremfuncs()
. For more info seeoutlier_removal()
.remove_identicals (bool, optional) – defaults to
False
. IfTrue
, values with identical x and y values are removed. seeDataContainer
for more inforemove_irrationals (bool, optional) – defaults to
False
, seeremove_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
, IfTrue
, the amount of datapoints, nans, etc., is monitored.
-
get_plot_components
(decimate=True)[source]¶ - Parameters
decimate (bool, optional) – defaults to
True
, see_get_plot()
- Return type
- Returns
script and div html blocks, see
components()
for more information.
-
get_statistics_dict
()[source]¶ - Return type
- Returns
see
get_statistics_dict()
for more info
-
get_statistics_table
()[source]¶ - Return type
- Returns
see
get_statistics_table()
for more info
Private Methods
-
_get_csv_filepath
(date, extension='.csv', force=False)[source]¶ - Parameters
date (
UTCDateTime
) –force (bool) – see
filepath()
extension (str) – file extension, defaults to
".csv"
- Return type
- Returns
Filepath following the filepathformat defined in YAML config files.
-
_get_filepath
(date, fpf, extension, force=False)[source]¶ - Parameters
date (
UTCDateTime
) – is constructed from theroot
andfpf
, ‘root/fpf(args)’fpf (func) – filepath format function
extension (str) – file extension
force (bool) – see
filepath()
- Return type
- 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
-
_get_stf_filepath
(date)[source]¶ - Parameters
date (
UTCDateTime
) –- Return type
- Returns
Filepath following the filepathformat defined in YAML config 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 seeUWVOffsets
-