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

Module Contents

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)

Attributes

_valid_temp_units

_valid_dist_units

_valid_kvis_units

_valid_density_units

_valid_salinity_units

_valid_sediment_units

gnome.environment.water._valid_temp_units
gnome.environment.water._valid_dist_units
gnome.environment.water._valid_kvis_units
gnome.environment.water._valid_density_units
gnome.environment.water._valid_salinity_units = ('psu',)
gnome.environment.water._valid_sediment_units
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
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'}

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
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.

property units
_ref_as = 'water'
_field_descr
_schema
_units_type
_gnome_units
__str__
__repr__()

Return repr(self).

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

static _get_density(salinity, temp, temp_units)

use lru cache so we don’t recompute if temp is not changing

_convert_sediment_units(from_, to)

used internally to convert to/from sediment units.