opendrift.models.openoil.adios.models.common.measurement

Generic Measurement Types

These are structures that handle an individual measurment:

They have a value, a unit type and a unit.

They can be converted to other units if need be.

They can accommodate a single value, or a range of values

They can also accommodate a standard deviation and number of replicates.

Module Contents

Classes

Temperature

Data structure to hold a value with a unit

Unitless

This is a type for data with no unit at all.

Dimensionless

This is a type that can be converted to generic fractional amounts,

Time

Data structure to hold a value with a unit

Length

Data structure to hold a value with a unit

Mass

Data structure to hold a value with a unit

Concentration

Data structure to hold a value with a unit

MassFraction

Data structure to hold a value with a unit

VolumeFraction

Data structure to hold a value with a unit

AnyUnit

This is a type for data that could be any unit_type

Density

Data structure to hold a value with a unit

DynamicViscosity

Data structure to hold a value with a unit

KinematicViscosity

Data structure to hold a value with a unit

Pressure

Data structure to hold a value with a unit

NeedleAdhesion

Data structure to hold a value with a unit

InterfacialTension

Data structure to hold a value with a unit

AngularVelocity

Data structure to hold a value with a unit

class opendrift.models.openoil.adios.models.common.measurement.Temperature[source]

Bases: MeasurementBase

Data structure to hold a value with a unit

This accommodates both a single value and a range of values

There is some complexity here, so everything is optional

NOTE: another reason for everything to be optional is that when working with the web client, empty measurements can be created and saved before the values are filled in.

NOTES:

If there is a value, there should be no min_value or max_value If there is only a min or max, then it is interpreted as greater than or less than

There needs to be validation on that!

Fixme: maybe there could be a default unit for each unit type?

unit_type = 'temperature'
fixCK = False
__post_init__()[source]

this here so that it can get overidden in subclasses

it appears dataclasses don’t add it to __init__ unless it’s here

convert_to(new_unit)[source]

Convert this Measurement object to the specified new unit

The object is mutated in place.

If the conversion can not be performed, an Exception will be raised, and the object not altered.

This will also return the object (self) – but that is a deprecated feature – do not use it!

If you want a new object, use converted_to instead

validate()[source]
fix_C_K()[source]

This is a bit of a kludge:

The correct conversion from C to K is 273.16

But a lot of data sources (notably the ADIOS2 database) used 273.0.

So we end up with temps like: -0.15 C instead of 0.0 C This function will “correct” that.

Note: it also converts to C

class opendrift.models.openoil.adios.models.common.measurement.Unitless[source]

Bases: MeasurementBase

This is a type for data with no unit at all.

unit_type = 'unitless'
convert_to(*args, **kwargs)[source]

Convert this Measurement object to the specified new unit

The object is mutated in place.

If the conversion can not be performed, an Exception will be raised, and the object not altered.

This will also return the object (self) – but that is a deprecated feature – do not use it!

If you want a new object, use converted_to instead

class opendrift.models.openoil.adios.models.common.measurement.Dimensionless[source]

Bases: MeasurementBase

This is a type that can be converted to generic fractional amounts, but does not refer to a particular measurable quantity.

unit_type = 'dimensionless'
class opendrift.models.openoil.adios.models.common.measurement.Time[source]

Bases: MeasurementBase

Data structure to hold a value with a unit

This accommodates both a single value and a range of values

There is some complexity here, so everything is optional

NOTE: another reason for everything to be optional is that when working with the web client, empty measurements can be created and saved before the values are filled in.

NOTES:

If there is a value, there should be no min_value or max_value If there is only a min or max, then it is interpreted as greater than or less than

There needs to be validation on that!

Fixme: maybe there could be a default unit for each unit type?

unit_type = 'time'
class opendrift.models.openoil.adios.models.common.measurement.Length[source]

Bases: MeasurementBase

Data structure to hold a value with a unit

This accommodates both a single value and a range of values

There is some complexity here, so everything is optional

NOTE: another reason for everything to be optional is that when working with the web client, empty measurements can be created and saved before the values are filled in.

NOTES:

If there is a value, there should be no min_value or max_value If there is only a min or max, then it is interpreted as greater than or less than

There needs to be validation on that!

Fixme: maybe there could be a default unit for each unit type?

unit_type = 'length'
class opendrift.models.openoil.adios.models.common.measurement.Mass[source]

Bases: MeasurementBase

Data structure to hold a value with a unit

This accommodates both a single value and a range of values

There is some complexity here, so everything is optional

NOTE: another reason for everything to be optional is that when working with the web client, empty measurements can be created and saved before the values are filled in.

NOTES:

If there is a value, there should be no min_value or max_value If there is only a min or max, then it is interpreted as greater than or less than

There needs to be validation on that!

Fixme: maybe there could be a default unit for each unit type?

unit_type = 'mass'
class opendrift.models.openoil.adios.models.common.measurement.Concentration[source]

Bases: MeasurementBase

Data structure to hold a value with a unit

This accommodates both a single value and a range of values

There is some complexity here, so everything is optional

NOTE: another reason for everything to be optional is that when working with the web client, empty measurements can be created and saved before the values are filled in.

NOTES:

If there is a value, there should be no min_value or max_value If there is only a min or max, then it is interpreted as greater than or less than

There needs to be validation on that!

Fixme: maybe there could be a default unit for each unit type?

unit_type = 'concentration'
class opendrift.models.openoil.adios.models.common.measurement.MassFraction[source]

Bases: MeasurementBase

Data structure to hold a value with a unit

This accommodates both a single value and a range of values

There is some complexity here, so everything is optional

NOTE: another reason for everything to be optional is that when working with the web client, empty measurements can be created and saved before the values are filled in.

NOTES:

If there is a value, there should be no min_value or max_value If there is only a min or max, then it is interpreted as greater than or less than

There needs to be validation on that!

Fixme: maybe there could be a default unit for each unit type?

unit_type = 'massfraction'
class opendrift.models.openoil.adios.models.common.measurement.VolumeFraction[source]

Bases: MeasurementBase

Data structure to hold a value with a unit

This accommodates both a single value and a range of values

There is some complexity here, so everything is optional

NOTE: another reason for everything to be optional is that when working with the web client, empty measurements can be created and saved before the values are filled in.

NOTES:

If there is a value, there should be no min_value or max_value If there is only a min or max, then it is interpreted as greater than or less than

There needs to be validation on that!

Fixme: maybe there could be a default unit for each unit type?

unit_type = 'volumefraction'
class opendrift.models.openoil.adios.models.common.measurement.AnyUnit(*args, **kwargs)[source]

Bases: MeasurementBase

This is a type for data that could be any unit_type

__post_init__()[source]

We don’t need the post_init in this case

overriding it to disable it

__eq__(other)[source]

So as not to be pedantic with the class – if the values all match

class opendrift.models.openoil.adios.models.common.measurement.Density[source]

Bases: MeasurementBase

Data structure to hold a value with a unit

This accommodates both a single value and a range of values

There is some complexity here, so everything is optional

NOTE: another reason for everything to be optional is that when working with the web client, empty measurements can be created and saved before the values are filled in.

NOTES:

If there is a value, there should be no min_value or max_value If there is only a min or max, then it is interpreted as greater than or less than

There needs to be validation on that!

Fixme: maybe there could be a default unit for each unit type?

unit_type = 'density'
class opendrift.models.openoil.adios.models.common.measurement.DynamicViscosity[source]

Bases: MeasurementBase

Data structure to hold a value with a unit

This accommodates both a single value and a range of values

There is some complexity here, so everything is optional

NOTE: another reason for everything to be optional is that when working with the web client, empty measurements can be created and saved before the values are filled in.

NOTES:

If there is a value, there should be no min_value or max_value If there is only a min or max, then it is interpreted as greater than or less than

There needs to be validation on that!

Fixme: maybe there could be a default unit for each unit type?

unit_type = 'dynamicviscosity'
class opendrift.models.openoil.adios.models.common.measurement.KinematicViscosity[source]

Bases: MeasurementBase

Data structure to hold a value with a unit

This accommodates both a single value and a range of values

There is some complexity here, so everything is optional

NOTE: another reason for everything to be optional is that when working with the web client, empty measurements can be created and saved before the values are filled in.

NOTES:

If there is a value, there should be no min_value or max_value If there is only a min or max, then it is interpreted as greater than or less than

There needs to be validation on that!

Fixme: maybe there could be a default unit for each unit type?

unit_type = 'kinematicviscosity'
class opendrift.models.openoil.adios.models.common.measurement.Pressure[source]

Bases: MeasurementBase

Data structure to hold a value with a unit

This accommodates both a single value and a range of values

There is some complexity here, so everything is optional

NOTE: another reason for everything to be optional is that when working with the web client, empty measurements can be created and saved before the values are filled in.

NOTES:

If there is a value, there should be no min_value or max_value If there is only a min or max, then it is interpreted as greater than or less than

There needs to be validation on that!

Fixme: maybe there could be a default unit for each unit type?

unit_type = 'pressure'
class opendrift.models.openoil.adios.models.common.measurement.NeedleAdhesion[source]

Bases: MeasurementBase

Data structure to hold a value with a unit

This accommodates both a single value and a range of values

There is some complexity here, so everything is optional

NOTE: another reason for everything to be optional is that when working with the web client, empty measurements can be created and saved before the values are filled in.

NOTES:

If there is a value, there should be no min_value or max_value If there is only a min or max, then it is interpreted as greater than or less than

There needs to be validation on that!

Fixme: maybe there could be a default unit for each unit type?

unit_type = 'needleadhesion'
class opendrift.models.openoil.adios.models.common.measurement.InterfacialTension[source]

Bases: MeasurementBase

Data structure to hold a value with a unit

This accommodates both a single value and a range of values

There is some complexity here, so everything is optional

NOTE: another reason for everything to be optional is that when working with the web client, empty measurements can be created and saved before the values are filled in.

NOTES:

If there is a value, there should be no min_value or max_value If there is only a min or max, then it is interpreted as greater than or less than

There needs to be validation on that!

Fixme: maybe there could be a default unit for each unit type?

unit_type = 'interfacialtension'
class opendrift.models.openoil.adios.models.common.measurement.AngularVelocity[source]

Bases: MeasurementBase

Data structure to hold a value with a unit

This accommodates both a single value and a range of values

There is some complexity here, so everything is optional

NOTE: another reason for everything to be optional is that when working with the web client, empty measurements can be created and saved before the values are filled in.

NOTES:

If there is a value, there should be no min_value or max_value If there is only a min or max, then it is interpreted as greater than or less than

There needs to be validation on that!

Fixme: maybe there could be a default unit for each unit type?

unit_type = 'angularvelocity'