dubfi.fluxes.dataprovider_mpi

MPI parent module for flux inversion using in-situ data.

This module provides tools for orchestrating the MPI parallelized flux inversion. Worker processes read data and configuration from files, controlled by this module.

Changed in version 0.1.2: (renamed module)

Added in version 0.1.0: (initial release)

Classes

MpiInsituPostR

MPI parent class for R matrix generated from in-situ observations.

MpiDistMecReader

MPI parent data provider.

Functions

segments_from_config(config, coords, num_segments[, ...])

Compute segments for distributing data to MPI worker processes.

configs_agree(cfg1, cfg2)

Check whether two inversion configurations are compatible.

Module Contents

dubfi.fluxes.dataprovider_mpi.segments_from_config(config, coords, num_segments, debug_plot=False)

Compute segments for distributing data to MPI worker processes.

Parameters:
  • config (dict) – inversion configuration

  • coords (dict) – coordinates as provided by dubfi.fluxes.readobs.coordinates_from_config()

  • num_segments (int) – number of segments (must be positive)

  • debug_plot (bool, default=False) – show a plot to illustrate the result

Returns:

collection of segments

Return type:

Segments

dubfi.fluxes.dataprovider_mpi.configs_agree(cfg1, cfg2)

Check whether two inversion configurations are compatible.

Parameters:
  • cfg1 (dict)

  • cfg2 (dict)

Return type:

bool

class dubfi.fluxes.dataprovider_mpi.MpiInsituPostR(seg)

Bases: dubfi.linalg.mpi_parent.MpiDensePostR

MPI parent class for R matrix generated from in-situ observations.

This class seems trivial, but the corresponding worker class differs from the one for MpiDensePostR.

Parameters:

seg (dubfi.linalg.segments.Segments)

class dubfi.fluxes.dataprovider_mpi.MpiDistMecReader(seg)

Bases: dubfi.linalg.mpi_parent.MpiObj, dubfi.fluxes.dataprovider.AbstractDataProvider

MPI parent data provider.

Prepare the inversion including worker processes.

Parameters:

seg (dubfi.linalg.segments.Segments)

property config: dict

Inversion configuration.

Return type:

dict

property coords: dict

Data coordinates, see dubfi.fluxes.readobs.coordinates_from_config().

Return type:

dict

classmethod fromconfig(config, target_cfg, num_segments=-1)

Create from inversion configuration.

This reads the data and prepares the inversion. The worker processes are also initialized, but they must be created before using CTX.init().

Parameters:
  • config (dict) – inversion configuration

  • target_cfg (str) – path to target configuration file. The configuration will be written to this file path for the worker processes.

  • num_segments (int, optional) – number of segments, defaults to the number of available MPI worker processes

get_Y()

Create Y: observation or observation minus model vector.

Return type:

dubfi.linalg.mpi_parent.MpiVector

get_H()

Create H: parametrized model vector (“observation operator”).

Return type:

dubfi.linalg.mpi_parent.MpiLinParamVector

get_R()

Create R: parametrized error covariance matrix of model data mismatch.

Return type:

MpiInsituPostR