def __init__(self, settings, iface):
        TimeVectorLayer.__init__(self, settings, iface=iface)
        try:
            info(
                "Trying to create time interpolated layer with interpolation mode: {}"
                .format(settings.interpolationMode))
            try:
                import numpy as np
            except:
                raise Exception("Need to have numpy installed")

            if self.layer.geometryType() != QGis.Point:
                raise Exception("Want point geometry!")
            self.idAttribute = settings.idAttribute
            self.memLayer = self.getMemLayer()

            # adjust memLayer to have same crs and same color as original layer, only half transparent
            self.memLayer.setCrs(self.layer.crs())
            qgs.setLayerColor(self.memLayer, qgs.getLayerColor(self.layer))
            qgs.setLayerSize(self.memLayer, qgs.getLayerSize(self.layer))
            qgs.setLayerTransparency(self.memLayer, 0.5)
            qgs.refreshSymbols(self.iface, self.memLayer)

            QgsMapLayerRegistry.instance().addMapLayer(self.memLayer)

            provider = self.getProvider()
            self.fromTimeAttributeIndex = provider.fieldNameIndex(
                self.fromTimeAttribute)
            self.toTimeAttributeIndex = provider.fieldNameIndex(
                self.toTimeAttribute)

            if self.hasIdAttribute():
                self.idAttributeIndex = provider.fieldNameIndex(
                    self.idAttribute)
                self.uniqueIdValues = set(
                    provider.uniqueValues(self.idAttributeIndex))
            else:
                self.uniqueIdValues = set([DEFAULT_ID])

            self.mode = settings.interpolationMode
            self.fromInterpolator = ifactory.get_interpolator_from_text(
                self.mode)
            self.fromInterpolator.load(self)
            self.n = 0
            info("Interpolated layer {} created successfully!".format(
                self.layer.name()))
        except Exception, e:
            raise InvalidTimeLayerError("Traceback:" + traceback.format_exc(e))
    def __init__(self, settings, iface):
        TimeVectorLayer.__init__(self, settings, iface=iface)
        try:
            info("Trying to create time interpolated layer with interpolation mode: {}".format(
                settings.interpolationMode))
            try:
                import numpy as np
            except:
                raise Exception("Need to have numpy installed")

            if self.layer.geometryType() != QGis.Point:
                raise Exception("Want point geometry!")
            self.idAttribute = settings.idAttribute
            self.memLayer = self.getMemLayer()

            # adjust memLayer to have same crs and same color as original layer, only half transparent
            self.memLayer.setCrs(self.layer.crs())
            qgs.setLayerColor(self.memLayer, qgs.getLayerColor(self.layer))
            qgs.setLayerSize(self.memLayer, qgs.getLayerSize(self.layer))
            #qgs.setLayerTransparency(self.memLayer, 0.5)
            qgs.refreshSymbols(self.iface, self.memLayer)

            QgsMapLayerRegistry.instance().addMapLayer(self.memLayer)

            provider = self.getProvider()
            self.fromTimeAttributeIndex = provider.fieldNameIndex(self.fromTimeAttribute)
            self.toTimeAttributeIndex = provider.fieldNameIndex(self.toTimeAttribute)

            if self.hasIdAttribute():
                self.idAttributeIndex = provider.fieldNameIndex(self.idAttribute)
                self.uniqueIdValues = set(provider.uniqueValues(self.idAttributeIndex))
            else:
                self.uniqueIdValues = set([DEFAULT_ID])

            self.mode = settings.interpolationMode
            self.fromInterpolator = ifactory.get_interpolator_from_text(self.mode)
            self.fromInterpolator.load(self)
            self.n = 0
            info("Interpolated layer {} created successfully!".format(self.layer.name()))
        except Exception, e:
            raise InvalidTimeLayerError("Traceback:" + traceback.format_exc(e))