:py:mod:`gnome.movers.c_current_movers` ======================================= .. py:module:: gnome.movers.c_current_movers .. autoapi-nested-parse:: Movers using currents and tides as forcing functions Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: gnome.movers.c_current_movers.CurrentMoversBase gnome.movers.c_current_movers.CatsMover gnome.movers.c_current_movers.c_GridCurrentMover gnome.movers.c_current_movers.IceMover gnome.movers.c_current_movers.CurrentCycleMover gnome.movers.c_current_movers.ComponentMover .. py:class:: CurrentMoversBase(uncertain_duration=24, uncertain_time_delay=0, **kwargs) Bases: :py:obj:`gnome.movers.CyMover` Base class from which all Python movers/weatherers can inherit It defines the base functionality for mover/weatherer. NOTE: Since base class is not Serializable, it does not need a class level _schema attribute. set common properties children should define self.mover, then we can set common properties .. py:attribute:: _ref_as :value: 'c_current_movers' .. py:attribute:: uncertain_duration .. py:attribute:: uncertain_time_delay .. py:method:: get_triangles() Invokes the GetToplogyHdl method of TimeGridVel_c object. Cross-references point data to get triangle coordinates. .. py:method:: get_cells() Invokes the GetCellDataHdl method of TimeGridVel_c object. Cross-references point data to get cell coordinates. .. py:method:: get_triangle_center_points() Right now the cython mover only gets the triangular center points. .. py:method:: get_cell_center_points() Right now the cython mover only gets the triangular center points, so we need to calculate centers based on the cells themselves. Cells will have the format (tl, tr, bl, br) We need to get the rectangular centers Center will be: (tl + ((br - tl) / 2.)) .. py:method:: get_points() .. py:method:: get_bounds() Right now the cython mover only gets the triangular center points. .. py:class:: CatsMover(filename=None, tide=None, uncertain_duration=48, **kwargs) Bases: :py:obj:`CurrentMoversBase` Base class from which all Python movers/weatherers can inherit It defines the base functionality for mover/weatherer. NOTE: Since base class is not Serializable, it does not need a class level _schema attribute. Uses super to invoke base class __init__ method. :param filename: file containing currents patterns for Cats Optional parameters (kwargs). Defaults are defined by CyCatsMover object. :param tide: a gnome.environment.Tide object to be attached to CatsMover :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. :param uncertain_duration: how often does a given uncertain element gets reset :param uncertain_time_delay: when does the uncertainly kick in. :param up_cur_uncertain: Scale for uncertainty along the flow :param down_cur_uncertain: Scale for uncertainty along the flow :param right_cur_uncertain: Scale for uncertainty across the flow :param left_cur_uncertain: Scale for uncertainty across the flow :param uncertain_eddy_diffusion: Diffusion coefficient for eddy diffusion. Default is 0. :param uncertain_eddy_v0: Default is .1 (Check that this is still used) Remaining kwargs are passed onto Mover's __init__ using super. See Mover documentation for remaining valid kwargs. .. py:property:: ref_scale .. py:property:: scale_refpoint .. py:property:: tide .. py:property:: data_start .. py:property:: data_stop .. py:attribute:: _schema .. py:attribute:: filename .. py:attribute:: scale .. py:attribute:: scale_value .. py:attribute:: up_cur_uncertain .. py:attribute:: down_cur_uncertain .. py:attribute:: right_cur_uncertain .. py:attribute:: left_cur_uncertain .. py:attribute:: uncertain_eddy_diffusion .. py:attribute:: uncertain_eddy_v0 .. py:method:: __repr__() Return repr(self). .. py:method:: get_grid_data() Invokes the GetToplogyHdl method of TriGridVel_c object .. py:method:: get_center_points() .. py:method:: get_scaled_velocities(model_time) Get file values scaled to ref pt value, with tide applied (if any) .. py:class:: c_GridCurrentMover(filename, topology_file=None, extrapolate=False, time_offset=0, current_scale=1, uncertain_along=0.5, uncertain_across=0.25, uncertain_cross=0.25, num_method='Euler', **kwargs) Bases: :py:obj:`CurrentMoversBase` Base class from which all Python movers/weatherers can inherit It defines the base functionality for mover/weatherer. NOTE: Since base class is not Serializable, it does not need a class level _schema attribute. Initialize a c_GridCurrentMover :param filename: absolute or relative path to the data file: could be netcdf or filelist :param topology_file=None: absolute or relative path to topology file. If not given, the c_GridCurrentMover will compute the topology from the data file. :param active_range: Range of datetimes for when the mover should be active :type active_range: 2-tuple of datetimes :param current_scale: Value to scale current data :param uncertain_duration: how often does a given uncertain element get reset :param uncertain_time_delay: when does the uncertainly kick in. :param uncertain_cross: Scale for uncertainty perpendicular to the flow :param uncertain_along: Scale for uncertainty parallel to the flow :param extrapolate: Allow current data to be extrapolated before and after file data :param time_offset: Time zone shift if data is in GMT :param num_method: Numerical method for calculating movement delta. Default Euler option: Runga-Kutta 4 (RK4) uses super, ``super(c_GridCurrentMover,self).__init__(**kwargs)`` .. py:property:: data_start .. py:property:: data_stop .. py:property:: num_method .. py:property:: is_data_on_cells .. py:attribute:: _schema .. py:attribute:: uncertain_cross .. py:attribute:: uncertain_along .. py:attribute:: current_scale .. py:attribute:: extrapolate .. py:attribute:: time_offset .. py:method:: __repr__() Return repr(self). .. py:method:: __str__() Return str(self). .. py:method:: get_grid_data() The main function for getting grid data from the mover .. py:method:: get_center_points() .. py:method:: get_scaled_velocities(time) :param time=0: model time in integer seconds .. py:method:: export_topology(topology_file) :param topology_file=None: absolute or relative path where topology file will be written. .. py:method:: extrapolate_in_time(extrapolate) :param extrapolate=false: allow current data to be extrapolated before and after file data. .. py:method:: offset_time(time_offset) :param offset_time=0: allow data to be in GMT with a time zone offset (hours). .. py:method:: get_offset_time() :param offset_time=0: allow data to be in GMT with a time zone offset (hours). .. py:method:: get_start_time() :this will be the real_data_start time (seconds). .. py:method:: get_end_time() :this will be the real_data_stop time (seconds). .. py:method:: get_num_method() .. py:class:: IceMover(filename=None, topology_file=None, current_scale=1, uncertain_along=0.5, uncertain_cross=0.25, extrapolate=False, time_offset=0, **kwargs) Bases: :py:obj:`CurrentMoversBase` Base class from which all Python movers/weatherers can inherit It defines the base functionality for mover/weatherer. NOTE: Since base class is not Serializable, it does not need a class level _schema attribute. Initialize an IceMover :param filename: absolute or relative path to the data file: could be netcdf or filelist :param topology_file=None: absolute or relative path to topology file. If not given, the IceMover will compute the topology from the data file. :param active_range: Range of datetimes for when the mover should be active :type active_range: 2-tuple of datetimes :param current_scale: Value to scale current data :param uncertain_duration: how often does a given uncertain element get reset :param uncertain_time_delay: when does the uncertainly kick in. :param uncertain_cross: Scale for uncertainty perpendicular to the flow :param uncertain_along: Scale for uncertainty parallel to the flow :param extrapolate: Allow current data to be extrapolated before and after file data :param time_offset: Time zone shift if data is in GMT uses super, ``super(IceMover,self).__init__(**kwargs)`` .. py:attribute:: _schema .. py:attribute:: uncertain_cross .. py:attribute:: uncertain_along .. py:attribute:: current_scale .. py:attribute:: extrapolate .. py:attribute:: time_offset .. py:method:: __repr__() Return repr(self). .. py:method:: __str__() Return str(self). .. py:method:: get_grid_data() .. py:method:: get_grid_bounding_box(grid_data=None, box_to_merge=None) Return a bounding box surrounding the grid data. :param grid_data: The point data of our grid. :type grid_data: A sequence of 3-tuples or 4-tuples containing (long, lat) pairs. :param box_to_merge: A bounding box to surround in combination with our grid data. This allows us to pad the bounding box that we generate. :type box_to_merge: A bounding box (extent) of the form: ((left, bottom), (right, top)) .. py:method:: get_center_points() .. py:method:: get_scaled_velocities(model_time) :param model_time=0: datetime in integer seconds .. py:method:: get_ice_velocities(model_time) :param model_time=0: .. py:method:: get_movement_velocities(model_time) :param model_time=0: .. py:method:: get_ice_fields(model_time) :param model_time=0: .. py:method:: export_topology(topology_file) :param topology_file=None: absolute or relative path where topology file will be written. .. py:method:: extrapolate_in_time(extrapolate) :param extrapolate=false: allow current data to be extrapolated before and after file data. .. py:method:: offset_time(time_offset) :param offset_time=0: allow data to be in GMT with a time zone offset (hours). .. py:method:: get_offset_time() :param offset_time=0: allow data to be in GMT with a time zone offset (hours). .. py:class:: CurrentCycleMover(filename=None, topology_file=None, tide=None, **kwargs) Bases: :py:obj:`c_GridCurrentMover` Base class from which all Python movers/weatherers can inherit It defines the base functionality for mover/weatherer. NOTE: Since base class is not Serializable, it does not need a class level _schema attribute. Initialize a CurrentCycleMover :param filename: Absolute or relative path to the data file: could be netcdf or filelist :param topology_file=None: Absolute or relative path to topology file. If not given, the c_GridCurrentMover will compute the topology from the data file. :param tide: A gnome.environment.Tide object to be attached to CatsMover :param active_range: Range of datetimes for when the mover should be active :type active_range: 2-tuple of datetimes :param current_scale: Value to scale current data :param uncertain_duration: How often does a given uncertain element get reset :param uncertain_time_delay: when does the uncertainly kick in. :param uncertain_cross: Scale for uncertainty perpendicular to the flow :param uncertain_along: Scale for uncertainty parallel to the flow :param extrapolate: Allow current data to be extrapolated before and after file data :param time_offset: Time zone shift if data is in GMT uses super: super(CurrentCycleMover,self).__init__(**kwargs) .. py:property:: tide .. py:property:: data_start .. py:property:: data_stop .. py:property:: is_data_on_cells .. py:attribute:: _schema .. py:attribute:: _ref_as :value: 'current_cycle_mover' .. py:attribute:: _req_refs .. py:method:: __repr__() Return repr(self). .. py:method:: __str__() Return str(self). .. py:method:: get_center_points() .. py:method:: get_scaled_velocities(time) :param time=0: datetime in integer seconds .. py:class:: ComponentMover(filename1=None, filename2=None, wind=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, **kwargs) Bases: :py:obj:`CurrentMoversBase` Base class from which all Python movers/weatherers can inherit It defines the base functionality for mover/weatherer. NOTE: Since base class is not Serializable, it does not need a class level _schema attribute. 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. .. py:property:: data_start .. py:property:: data_stop .. py:property:: scale_refpoint .. py:property:: wind .. py:attribute:: _schema .. py:attribute:: _ref_as :value: 'component_mover' .. py:attribute:: _req_refs .. py:attribute:: pat1_angle .. py:attribute:: pat1_speed .. py:attribute:: pat1_speed_units .. py:attribute:: pat1_scale_to_value .. py:attribute:: pat2_angle .. py:attribute:: pat2_speed .. py:attribute:: pat2_speed_units .. py:attribute:: pat2_scale_to_value .. py:attribute:: scale_by .. py:attribute:: extrapolate .. py:attribute:: use_averaged_winds .. py:attribute:: wind_power_factor .. py:attribute:: past_hours_to_average .. py:attribute:: scale_factor_averaged_winds .. py:attribute:: use_original_scale_factor .. py:method:: __repr__() unambiguous representation of object .. py:method:: get_grid_data() Invokes the GetToplogyHdl method of TriGridVel_c object .. py:method:: get_center_points() .. py:method:: get_optimize_values(model_time) .. py:method:: get_scaled_velocities(model_time) Get file values scaled to optimized check if pat2 exists