:py:mod:`gnome.environment.water` ================================= .. py:module:: gnome.environment.water .. autoapi-nested-parse:: 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 ~~~~~~~ .. autoapisummary:: gnome.environment.water.WaterProperty gnome.environment.water.Temperature gnome.environment.water.Salinity gnome.environment.water.Sediment gnome.environment.water.WaveHeight gnome.environment.water.Water Functions ~~~~~~~~~ .. autoapisummary:: gnome.environment.water.make_water_property Attributes ~~~~~~~~~~ .. autoapisummary:: 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 gnome.environment.water._valid_sediment_units .. py:data:: _valid_temp_units .. py:data:: _valid_dist_units .. py:data:: _valid_kvis_units .. py:data:: _valid_density_units .. py:data:: _valid_salinity_units :value: ('psu',) .. py:data:: _valid_sediment_units .. py:class:: WaterProperty(water) Bases: :py:obj:`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 :param name=None: .. py:attribute:: data_start .. py:attribute:: data_stop .. py:function:: make_water_property(property, default_unit) .. py:class:: Temperature(water) Bases: :py:obj:`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 :param name=None: .. py:class:: Salinity(water) Bases: :py:obj:`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 :param name=None: .. py:class:: Sediment(water) Bases: :py:obj:`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 :param name=None: .. py:class:: WaveHeight(water) Bases: :py:obj:`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 :param name=None: .. py:class:: Water(temperature=300.0, salinity=35.0, sediment=0.005, wave_height=None, fetch=None, units=None, name='Water', **kwargs) Bases: :py:obj:`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'}`` .. py: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. .. py:property:: data_stop .. py: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. .. py:property:: units .. py:attribute:: _ref_as :value: 'water' .. py:attribute:: _field_descr .. py:attribute:: _schema .. py:attribute:: _units_type .. py:attribute:: _gnome_units .. py:attribute:: __str__ .. py:method:: __repr__() Return repr(self). .. py:method:: 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. .. py:method:: 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 .. py:method:: _get_density(salinity, temp, temp_units) :staticmethod: use lru cache so we don't recompute if temp is not changing .. py:method:: _convert_sediment_units(from_, to) used internally to convert to/from sediment units.