DiagnosticState#

class fridom.nonhydro.DiagnosticState(mset: ModelSettingsBase, field_list: list[ScalarField] | OrderedDict[str, ScalarField] | None = None, vector_dim: int | None = None, **kwargs: any)[source]#

Bases: VectorField

The diagnostic state vector class for the nonhydrostatic model.

Description#

The default scalar fields of the diagnostic state vector are:

  • p: Pressure.

  • div: Divergence.

__init__(mset: ModelSettingsBase, field_list: list[ScalarField] | OrderedDict[str, ScalarField] | None = None, vector_dim: int | None = None, **kwargs: any) None#

Methods

__init__(mset[, field_list, vector_dim])

abs()

Map the field by taking the absolute value (\(|f|\)).

apply_elementwise(vector_field, op)

Apply an operation elementwise to the vector field.

apply_water_mask()

Apply a water mask to the field.

conj()

Compute the complex conjugate.

cumulative_integral(axis[, direction])

Compute the cumulative integral along an axis.

diff(axis[, order])

Compute the partial derivative along an axis.

dot(other)

Compute the dot product with another field.

extend(topo)

Extend the field in the specified directions.

fft([padding])

Perform a Fast Fourier Transform (FFT) on the field.

from_netcdf(mset, path)

Create a field from a NetCDF file.

from_xarray(mset, ds)

Create a field from an xarray object.

grad([axes])

Compute the gradient.

has_nan()

Check if the field contains NaN values.

ifft([padding])

Perform an Inverse Fast Fourier Transform (IFFT) on the field.

integrate([axes])

Global integral of the Field in specified axes.

laplacian([axes])

Compute the Laplacian.

max([axes])

Maximum value of the Field over the whole domain.

mean([axes])

Global mean of the Field in specified axes.

min([axes])

Minimum value of the Field over the whole domain.

norm_l2()

Calculate the L2 norm of the field.

norm_of_diff(other)

Norm of difference between two vector fields.

project(p_vec, q_vec)

Project a Vector Field onto a (spectral) vector.

set_random([seed])

Set the field to random values.

sum([axes])

Sum of the Field over the whole domain in the specified axes.

sync()

Synchronize the field across all MPI ranks and apply boundary conditions.

to_netcdf(path)

Save the field to a NetCDF file.

Attributes

div

The divergence field.

field_list

The list of scalar fields.

fields

The dictionary of scalar fields.

grid

The grid object.

info

Dictionary with information about the field.

is_constant

Flag indicating whether the field is constant.

is_spectral

Flag indicating whether the field is in spectral space.

mset

The model settings.

p

The pressure field.

vector_dim

The vector dimension.

xr

The xarray representation of the field.

xrs

Convert a slice of the field to an xarray object.

property p: ScalarField#

The pressure field.

property div: ScalarField#

The divergence field.