gnome.maps.tideflat_map

tideflat_map.py

A map that handles tide flats:

It sets the oil_status code to “on_tideflat” when particles are on a tide flat.

Then the movers will not move the particles while that flag is set.

It is set back to in_water when the water depth indicates the tide flat is no longer a tide flat.

Module Contents

Classes

TideflatMap

Checks for tidal flats, and sets and unsets the on_tidalflat

TideflatBase

Base class for a Tideflat object to be used with TideflatBase

SimpleTideflat

Simple Tideflat implementation for testing and demo

class gnome.maps.tideflat_map.TideflatMap(land_map, tideflat)

Bases: gnome.gnomeobject.GnomeId

Checks for tidal flats, and sets and unsets the on_tidalflat oil_status code appropriately.

Not sub-classed from a GnomeMap, as it delegates to the passed-in map instead

initialize a TideflatMap

Parameters:
  • land_map – A usual GnomeMap object – for land-water, etc. It will be used to do beaching/refloating before the tidal flat is checked

  • tideflat – A tide-flat object that indicates when the water depth is zero – or other indicator that the element is on a tideflat

__getattr__(name)

Delegate everything that is not overridden to the enclosed GnomeMap

beach_elements(spill_container, model_time=None)
refloat_elements(spill_container, time_step, model_time=None)

Checks whether elements that were on a tidal flat still are. If not, removes the flag

Then passes off the the enclosed map to do the refloat logic

Parameters:

spill_container (gnome.spill_container.SpillContainer) – current SpillContainer

class gnome.maps.tideflat_map.TideflatBase(name=None, _appearance=None, *args, **kwargs)

Bases: gnome.gnomeobject.GnomeId

Base class for a Tideflat object to be used with TideflatBase

Subclasses should override the is_dry() method.

is_dry(points, time)
Parameters:
  • points (Nx3 numpy array or equivalent.) – locations for testing if the locations are dry.are

  • time – time at which to check for wet/dry

Returns:

numpy array of bools one for each point

This should be over-ridden – this version always returns FAlse for all points

is_wet(points, time)
class gnome.maps.tideflat_map.SimpleTideflat(bounds, dry_start, dry_end)

Bases: TideflatBase

Simple Tideflat implementation for testing and demo

For a real case, a subclass of TideflatBase should be made that implements these methods in a meaningful way

This provides a single polygon describing a tidal flat

The flat is initially wet, then dry at a given time, then wet again after that.

Just enough for testing.

Parameters:

bounds – polygon around the tidal flat

Dry_start:

initial time of flat being dry

Dry_end:

end time of flat being dry

is_dry(points, model_time)
Parameters:
  • points (Nx3 numpy array or equivalent.) – locations for testing if the locations are dry.

  • time – time at which to check for wet/dry

Returns:

numpy array of bools one for each point