Internals

Warning

The internals of pymech are described here for development purposes and is not part of the public API.

pymech.log

Defines the pymech logger (variable logger). The logging level can be changed to debug level by setting:

export PYMECH_DEBUG=true

before importing pymech.

For coloured logging:

pip install rich

pymech.dataset

class pymech.dataset.PymechXarrayBackend[source]
guess_can_open(filename_or_obj)[source]

Backend open_dataset method used by Xarray in open_dataset().

open_dataset(filename_or_obj, *, drop_variables=None)[source]

Backend open_dataset method used by Xarray in open_dataset().

class pymech.dataset._NekDataStore(elem)[source]

Xarray store for a Nek field element.

Parameters:

elem (pymech.core.Elem) – A Nek5000 element.

get_variables()[source]

Generate an xarray dataset from a single element.

meshgrid_to_dim(mesh)[source]

Reverse of np.meshgrid. This method extracts one-dimensional coordinates from a cubical array format for every direction

pymech.dataset._open_nek_dataset(path, drop_variables=None)[source]

Interface for converting Nek field files into xarray datasets.

pymech.dataset.can_open_nek_dataset(path)[source]

A regular expression check of the file extension.

Hint

  • Would not match: .f90 .f .fort .f0000

  • Would match: .fld .f00001 .f12345