gnome.environment.water

The Water environment object. The Water object defines the Water conditions for the spill

TEmerature, Salinity, etc.

NOTE: this is simple, constant water conditions – at some point, we will make it a proper Environment object

Classes

WaterProperty

Base class for making an Environment object for a water property

Temperature

Base class for making an Environment object for a water property

Salinity

Base class for making an Environment object for a water property

Sediment

Base class for making an Environment object for a water property

WaveHeight

Base class for making an Environment object for a water property

Water

Define the environmental conditions for a spill, like water_temperature,

Functions

make_water_property(property, default_unit)

Module Contents

class gnome.environment.water.WaterProperty(water)

Bases: gnome.environment.environment.Environment

Base class for making an Environment object for a water property

These one uses a Water object for the data itself

Needs to be wrapped with the make_water_property decorator to be functional

base class for environment objects

Parameters:

name=None

data_start
data_stop
water
gnome.environment.water.make_water_property(property, default_unit)
class gnome.environment.water.Temperature(water)

Bases: WaterProperty

Base class for making an Environment object for a water property

These one uses a Water object for the data itself

Needs to be wrapped with the make_water_property decorator to be functional

base class for environment objects

Parameters:

name=None

class gnome.environment.water.Salinity(water)

Bases: WaterProperty

Base class for making an Environment object for a water property

These one uses a Water object for the data itself

Needs to be wrapped with the make_water_property decorator to be functional

base class for environment objects

Parameters:

name=None

class gnome.environment.water.Sediment(water)

Bases: WaterProperty

Base class for making an Environment object for a water property

These one uses a Water object for the data itself

Needs to be wrapped with the make_water_property decorator to be functional

base class for environment objects

Parameters:

name=None

class gnome.environment.water.WaveHeight(water)

Bases: WaterProperty

Base class for making an Environment object for a water property

These one uses a Water object for the data itself

Needs to be wrapped with the make_water_property decorator to be functional

base class for environment objects

Parameters:

name=None

class gnome.environment.water.Water(temperature=300.0, salinity=35.0, sediment=0.005, wave_height=None, fetch=None, units=None, name='Water', **kwargs)

Bases: gnome.environment.environment.Environment

Define the environmental conditions for a spill, like water_temperature,

Single values for all all time and space

Defined in a Serializable class since user will need to set/get some of these properties through the client

Includes attributes with a Environment interface:

Temperature Salinity Sediment WaveHeight

Example: water.Temperature.at(points, time, unit)

Assume units are SI for all properties. ‘units’ attribute assumes SI by default. This can be changed, but initialization takes SI.

Units is dict, with some subset of these keys:

{
'temperature': 'K',
'salinity': 'psu',
'sediment': 'kg/m^3',
'wave_height': 'm',
'fetch': 'm',
}

So to set units of temperature to F:

units = {'temperature': 'F'}

temperature = 300.0
salinity = 35.0
sediment = 0.005
wave_height = None
fetch = None
kinematic_viscosity = 1e-06
name = 'Water'

define as property in base class so all objects will have a name by default

property units
Temperature
Salinity
Sediment
WaveHeight
property data_start

The Water object doesn’t directly manage a time series of data, so it will not have a data range. We will just return an infinite range for Water.

property data_stop
get(attr, unit=None)

return value in desired unit. If None, then return the value in SI units. The user_unit are given in ‘units’ attribute and each attribute carries the value in as given in these user_units.

set(attr, value, unit)

provide a corresponding set method that requires value and units The attributes can be directly set. This function just sets the desired property and also updates the units dict

property density

return the density based on water salinity and temperature. The salinity is in ‘psu’; it is not being converted to absolute salinity units - for our purposes, this is sufficient. Using gsw.rho() internally which expects salinity in absolute units.