invert4geom.run_inversion_workflow

invert4geom.run_inversion_workflow#

run_inversion_workflow(grav_ds, create_starting_topography=False, calculate_starting_gravity=False, calculate_regional_misfit=False, run_damping_cv=False, run_zref_or_density_optimization=False, run_zref_or_density_cv=None, run_kfolds_zref_or_density_optimization=False, run_kfolds_zref_or_density_cv=None, fname=None, starting_topography=None, starting_topography_kwargs=None, density_contrast=None, zref=None, model_type='prisms', upper_confining_layer=None, lower_confining_layer=None, buffer_width=0, regional_grav_kwargs=None, constraints_df=None, inversion_kwargs=None, damping_cv_kwargs=None, zref_density_optimization_kwargs=None, zref_density_cv_kwargs=None, progressbar=True)[source]#

This function runs the full inversion workflow. Depending on the input parameters, it will: 1) create a starting topography model 2) create a starting prism model 3) calculate the starting gravity of the prism model 4) calculate the gravity misfit 5) calculate the regional and residual components of the misfit 6) run the inversion to update the prism model 7) run a cross-validation for determining optimal values for damping, density, and zref

Parameters:
  • grav_ds (Dataset) – gravity data with variables ‘upward’ and ‘gravity_anomaly’.

  • create_starting_topography (bool) – Choose whether to create starting topography model. If True, must provide starting_topography_kwargs, if False must provide starting_topography by default False

  • calculate_starting_gravity (bool) – Choose whether to calculate starting gravity from prisms model. If False, must provide column “forward_gravity” in grav_df , by default False

  • calculate_regional_misfit (bool) – Choose whether to calculate regional misfit. If False, must provide column “reg” in grav_df, if True, must provide`regional_grav_kwargs`, by default False

  • run_damping_cv (bool) – Choose whether to run cross validation for damping, if True, must provide dictionary damping_cv_kwargs with parameters n_trials and damping_limits, by default False

  • run_zref_or_density_optimization (bool) – Choose whether to run cross validation for zref or density, if True, must provide dictionary zref_density_optimization_kwargs with parameters n_trials, and either zref_values or density_values, by default False

  • run_kfolds_zref_or_density_optimization (bool) – Choose whether to run internal kfolds cross validation for zref or density, if True, must provide split_kwargs as argument to zref_density_optimization_kwargs, by default False

  • fname (str | None) – filename and path to use for saving results. If running a damping CV, will save the study to <fname>_damping_cv_study.pickle and the tuple of the best inversion results to <fname>_damping_cv.pickle. If running a density/zref optimization, will save the study to <fname>_zref_density_optimization_study.pickle and the tuple of the best inversion results to <fname>_zref_density_optimization.pickle. The final inversion result for all methods will be saved to <fname>.pickle, by default will be “tmp_<x>” where x is a random integer between 0 and 999.

  • starting_topography (Dataset | None) – a starting topography model with variable upward, by default None

  • starting_topography_kwargs (dict[str, Any] | None) – kwargs needed for create a starting topography grid, passed to create_topography(), by default None

  • density_contrast (float | None) – density contrast for the starting prisms, by default None

  • zref (float | None) – reference depth for the starting prisms, by default None

  • model_type (str) – type of model to create, either “prisms” or “tesseroids”, by default “prisms”

  • upper_confining_layer (Dataset | None) – an upper confining layer model with variable upward, by default None

  • lower_confining_layer (Dataset | None) – a lower confining layer model with variable upward, by default None

  • buffer_width (float) – The width in meters of a buffer zone used to zoom-in on the provided data creating an inner region. This inner region will be used for plotting and calculating statistics, this avoids skewing plots and values by edge effects, by default is None.

  • regional_grav_kwargs (dict[str, Any] | None) – kwargs needed for estimating regional gravity, passed to DatasetAccessorInvert4Geom.regional_separation, by default None

  • constraints_df (DataFrame | None) – Dataframe of constraint points, by default None

  • inversion_kwargs (dict[str, Any] | None) – kwargs to be passed to Inversion(), by default None

  • damping_cv_kwargs (dict[str, Any] | None) – kwargs to be passed to optimize_inversion_damping(), by default None

  • zref_density_optimization_kwargs (dict[str, Any] | None) – kwargs to be passed to optimize_inversion_zref_density_contrast() or optimize_inversion_zref_density_contrast_kfolds(), by default None

  • progressbar (bool) – whether to show progress bar during inversion, by default True

  • run_zref_or_density_cv (bool | None)

  • run_kfolds_zref_or_density_cv (bool | None)

  • zref_density_cv_kwargs (dict[str, Any] | None)

Returns:

a inversion object with all results and optimal values as attributes.

Return type:

Inversion