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

get_output_unit()[source]#

Get the output unit.

returns: The output unit.

Return type:

str

is_mask()[source]#

Check if the property is a mask.

Returns:

True if the property is a mask, False otherwise.

Return type:

bool

get_mask()[source]#
Returns:

A property representing this properties mask.

property magnitude: Property#
__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.

property magnitude: Scalar#
Returns:

A scalar property as the magnitude of the vector.

property log_magnitude: Scalar#
Returns:

A scalar property as the log-magnitude of the vector.

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.

property magnitude: Scalar#
Returns:

A scalar property as the frobenius norm of the matrix.

property trace: Scalar#
Returns:

A scalar property as the trace of the matrix.

Submodules#