FieldMetadata#

class fridom.framework.field_metadata.FieldMetadata(name: str = 'unnamed', long_name: str = 'Unnamed', units: str = 'n/a', nc_attrs: dict | None = None, is_spectral: bool = False, _topo: tuple[bool] | None = None, position: ~fridom.framework.grid.position.Position | None = None, _bc_types: tuple[~fridom.framework.grid.boundary_type.BCType] | None = None, _flags: dict = <factory>)[source]#

Bases: object

Metadata for the ScalarField.

Description#

The FieldMetadata class contains all metadata for the ScalarField. This includes the name, long name, units, and additional attributes for the NetCDF file or xarray. The metadata also contains information about the position of the ScalarField on the grid, the topology, and the boundary conditions.

Parameters#

namestr (default “unnamed”)

Name of the ScalarField

long_namestr (default “Unnamed”)

Long name of the ScalarField

unitsstr (default “n/a”)

Units of the ScalarField

nc_attrsdict | None (default None)

Additional attributes for the NetCDF file or xarray

is_spectralbool (default False)

True if the ScalarField should be initialized in spectral space

topolist[bool] | None (default None)

Topology of the ScalarField. If None, the ScalarField is assumed to be fully extended in all directions. If a list of booleans is given, the ScalarField has no extend in the directions where the corresponding entry is False.

positionfr.grid.Position | None (default None)

Position of the ScalarField on the grid

bc_typestuple[BCType] | None (default None)

Tuple of BCType objects that specify the type of boundary condition in each direction. If None, the default boundary conditions is Neumann.

_flagsdict (default {“NO_ADV”: False,

“ENABLE_MIXING”: False, “ENABLE_FRICTION”: False})

Dictionary with flag options for the ScalarField

__init__(name: str = 'unnamed', long_name: str = 'Unnamed', units: str = 'n/a', nc_attrs: dict | None = None, is_spectral: bool = False, _topo: tuple[bool] | None = None, position: ~fridom.framework.grid.position.Position | None = None, _bc_types: tuple[~fridom.framework.grid.boundary_type.BCType] | None = None, _flags: dict = <factory>) None#

Methods

__init__([name, long_name, units, nc_attrs, ...])

copy()

Create a deep copy of the FieldMetadata.

from_serializable(data)

Create a FieldMetadata object from a serializable dictionary.

set_default(mset)

Set None values to default values.

to_serializable()

Convert the FieldMetadata to a serializable dictionary.

Attributes

bc_types

The boundary condition types for the ScalarField.

flags

Dictionary with flag options for the ScalarField.

is_spectral

long_name

name

nc_attrs

position

topo

The topology of the Scalar Field.

units

name: str = 'unnamed'#
long_name: str = 'Unnamed'#
units: str = 'n/a'#
nc_attrs: dict | None = None#
is_spectral: bool = False#
position: Position | None = None#
set_default(mset: ModelSettingsBase) None[source]#

Set None values to default values.

copy() FieldMetadata[source]#

Create a deep copy of the FieldMetadata.

to_serializable() dict[source]#

Convert the FieldMetadata to a serializable dictionary.

classmethod from_serializable(data: dict) FieldMetadata[source]#

Create a FieldMetadata object from a serializable dictionary.

property topo: tuple[bool]#

The topology of the Scalar Field.

Description#

The topology of a scalar field determines whether the field lives in a certain direction. If the topology is True in a direction, the field is fully extended in this direction, if it is False, the field has no extend in this direction.

property bc_types: tuple[BCType] | None#

The boundary condition types for the ScalarField.

property flags: dict#

Dictionary with flag options for the ScalarField.