geost.analysis.combine.add_model_data#
- geost.analysis.combine.add_model_data(survey_data: Collection | DataFrame, model: Dataset | DataArray, *, data_vars: str | list[str] = None, aggregate_vars: dict[str, str] = None, suffix: str = None, nr_: str = 'nr', surface_: str = 'surface', bottom_: str = 'bottom') Collection | DataFrame[source]#
Add information from one or more model variables as columns to survey data.
For each survey, this determines the vertical model stack at the survey’s location and identifies the layer boundaries within that stack based on changes in the selected model variables. Survey intervals are split at these model layer boundaries, and the corresponding model information is backfilled to the resulting intervals. The resulting data are sorted by depth. This is illustrated in the example below.
Survey data: nr top bottom lith 0 A 0.0 10.0 Z Layer boundaries derived from the model data for "variable" at the location of the survey: top bottom variable 0 0.0 8.0 1 1 8.0 11.0 2 Result: nr top bottom lith variable 0 A 0.0 8.0 Z 1.0 1 A 8.0 10.0 Z 2.0
- Parameters:
survey_data (
Collection| pd.DataFrame) – Collection or DataFrame to add the model data to.model (xr.Dataset | xr.DataArray) – Xarray Dataset or DataArray containing the model data.
data_vars (str | list[str], optional) – Variable or variables from the model to add. These variables are used to determine the layer boundaries. A layer boundary is defined where the value of a variable changes with depth; consecutive equal values are considered part of the same layer. If multiple variables are given, they are treated jointly when determining the layer boundaries. If None, all model variables are added and jointly considered for determining the layer boundaries.
aggregate_vars (dict[str, str], optional) – Optional dictionary specifying how to aggregate additional model variables, not given in data_vars, over the layers derived from data_vars. The keys are the model variable names and the values are the aggregation functions (e.g., “mean” or “sum”).
suffix (str, optional) – Suffix to append to the added model variable columns to avoid name conflicts with existing columns in the survey data. If None, no suffix is added. In case of a name conflict, the existing column is overwritten.
- Returns:
Collection or pandas.DataFrame instance with the information from the model added to the data.
- Return type:
Collection| pd.DataFrame