Ejemplo n.º 1
0
    def __init__(self, sobj,
                 fpath=None, ftype='generic',
                 value=None, unit='m',
                 direction=None,
                 std=None, time=None,
                 series=None,
                 **options):
        super(Length, self).__init__(sobj=sobj,
                                     fpath=fpath, ftype=ftype,
                                     series=series,
                                     **options)
        if not value:
            return

        self.ftype = ftype
        self.direction = direction

        length_conversion = convert2(unit, 'm', 'length')

        if not length_conversion:
            self.log.warning('unit << %s >> most likely not %s-compatible' % (unit, self.__class__.get_subclass_name()))
            self.log.error('CAN NOT create Measurement')
            self.has_data = False
            return

        self._data = {'data': RockPy3.Data(column_names=[self.mtype, 'time', 'std_dev'])}
        self._data['data'][self.mtype] = value * length_conversion
        self._data['data']['time'] = time
        self._data['data']['std_dev'] = std
Ejemplo n.º 2
0
    def __init__(self, sobj,
                 mtype='mass', fpath=None, ftype='generic',
                 mass=1.0, mass_unit='kg',
                 std=None, time=None,
                 series=None,
                 **options):
        super(Mass, self).__init__(sobj=sobj,
                                   fpath=fpath, ftype=ftype,
                                   series=series,
                                   **options)

        mass_conversion = convert2(mass_unit, 'kg', 'mass')

        if not mass_conversion:
            self.log.warning('mass unit << %s >> most likely not mass-compatible' % unit)
            self.log.error('CAN NOT create Measurement')
            self.has_data = False
            return

        self._data = {'data': RockPy3.Data(column_names=['variable', 'mass', 'time', 'std_dev'])}
        self._data['data'][mtype] = mass * mass_conversion
        self._data['data']['time'] = time
        self._data['data']['std_dev'] = std