gnome.movers.py_current_movers
Attributes
Classes
CurrentMover implemented in Python. Uses the .current attribute to move particles. |
Functions
|
Helper function to load a gridded current from a file and create a CurrentMover |
Module Contents
- gnome.movers.py_current_movers.PyCurrentMoverSchema
- class gnome.movers.py_current_movers.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:
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 – (seconds) how often a given uncertain element gets reset in seconds
uncertain_time_delay – when the uncertainty kicks in in seconds from model start
uncertain_cross – Scale for uncertainty perpendicular to the flow
uncertain_along – Scale for uncertainty parallel to the flow
default_num_method – Numerical method for calculating movement delta. Choices:(‘Euler’, ‘RK2’, ‘RK4’) Default: RK2
- property filename
- current = None
- scale_value = 1
- uncertain_along = 0.5
- uncertain_cross = 0.25
- uncertain_duration = 86400
- uncertain_time_delay = 0
- model_time = 0
- spill_type = 0
- is_first_step = False
- time_uncertainty_was_set = 0
- shape = (2,)
- classmethod 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)
Function for creating a CurrentMover from a file
- property data_start
- property data_stop
- 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
- prepare_for_model_run()
reset uncertainty
- prepare_for_model_step(sc, time_step, model_time_datetime)
add uncertainty
- Parameters:
sc – an instance of gnome.spill_container.SpillContainer class
time_step (int) – the model time step in seconds
model_time_datetime – the current model time as a datetime object
- model_step_is_done(sc)
remove any off map les
- Parameters:
sc – an instance of gnome.spill_container.SpillContainer class
- 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