gnome.movers.py_wind_movers

Wind Movers and associated helper functions. This module has no compiled C dependency

Module Contents

Classes

WindMover

WindMover implemented in Python. Uses the .wind attribute to move particles.

Functions

grid_wind_mover(filename[, wind_kwargs])

Helper function to load a gridded wind from a file and create a WindMover

Attributes

PyWindMoverSchema

PyWindMover

gnome.movers.py_wind_movers.PyWindMoverSchema
class gnome.movers.py_wind_movers.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: 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.

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

  • scale_value – Value to scale wind data

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

  • uncertain_time_delay – when does the uncertainly kick in.

  • uncertain_speed_scale – Scale for uncertainty of wind speed

  • uncertain_angle_scale – Scale for uncertainty of wind angle

  • time_offset – Time zone shift if data is in GMT

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

property data_start
property data_stop
_schema
_ref_as = 'py_wind_movers'
_req_refs
classmethod 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)
prepare_for_model_run()

reset uncertainty

prepare_for_model_step(sc, time_step, model_time_datetime)

Call base class method using super Also updates windage for this timestep

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

  • time_step – time step in seconds

  • model_time_datetime – current time of model as a date time object

model_step_is_done(sc)

remove any off map les

get_bounds()

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

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, time_step)

add uncertainty

Parameters:

deltas – the movement for the current time step

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

gnome.movers.py_wind_movers.PyWindMover
gnome.movers.py_wind_movers.grid_wind_mover(filename, wind_kwargs=None, *args, **kwargs)

Helper function to load a gridded wind from a file and create a WindMover

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

  • wind_kwargs (dict) – keyword arguments for the GridWind object. OPTIONAL