gnome.movers.py_current_movers ============================== .. py:module:: gnome.movers.py_current_movers Attributes ---------- .. autoapisummary:: gnome.movers.py_current_movers.PyCurrentMoverSchema gnome.movers.py_current_movers.PyCurrentMover Classes ------- .. autoapisummary:: gnome.movers.py_current_movers.CurrentMover Functions --------- .. autoapisummary:: gnome.movers.py_current_movers.grid_current_mover Module Contents --------------- .. py:data:: PyCurrentMoverSchema .. py:class:: CurrentMover(current=None, 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: (seconds) how often a given uncertain element gets reset in seconds :param uncertain_time_delay: when the uncertainty kicks in in seconds from model start :param uncertain_cross: Scale for uncertainty perpendicular to the flow :param uncertain_along: Scale for uncertainty parallel to the flow :param default_num_method: Numerical method for calculating movement delta. Choices:('Euler', 'RK2', 'RK4') Default: RK2 .. py:property:: filename .. py:attribute:: current :value: None .. py:attribute:: scale_value :value: 1 .. py:attribute:: uncertain_along :value: 0.5 .. py:attribute:: uncertain_cross :value: 0.25 .. py:attribute:: uncertain_duration :value: 86400 .. py:attribute:: uncertain_time_delay :value: 0 .. py:attribute:: model_time :value: 0 .. py:attribute:: spill_type :value: 0 .. py:attribute:: is_first_step :value: False .. py:attribute:: time_uncertainty_was_set :value: 0 .. py:attribute:: shape :value: (2,) .. py:method:: from_netCDF(filename=None, name=None, scale_value=1, uncertain_duration=24 * 3600, uncertain_time_delay=0, uncertain_along=0.5, uncertain_cross=0.25, **kwargs) :classmethod: Function for creating a CurrentMover from a file .. py:property:: data_start .. py:property:: data_stop .. 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:: prepare_for_model_run() reset uncertainty .. py:method:: prepare_for_model_step(sc, time_step, model_time_datetime) add uncertainty :param sc: an instance of gnome.spill_container.SpillContainer class :param int time_step: the model time step in seconds :param model_time_datetime: the current model time as a datetime object .. py:method:: model_step_is_done(sc) remove any off map les :param sc: an instance of gnome.spill_container.SpillContainer class .. 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