midgard.writers

Framework for writing output in different formats

Description:

Each output format / output destination should be defined in a separate .py-file. The function inside the .py-file that should be called need to be decorated with the :func:~midgard.dev.plugins.register decorator as follows::

from midgard.dev import plugins

@plugins.register
def write_as_fancy_format(arg_1, arg_2):
    ...

names()

Full name: midgard.writers.names

Signature: () -> List[str]

List the names of the available writers

Returns:

List of strings with the names of the available writers.

write()

Full name: midgard.writers.write

Signature: (writer:str, **writer_args:Any) -> None

Call one writer

Args:

midgard.writers._writers

Basic functionality for writing files

Description:

This module contains functions for writing files.

get_existing_fields()

Full name: midgard.writers._writers.get_existing_fields

Signature: (dset:'Dataset', writers_in:Tuple[_ForwardRef('WriterField'), ...]) -> Tuple[_ForwardRef('WriterField'), ...]

Get existing writer fields, which are given in Dataset.

Args:

Returns:

Existing writer fields

get_field()

Full name: midgard.writers._writers.get_field

Signature: (dset:'Dataset', field:str, attrs:Tuple[str], unit:str) -> numpy.ndarray

Get field values of a Dataset specified by the field attributes

If necessary the unit of the data fields are corrected to the defined 'output' unit.

Args:

Returns:

Array with Dataset field values

get_header()

Full name: midgard.writers._writers.get_header

Signature: (fields:List[str], pgm_version:Union[NoneType, str]=None, run_by:str='', summary:Union[NoneType, str]=None, add_description:Union[NoneType, str]=None) -> List[str]

Get header

Args:

Returns:

Header lines