polyfemos.front.sohplot.datacontainer.DataPoint — polyfemos 0.3.29 documentation

# polyfemos.front.sohplot.datacontainer.DataPoint

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

  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)

    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`()
    Return type

      `DataPoint`

    Returns

      returs a copy of the current `DataPoint` instance

  `get_datetime`()
    Return type

      `datetime`

    Returns

  `get_dtstr`()
    Return type

      str

    Returns

      string representation of the timevalue

  `get_ordinal`()
    Return type

      str

    Returns

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

  `get_timestamp`()
    Return type

      float

    Returns

      timestamp

  `get_timezone_naive_datetime`()
    Return type

      `datetime`

    Returns

  `get_utcdatetime`()

    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`()
    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`()
    Return type

      bool

    Returns

      return `True` if `z` has a value set

  `isnan`()
    Return type

      bool

    Returns

      Checks if `y` is nan

  `isnotnan`()
    Return type

      bool

    Returns

      return `True` if `y` is not nan

  `set_z`(value)
    Parameters

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

  `tonan`(inplace=True)

    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__`()
    Return type

      bool

    Returns

      returns `True` if `y` is not nan

  `__eq__`(other)

    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__`()
    Return type

      int

    Returns

      hashed tuple containing `self.__timestamp` and `self.y` values

  `__ne__`(other)
    Parameters

      other (`DataPoint`) –

    Return type

      bool

    Returns

      opposite of the `__eq__()`

  `__str__`()
    Return type

      str

    Returns

      A some kind of string representation of the values