:py:mod:`gnome.movers.py_current_movers` ======================================== .. py:module:: gnome.movers.py_current_movers Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: gnome.movers.py_current_movers.CurrentMover Functions ~~~~~~~~~ .. autoapisummary:: gnome.movers.py_current_movers.grid_current_mover Attributes ~~~~~~~~~~ .. autoapisummary:: gnome.movers.py_current_movers.PyCurrentMoverSchema gnome.movers.py_current_movers.PyCurrentMover .. py:data:: PyCurrentMoverSchema .. py:class:: CurrentMover(current=None, time_offset=0, scale_value=1, uncertain_duration=24 * 3600, uncertain_time_delay=0, uncertain_along=0.5, uncertain_cross=0.25, default_num_method='RK2', filename=None, **kwargs) Bases: :py:obj:`gnome.movers.movers.PyMover` CurrentMover implemented in Python. Uses the .current attribute to move particles. The .at() interface is expected on the .current attribute Initialize a CurrentMover :param current: Environment object representing ocean currents to be used. :type current: Any Current or Current-like that implements the .at() function :param active_range: Range of datetimes for when the mover should be active :type active_range: 2-tuple of datetimes :param scale_value: Value to scale current data :param uncertain_duration: how often does a given uncertain element get reset in seconds :param uncertain_time_delay: when does the uncertainly kick in in seconds :param uncertain_cross: Scale for uncertainty perpendicular to the flow :param uncertain_along: Scale for uncertainty parallel to the flow :param time_offset: Time zone shift: not functional :param default_num_method: Numerical method for calculating movement delta. Choices:('Euler', 'RK2', 'RK4') Default: RK2 .. py:property:: filename .. py:property:: data_start .. py:property:: data_stop .. py:attribute:: _schema .. py:attribute:: _ref_as :value: 'py_current_movers' .. py:attribute:: _req_refs .. py:method:: from_netCDF(filename=None, name=None, time_offset=0, scale_value=1, uncertain_duration=24 * 3600, uncertain_time_delay=0, uncertain_along=0.5, uncertain_cross=0.25, **kwargs) :classmethod: Function for specifically creating a CurrentMover from a file .. py:method:: get_bounds() Return a bounding box surrounding the grid data. This function exists because it is part of the top level Mover API .. py:method:: get_move(sc, time_step, model_time_datetime, num_method=None) Compute the move in (long,lat,z) space. It returns the delta move for each element of the spill as a numpy array of size (number_elements X 3) and dtype = gnome.basic_types.world_point_type Base class returns an array of numpy.nan for delta to indicate the get_move is not implemented yet. Each class derived from Mover object must implement it's own get_move :param sc: an instance of gnome.spill_container.SpillContainer class :param time_step: time step in seconds :param model_time_datetime: current model time as datetime object All movers must implement get_move() since that's what the model calls .. py:method:: _update_uncertainty(num_les, elapsed_time) update uncertainty :param num_les: the number released so far :param elapsed_time: time in seconds since model run started .. py:method:: _update_uncertainty_values(elapsed_time) update uncertainty values :param elapsed_time: time in seconds since model run started .. py:method:: _allocate_uncertainty(num_les) add uncertainty :param num_les: the number of les released so far .. py:method:: _add_uncertainty(deltas) add uncertainty :param deltas: the movement for the current time step .. py:method:: prepare_for_model_run() reset uncertainty .. py:method:: prepare_for_model_step(sc, time_step, model_time_datetime) add uncertainty .. py:method:: model_step_is_done(sc) remove any off map les .. py:data:: PyCurrentMover .. py:function:: grid_current_mover(filename, current_kwargs=None, *args, **kwargs) Helper function to load a gridded current from a file and create a CurrentMover :param filename: File to create the GridCurrent object from :type filename: string or Path-like' :param current_kwargs: keyword arguments for the GridCurrent object. OPTIONAL :type current_kwargs: dict