示例#1
0
    def __init__(self, filename1=None, filename2=None, wind=None, **kwargs):
        """
        Uses super to invoke base class __init__ method.

        :param filename: file containing currents for first Cats pattern

        Optional parameters (kwargs).
        Defaults are defined by CyCatsMover object.

        :param filename: file containing currents for second Cats pattern

        :param wind: A gnome.environment.Wind object to be used to drive the
                     CatsMovers.  Will want a warning that mover will
                     not be active without a wind
        :param scale: A boolean to indicate whether to scale value
                      at reference point or not
        :param scale_value: Value used for scaling at reference point
        :param scale_refpoint: Reference location (long, lat, z).
                               The scaling applied to all data is determined
                               by scaling the raw value at this location.

        Remaining kwargs are passed onto Mover's __init__ using super.
        See Mover documentation for remaining valid kwargs.
        """

        if filename1 and not os.path.exists(filename1):
            raise ValueError(
                'Path for Cats filename1 does not exist: {0}'.format(
                    filename1))

        if filename2 is not None:
            if not os.path.exists(filename2):
                raise ValueError(
                    'Path for Cats filename2 does not exist: {0}'.format(
                        filename2))

        self.filename1 = filename1
        self.filename2 = filename2

        self.mover = CyComponentMover()
        self.mover.text_read(filename1, filename2)

        self._wind = None
        if wind is not None:
            self.wind = wind

        # TODO: no need to check for None since properties that are None
        #       are not persisted

        # I think this is required...
        if 'scale_refpoint' in kwargs:
            self.scale_refpoint = kwargs.pop('scale_refpoint')

        super(ComponentMover, self).__init__(**kwargs)
示例#2
0
    def __init__(self,
                 filename1=None,
                 filename2=None,
                 scale_refpoint=None,
                 pat1_angle=0,
                 pat1_speed=10,
                 pat1_speed_units=2,
                 pat1_scale_to_value=0.1,
                 pat2_angle=90,
                 pat2_scale_to_value=0.1,
                 pat2_speed=10,
                 pat2_speed_units=2,
                 scale_by=0,
                 wind=None,
                 **kwargs):
        """
        Uses super to invoke base class __init__ method.

        :param filename: file containing currents for first Cats pattern

        Optional parameters (kwargs).
        Defaults are defined by CyCatsMover object.

        :param filename: file containing currents for second Cats pattern

        :param wind: A gnome.environment.Wind object to be used to drive the
                     CatsMovers.  Will want a warning that mover will
                     not be active without a wind
        :param scale: A boolean to indicate whether to scale value
                      at reference point or not
        :param scale_value: Value used for scaling at reference point
        :param scale_refpoint: Reference location (long, lat, z).
                               The scaling applied to all data is determined
                               by scaling the raw value at this location.

        Remaining kwargs are passed onto Mover's __init__ using super.
        See Mover documentation for remaining valid kwargs.
        """

        if filename1 and not os.path.exists(filename1):
            raise ValueError(
                'Path for Cats filename1 does not exist: {0}'.format(
                    filename1))

        if filename2 is not None:
            if not os.path.exists(filename2):
                raise ValueError(
                    'Path for Cats filename2 does not exist: {0}'.format(
                        filename2))

        self.filename1 = filename1
        self.filename2 = filename2

        self.mover = CyComponentMover()
        self.mover.text_read(filename1, filename2)
        super(ComponentMover, self).__init__(**kwargs)

        self._wind = None
        if wind is not None:
            self.wind = wind
        self.scale_by = scale_by
        self.scale_refpoint = scale_refpoint
        self.pat1_angle = pat1_angle
        self.pat1_speed = pat1_speed
        self.pat1_speed_units = pat1_speed_units
        self.pat1_scale_to_value = pat1_scale_to_value
        self.pat2_angle = pat2_angle
        self.pat2_scale_to_value = pat2_scale_to_value
        self.pat2_speed = pat2_speed
        self.pat2_speed_units = pat2_speed_units