field_factory module

Define a factory to easily create the Field objects.

Todo

Implement SuperposedFieldMap.

class FieldFactory(default_field_map_folder: Path)

Bases: object

Create the Field and load the field maps.

default_field_map_folder: Path
_gather_files_to_load(field_maps: Collection[FieldMap]) dict[Path, list[FieldMap]]

Associate FieldMap objects using the same fields.

Parameters:

field_maps (Collection[FieldMap]) – All the FieldMap instances requiring a Field.

Returns:

A dictionary where each key is a path to a field map file, and each value is a list of FieldMap instances that use that file.

Return type:

dict[pathlib.Path, list[FieldMap]]

Raises:

NotImplementedError – If a SuperposedFieldMap is encountered, as it’s not yet supported.

_check_uniformity_of_types(to_load: dict[Path, list[FieldMap]]) None

Check that for a file name, all corresp. object have same geom.

_run(constructor: type[Field], field_map_path: Path, length_m: float, z_0: float = 0.0, **kwargs) Field

Create a single Field.

_run_kwargs(field_map: FieldMap) dict[str, Any]

Get the kwargs necessary for _run.

run_all(field_maps: Collection[FieldMap]) None

Generate the Field objects and store it in field maps.

__init__(default_field_map_folder: Path) None