ogstools.propertylib package#
Define easy-to-access Property classes and PropertyCollection instances.
- class ogstools.propertylib.Property[source]#
Bases:
object
Represent a property of a dataset.
- data_name: str#
The name of the property data in the dataset.
- data_unit: str = ''#
The unit of the property data in the dataset.
- output_unit: str = ''#
The output unit of the property.
- output_name: str = ''#
The output name of the property.
- mask: str = ''#
The name of the mask data in the dataset.
- func()#
The function to be applied on the data.
- Parameters:
vals (T) –
- Return type:
T
- bilinear_cmap: bool = False#
Should this property be displayed with a bilinear cmap?
- categoric: bool = False#
Does this property only have categoric values?
- property type_name#
- replace(**changes)[source]#
Create a new Property object with modified attributes.
Be aware that there is no type check safety here. So make sure, the new attributes and values are correct.
- Parameters:
changes – Attributes to be changed.
- Returns:
A copy of the Property with changed attributes.
- strip_units(vals)[source]#
Return transformed values without units.
Apply property function, convert from data_unit to output_unit and strip the unit.
- Parameters:
vals (ndarray) – The input values.
- Returns:
The values without units.
- Return type:
ndarray
- is_mask()[source]#
Check if the property is a mask.
- Returns:
True if the property is a mask, False otherwise.
- Return type:
bool
- __init__(data_name, data_unit='', output_unit='', output_name='', mask='', func=<function identity>, bilinear_cmap=False, categoric=False)#
- Parameters:
data_name (str) –
data_unit (str) –
output_unit (str) –
output_name (str) –
mask (str) –
func (Callable[[float | ndarray | PlainQuantity], float | ndarray | PlainQuantity] | Callable[[Any], Any]) –
bilinear_cmap (bool) –
categoric (bool) –
- Return type:
None
- class ogstools.propertylib.Scalar[source]#
Bases:
Property
Represent a scalar property of a dataset.
- __init__(data_name, data_unit='', output_unit='', output_name='', mask='', func=<function identity>, bilinear_cmap=False, categoric=False)#
- Parameters:
data_name (str) –
data_unit (str) –
output_unit (str) –
output_name (str) –
mask (str) –
func (Callable[[float | ndarray | PlainQuantity], float | ndarray | PlainQuantity] | Callable[[Any], Any]) –
bilinear_cmap (bool) –
categoric (bool) –
- Return type:
None
- data_name: str#
The name of the property data in the dataset.
- class ogstools.propertylib.Vector[source]#
Bases:
Property
Represent a vector property of a dataset.
Vector properties should contain either 2 (2D) or 3 (3D) components. Vector components can be accesses with brackets e.g. displacement[0]
- __init__(data_name, data_unit='', output_unit='', output_name='', mask='', func=<function identity>, bilinear_cmap=False, categoric=False)#
- Parameters:
data_name (str) –
data_unit (str) –
output_unit (str) –
output_name (str) –
mask (str) –
func (Callable[[float | ndarray | PlainQuantity], float | ndarray | PlainQuantity] | Callable[[Any], Any]) –
bilinear_cmap (bool) –
categoric (bool) –
- Return type:
None
- data_name: str#
The name of the property data in the dataset.
- class ogstools.propertylib.Matrix[source]#
Bases:
Property
Represent a matrix property of a dataset.
Matrix properties should contain either 4 (2D) or 6 (3D) components. Matrix components can be accesses with brackets e.g. stress[0]
- __init__(data_name, data_unit='', output_unit='', output_name='', mask='', func=<function identity>, bilinear_cmap=False, categoric=False)#
- Parameters:
data_name (str) –
data_unit (str) –
output_unit (str) –
output_name (str) –
mask (str) –
func (Callable[[float | ndarray | PlainQuantity], float | ndarray | PlainQuantity] | Callable[[Any], Any]) –
bilinear_cmap (bool) –
categoric (bool) –
- Return type:
None
- data_name: str#
The name of the property data in the dataset.
Submodules#
- ogstools.propertylib.presets module
- ogstools.propertylib.property module
Property
Property.data_name
Property.data_unit
Property.output_unit
Property.output_name
Property.mask
Property.func()
Property.bilinear_cmap
Property.categoric
Property.type_name
Property.replace()
Property.strip_units()
Property.get_output_unit()
Property.is_mask()
Property.get_mask()
Property.magnitude
Property.__init__()
Scalar
Vector
Matrix
- ogstools.propertylib.utils module
- ogstools.propertylib.vector2scalar module