gnome.movers.py_current_movers

Module Contents

Classes

CurrentMover

CurrentMover implemented in Python. Uses the .current attribute to move particles.

Functions

grid_current_mover(filename[, current_kwargs])

Helper function to load a gridded current from a file and create a CurrentMover

Attributes

PyCurrentMoverSchema

PyCurrentMover

gnome.movers.py_current_movers.PyCurrentMoverSchema
class gnome.movers.py_current_movers.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: 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

Parameters:
  • current (Any Current or Current-like that implements the .at() function) – Environment object representing ocean currents to be used.

  • active_range (2-tuple of datetimes) – Range of datetimes for when the mover should be active

  • scale_value – Value to scale current data

  • uncertain_duration – how often does a given uncertain element get reset in seconds

  • uncertain_time_delay – when does the uncertainly kick in in seconds

  • uncertain_cross – Scale for uncertainty perpendicular to the flow

  • uncertain_along – Scale for uncertainty parallel to the flow

  • time_offset – Time zone shift: not functional

  • default_num_method – Numerical method for calculating movement delta. Choices:(‘Euler’, ‘RK2’, ‘RK4’) Default: RK2

property filename
property data_start
property data_stop
_schema
_ref_as = 'py_current_movers'
_req_refs
classmethod 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)

Function for specifically creating a CurrentMover from a file

get_bounds()

Return a bounding box surrounding the grid data. This function exists because it is part of the top level Mover API

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

Parameters:
  • sc – an instance of gnome.spill_container.SpillContainer class

  • time_step – time step in seconds

  • model_time_datetime – current model time as datetime object

All movers must implement get_move() since that’s what the model calls

_update_uncertainty(num_les, elapsed_time)

update uncertainty

Parameters:
  • num_les – the number released so far

  • elapsed_time – time in seconds since model run started

_update_uncertainty_values(elapsed_time)

update uncertainty values

Parameters:

elapsed_time – time in seconds since model run started

_allocate_uncertainty(num_les)

add uncertainty

Parameters:

num_les – the number of les released so far

_add_uncertainty(deltas)

add uncertainty

Parameters:

deltas – the movement for the current time step

prepare_for_model_run()

reset uncertainty

prepare_for_model_step(sc, time_step, model_time_datetime)

add uncertainty

model_step_is_done(sc)

remove any off map les

gnome.movers.py_current_movers.PyCurrentMover
gnome.movers.py_current_movers.grid_current_mover(filename, current_kwargs=None, *args, **kwargs)

Helper function to load a gridded current from a file and create a CurrentMover

Parameters:
  • filename (string or Path-like') – File to create the GridCurrent object from

  • current_kwargs (dict) – keyword arguments for the GridCurrent object. OPTIONAL