polyfemos.front.sohplot.datacontainer.DataPoint

class polyfemos.front.sohplot.datacontainer.DataPoint(dtstr=None, timestamp=None, utcdatetime=None, y=None, z=None)[source]

Bases: object

A structlike class to store one datapoint in timeseries data

Public Methods

__init__(dtstr=None, timestamp=None, utcdatetime=None, y=None, z=None)[source]

The data must have timevalue, given either dtstr, timestamp or utcdatetime. z is an optional axis containing arbitrary string values following python dictionary syntax

Parameters
  • dtstr (str) – utcdatetime compatible string representing time value

  • timestamp (float) –

  • utcdatetime (UTCDateTime) –

  • y (str or numlike) – string representing float number, if invalid string is provided, y will be nan

  • z (str, optional) – Additional arbitrary values contained in string following python dict syntax

copy()[source]
Return type

DataPoint

Returns

returs a copy of the current DataPoint instance

get_datetime()[source]
Return type

datetime

Returns

get_dtstr()[source]
Return type

str

Returns

string representation of the timevalue

get_ordinal()[source]
Return type

str

Returns

year and the day of the yeat as a string in format YEAR.JULDAY, e.g. 2019.023

get_timestamp()[source]
Return type

float

Returns

timestamp

get_timezone_naive_datetime()[source]
Return type

datetime

Returns

get_utcdatetime()[source]

If self.__utcdatetime is not previously defined, the value is read using self.__dtstr or self.__timestamp. If either of those is not provided, error is thrown.

Return type

UTCDateTime

Returns

get_z()[source]
Return type

dict

Returns

Returns the value of z attribute. If the type was not previously converted from string to dictionary, the conversion is done in addition.

ifz()[source]
Return type

bool

Returns

return True if z has a value set

isnan()[source]
Return type

bool

Returns

Checks if y is nan

isnotnan()[source]
Return type

bool

Returns

return True if y is not nan

set_z(value)[source]
Parameters

value (str) – Value to be set to z attribute

tonan(inplace=True)[source]

Change the y attribute to nan. If inplace is False, a copy of DataPoint is returned. Note the mutability of the DataPoint instance if inplace is True.

Parameters

inplace (bool, optional) – defaults to True

Return type

DataPoint

Returns

Special Methods

__bool__()[source]
Return type

bool

Returns

returns True if y is not nan

__eq__(other)[source]

Compares the timestamp and y values between self and other. If both values are iedntical, returns True.

Parameters

other (DataPoint) –

Return type

bool

Returns

__hash__()[source]
Return type

int

Returns

hashed tuple containing self.__timestamp and self.y values

__ne__(other)[source]
Parameters

other (DataPoint) –

Return type

bool

Returns

opposite of the __eq__()

__str__()[source]
Return type

str

Returns

A some kind of string representation of the values