:py:mod:`gnome.movers` ====================== .. py:module:: gnome.movers .. autoapi-nested-parse:: __init__.py for the gnome.movers package Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 c_current_movers/index.rst c_wind_movers/index.rst movers/index.rst py_current_movers/index.rst py_wind_movers/index.rst random_movers/index.rst ship_drift_mover/index.rst simple_mover/index.rst vertical_movers/index.rst Package Contents ---------------- Classes ~~~~~~~ .. autoapisummary:: gnome.movers.Mover gnome.movers.Process gnome.movers.CyMover gnome.movers.PyMover gnome.movers.SimpleMover gnome.movers.PointWindMover gnome.movers.c_GridWindMover gnome.movers.IceWindMover gnome.movers.ShipDriftMover gnome.movers.RandomMover gnome.movers.IceAwareRandomMover gnome.movers.RandomMover3D gnome.movers.CatsMover gnome.movers.ComponentMover gnome.movers.c_GridCurrentMover gnome.movers.IceMover gnome.movers.CurrentCycleMover gnome.movers.RiseVelocityMover gnome.movers.TamocRiseVelocityMover gnome.movers.WindMover gnome.movers.CurrentMover Functions ~~~~~~~~~ .. autoapisummary:: gnome.movers.constant_point_wind_mover gnome.movers.point_wind_mover_from_file Attributes ~~~~~~~~~~ .. autoapisummary:: gnome.movers.mover_schemas .. py:class:: Mover(on=True, make_default_refs=True, active_range=(InfDateTime('-inf'), InfDateTime('inf')), _automanaged=True, **kwargs) Bases: :py:obj:`Process` 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 default Mover/Weatherer parameters All parameters are optional (kwargs) :param on: boolean as to whether the object is on or not. Default is on :param active_range: Range of datetimes for when the mover should be active :type active_range: 2-tuple of datetimes .. py:method:: get_move(sc, time_step, model_time_datetime) 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:: get_bounds() Return a bounding box surrounding the grid data. .. py:class:: Process(on=True, make_default_refs=True, active_range=(InfDateTime('-inf'), InfDateTime('inf')), _automanaged=True, **kwargs) Bases: :py:obj:`gnome.GnomeId` 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 default Mover/Weatherer parameters All parameters are optional (kwargs) :param on: boolean as to whether the object is on or not. Default is on :param active_range: Range of datetimes for when the mover should be active :type active_range: 2-tuple of datetimes .. py:property:: active .. py:property:: active_range .. py:property:: data_start .. py:property:: data_stop .. py:method:: _check_active_startstop(active_start, active_stop) .. py:method:: datetime_to_seconds(model_time) Put the time conversion call here - in case we decide to change it, it only updates here .. py:method:: prepare_for_model_run() Override this method if a derived mover class needs to perform any actions prior to a model run .. py:method:: prepare_for_model_step(sc, time_step, model_time_datetime) sets active flag based on time_span and on flag. Object is active if following hold and 'on' is True: 1. active start <= (model_time + time_step/2) so object is on for more than half the timestep 2. (model_time + time_step/2) <= active_stop so again the object is on for at least half the time step flag to true. :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 .. py:method:: model_step_is_done(sc=None) This method gets called by the model when after everything else is done in a time step. Put any code need for clean-up, etc in here in subclassed movers. .. py:method:: post_model_run() Override this method if a derived class needs to perform any actions after a model run is complete (StopIteration triggered) .. py:class:: CyMover(**kwargs) Bases: :py:obj:`Mover` 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. Base class for python wrappers around cython movers. Uses ``super(CyMover, self).__init__(**kwargs)`` to call Mover class __init__ method All cython movers (CyWindMover, CyRandomMover) are instantiated by a derived class, and then contained by this class in the member 'movers'. They will need to extract info from spill object. We assumes any derived class will instantiate a 'mover' object that has methods like: prepare_for_model_run, prepare_for_model_step, All kwargs passed on to super class .. py:method:: prepare_for_model_run() Calls the contained cython mover's prepare_for_model_run() .. py:method:: prepare_for_model_step(sc, time_step, model_time_datetime) Default implementation of prepare_for_model_step(...) - Sets the mover's active flag if time is within specified timespan (done in base class Mover) - Invokes the cython mover's prepare_for_model_step :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 Uses super to invoke Mover class prepare_for_model_step and does a couple more things specific to CyMover. .. py:method:: get_move(sc, time_step, model_time_datetime) Base implementation of Cython wrapped C++ movers Override for things like the PointWindMover since it has a different implementation :param sc: spill_container.SpillContainer object :param time_step: time step in seconds :param model_time_datetime: current model time as datetime object .. py:method:: prepare_data_for_get_move(sc, model_time_datetime) organizes the spill object into inputs for calling with Cython wrapper's get_move(...) :param sc: an instance of gnome.spill_container.SpillContainer class :param model_time_datetime: current model time as datetime object .. py:method:: model_step_is_done(sc=None) This method gets called by the model after everything else is done in a time step, and is intended to perform any necessary clean-up operations. Subclassed movers can override this method. .. py:class:: PyMover(default_num_method='RK2', **kwargs) Bases: :py:obj:`Mover` 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 default Mover/Weatherer parameters All parameters are optional (kwargs) :param on: boolean as to whether the object is on or not. Default is on :param active_range: Range of datetimes for when the mover should be active :type active_range: 2-tuple of datetimes .. py:attribute:: _schema .. py:method:: delta_method(method_name=None) Returns a delta function based on its registered name Usage: delta = self.delta_method('RK2')(**kwargs) Note: We do not handle any key errors resulting from passing in a bad registered name. .. py:method:: get_delta_Euler(sc, time_step, model_time, pos, vel_field) .. py:method:: get_delta_RK2(sc, time_step, model_time, pos, vel_field) .. py:method:: get_delta_RK4(sc, time_step, model_time, pos, vel_field) .. py:class:: SimpleMover(velocity=0, uncertainty_scale=0.5, **kwargs) Bases: :py:obj:`gnome.movers.Mover` simple_mover a really simple mover -- moves all LEs a constant speed and direction (not all that different than a constant wind mover, now that I think about it) simple_mover (velocity) create a simple_mover instance :param velocity: a (u, v, w) triple -- in meters per second :param uncertainty_scale=0.5: the scale of the uncertainty of the velocity Remaining kwargs are passed onto Mover's __init__ using super. See Mover documentation for remaining valid kwargs. .. py:attribute:: _schema .. py:method:: __repr__() Return repr(self). .. py:method:: get_move(spill, time_step, model_time) moves the particles defined in the spill object :param spill: spill is an instance of the gnome.spills.Spill class :param time_step: time_step in seconds :param model_time: current model time as a datetime object In this case, it uses the positions and status_code data arrays. :returns delta: Nx3 numpy array of movement -- in (long, lat, meters) units .. py:class:: PointWindMover(wind=None, **kwargs) Bases: :py:obj:`WindMoversBase` Python wrapper around the Cython wind_mover module. This class inherits from CyMover and contains CyWindMover The real work is done by the CyWindMover object. CyMover sets everything up that is common to all movers. Uses super to call CyMover base class __init__ :param wind: wind object -- provides the wind time series for the mover Remaining kwargs are passed onto WindMoversBase __init__ using super. See Mover documentation for remaining valid kwargs. .. note:: Can be initialized with wind=None; however, wind must be set before running. If wind is not None, toggle make_default_refs to False since user provided a valid Wind and does not wish to use the default from the Model. .. py:property:: wind .. py:property:: data_start .. py:property:: data_stop .. py:attribute:: _schema .. py:attribute:: _ref_as :value: 'wind_mover' .. py:attribute:: _req_refs .. py:method:: __repr__() Return repr(self). .. py:method:: __str__() Return str(self). .. py:method:: prepare_for_model_run() if wind attribute is not set, raise ReferencedObjectNotSet excpetion .. py:function:: constant_point_wind_mover(speed, direction, units='m/s') utility function to create a point wind mover with a constant wind :param speed: wind speed :param direction: wind direction in degrees true (direction from, following the meteorological convention) :param units='m/s': the units that the input wind speed is in. options: 'm/s', 'knot', 'mph', others... :return: returns a gnome.movers.WindMover object all set up. .. note:: The time for a constant wind timeseries is irrelevant. This function simply sets it to datetime.now() accurate to hours. .. py:function:: point_wind_mover_from_file(filename, **kwargs) Creates a wind mover from a wind time-series file (OSM long wind format) :param filename: The full path to the data file :param kwargs: All keyword arguments are passed on to the WindMover constructor :returns mover: returns a wind mover, built from the file .. py:class:: c_GridWindMover(filename=None, topology_file=None, extrapolate=False, time_offset=0, **kwargs) Bases: :py:obj:`WindMoversBase` 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. :param wind_file: file containing wind data on a grid :param filename: file containing wind data on a grid :param topology_file: Default is None. When exporting topology, it is stored in this file :param wind_scale: Value to scale wind data :param extrapolate: Allow current data to be extrapolated before and after file data :param time_offset: Time zone shift if data is in GMT Pass optional arguments to base class uses super: ``super(c_GridWindMover,self).__init__(**kwargs)`` .. py:property:: data_start .. py:property:: data_stop .. py:attribute:: _schema .. py:attribute:: wind_scale .. py:attribute:: extrapolate .. py:attribute:: time_offset .. py:method:: __repr__() .. todo:: We probably want to include more information. .. py:method:: __str__() Return str(self). .. py:method:: get_grid_data() .. py:method:: get_cells() Invokes the GetCellDataHdl method of TimeGridWind_c object. Cross-references point data to get cell coordinates. .. py:method:: get_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_center_points() .. py:method:: get_scaled_velocities(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:class:: IceWindMover(filename=None, topology_file=None, extrapolate=False, time_offset=0, **kwargs) Bases: :py:obj:`WindMoversBase` 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 IceWindMover :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 wind_scale: Value to scale wind data :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(IceWindMover,self).__init__(**kwargs)`` .. py:attribute:: _schema .. py:method:: __repr__() Return repr(self). .. py:method:: __str__() Return str(self). .. py:method:: get_grid_data() .. py:method:: get_center_points() .. py:method:: get_scaled_velocities(model_time) :param model_time=0: .. 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:: ShipDriftMover(wind_file=None, topology_file=None, grid_type=1, drift_angle=0, time_offset=0, **kwargs) Bases: :py:obj:`gnome.movers.Mover` 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. :param wind_file: file containing wind data on a grid :param topology_file: Default is None. When exporting topology, it is stored in this file :param wind_scale: Value to scale wind data :param extrapolate: Allow current data to be extrapolated before and after file data :param time_offset: Time zone shift if data is in GMT Pass optional arguments to base class uses super: ``super(ShipDriftMover,self).__init__(**kwargs)`` .. py:attribute:: _schema .. py:attribute:: wind_scale .. py:attribute:: extrapolate .. py:attribute:: time_offset .. py:method:: __repr__() .. todo:: We probably want to include more information. .. py:method:: __str__() Return str(self). .. py:method:: export_topology(topology_file) :param topology_file=None: absolute or relative path where topology file will be written. .. py:method:: prepare_for_model_run() Override this method if a derived mover class needs to perform any actions prior to a model run .. py:method:: prepare_for_model_step(sc, time_step, model_time_datetime) Call base class method using super Also updates windage for this timestep :param sc: an instance of gnome.spill_container.SpillContainer class :param time_step: time step in seconds :param model_time_datetime: current time of model as a date time object .. py:method:: prepare_data_for_get_move(sc, model_time_datetime) organizes the spill object into inputs for calling with Cython wrapper's get_move(...) :param sc: an instance of gnome.spill_container.SpillContainer class :param model_time_datetime: current model time as datetime object .. py:method:: get_move(sc, time_step, model_time_datetime) Override base class functionality because mover has a different get_move signature :param sc: an instance of the gnome.SpillContainer class :param time_step: time step in seconds :param model_time_datetime: current time of the model as a date time object .. py:method:: model_step_is_done(sc=None) This method gets called by the model after everything else is done in a time step, and is intended to perform any necessary clean-up operations. Subclassed movers can override this method. .. py:class:: RandomMover(diffusion_coef=100000.0, uncertain_factor=2.0, **kwargs) Bases: :py:obj:`gnome.movers.CyMover` "Random Walk" diffusion mover Moves the elements each time step in a random direction, according to the specified diffusion coefficient. :param diffusion_coef: Diffusion coefficient for random diffusion. Default is 100,000 cm2/sec :type diffusion_coef: float or integer in units of cm^2/s :param uncertain_factor: Uncertainty factor. Default is 2.0 Remaining kwargs are passed onto :class:`gnome.movers.Mover` __init__ See Mover documentation for remaining valid kwargs. .. py:property:: data_start .. py:property:: data_stop .. py:property:: diffusion_coef .. py:property:: uncertain_factor .. py:attribute:: _schema .. py:method:: __repr__() Return repr(self). .. py:class:: IceAwareRandomMover(ice_concentration=None, **kwargs) Bases: :py:obj:`RandomMover` "Random Walk" diffusion mover Moves the elements each time step in a random direction, according to the specified diffusion coefficient. :param diffusion_coef: Diffusion coefficient for random diffusion. Default is 100,000 cm2/sec :type diffusion_coef: float or integer in units of cm^2/s :param uncertain_factor: Uncertainty factor. Default is 2.0 Remaining kwargs are passed onto :class:`gnome.movers.Mover` __init__ See Mover documentation for remaining valid kwargs. .. py:attribute:: _schema .. py:attribute:: _req_refs .. py:method:: from_netCDF(filename=None, dataset=None, grid_topology=None, units=None, time=None, ice_concentration=None, grid=None, grid_file=None, data_file=None, **kwargs) :classmethod: .. py:method:: get_move(sc, time_step, model_time_datetime) Base implementation of Cython wrapped C++ movers Override for things like the PointWindMover since it has a different implementation :param sc: spill_container.SpillContainer object :param time_step: time step in seconds :param model_time_datetime: current model time as datetime object .. py:class:: RandomMover3D(vertical_diffusion_coef_above_ml=5, vertical_diffusion_coef_below_ml=0.11, horizontal_diffusion_coef_above_ml=100000, horizontal_diffusion_coef_below_ml=126, mixed_layer_depth=10.0, surface_is_allowed=False, **kwargs) Bases: :py:obj:`gnome.movers.CyMover` This mover class inherits from CyMover and contains CyRandomMover3D The real work is done by CyRandomMover3D. CyMover sets everything up that is common to all movers. :param vertical_diffusion_coef_above_ml: Vertical diffusion coefficient for random diffusion above the mixed layer. Default is 5 cm2/s :param vertical_diffusion_coef_below_ml: Vertical diffusion coefficient for random diffusion below the mixed layer. Default is .11 cm2/s :param mixed_layer_depth: Mixed layer depth. Default is 10 meters :param horizontal_diffusion_coef_above_ml: Horizontal diffusion coefficient for random diffusion above the mixed layer. Default is 100000 cm2/s :param horizontal_diffusion_coef_below_ml: Horizontal diffusion coefficient for random diffusion below the mixed layer. Default is 126 cm2/s :param surface_is_allowed: Vertical diffusion will ignore surface particles if this is True. Default is False. Remaining kwargs are passed onto Mover's __init__ using super. See Mover documentation for remaining valid kwargs. .. py:property:: horizontal_diffusion_coef_above_ml .. py:property:: horizontal_diffusion_coef_below_ml .. py:property:: vertical_diffusion_coef_above_ml .. py:property:: vertical_diffusion_coef_below_ml .. py:property:: mixed_layer_depth .. py:property:: surface_is_allowed .. py:attribute:: _schema .. py:method:: __repr__() Return repr(self). .. 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:: 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 .. 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:: RiseVelocityMover(**kwargs) Bases: :py:obj:`gnome.movers.CyMover` This mover class inherits from CyMover and contains CyRiseVelocityMover The real work is done by CyRiseVelocityMover. CyMover sets everything up that is common to all movers. Uses super to invoke base class __init__ method. Optional parameters (kwargs) used to initialize CyRiseVelocityMover :param water_density: Default is 1020 kg/m3 :param water_viscosity: Default is 1.e-6 Remaining kwargs are passed onto Mover's __init__ using super. See Mover documentation for remaining valid kwargs. .. py:attribute:: _schema .. py:method:: __repr__() .. todo:: We probably want to include more information. .. py:method:: get_move(sc, time_step, model_time_datetime) Override base class functionality because mover has a different get_move signature :param sc: an instance of the gnome.SpillContainer class :param time_step: time step in seconds :param model_time_datetime: current time of the model as a date time object .. py:class:: TamocRiseVelocityMover(*args, **kwargs) Bases: :py:obj:`RiseVelocityMover` The only thing this adds (so far) are droplet_diameter and density array types Uses super to invoke base class __init__ method. Optional parameters (kwargs) used to initialize CyRiseVelocityMover :param water_density: Default is 1020 kg/m3 :param water_viscosity: Default is 1.e-6 Remaining kwargs are passed onto Mover's __init__ using super. See Mover documentation for remaining valid kwargs. .. py:class:: WindMover(wind=None, time_offset=0, uncertain_duration=3.0 * 3600, uncertain_time_delay=0, uncertain_speed_scale=2.0, uncertain_angle_scale=0.4, scale_value=1, default_num_method='RK2', filename=None, **kwargs) Bases: :py:obj:`gnome.movers.movers.PyMover` WindMover implemented in Python. Uses the .wind attribute to move particles. The .at() interface is expected on the .wind attribute Initialize a WindMover :param wind: Environment object representing wind to be used. :type wind: Any Wind or Wind-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 wind 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_speed_scale: Scale for uncertainty of wind speed :param uncertain_angle_scale: Scale for uncertainty of wind angle :param time_offset: Time zone shift if data is in GMT :param num_method: Numerical method for calculating movement delta. Choices:('Euler', 'RK2', 'RK4') Default: RK2 .. py:property:: data_start .. py:property:: data_stop .. py:attribute:: _schema .. py:attribute:: _ref_as :value: 'py_wind_movers' .. py:attribute:: _req_refs .. py:method:: from_netCDF(filename=None, time_offset=0, scale_value=1, uncertain_duration=3 * 3600, uncertain_time_delay=0, uncertain_speed_scale=2.0, uncertain_angle_scale=0.4, default_num_method='RK2', **kwargs) :classmethod: .. py:method:: prepare_for_model_run() reset uncertainty .. py:method:: prepare_for_model_step(sc, time_step, model_time_datetime) Call base class method using super Also updates windage for this timestep :param sc: an instance of gnome.spill_container.SpillContainer class :param time_step: time step in seconds :param model_time_datetime: current time of model as a date time object .. py:method:: model_step_is_done(sc) remove any off map les .. 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:: 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, time_step) add uncertainty :param deltas: the movement for the current time step .. 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: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:: mover_schemas