invert4geom.regional#

Functions#

_check_grav_cols(grav_df)

ensure gravity dataframe has the necessary columns

regional_constant(grav_df[, constant, constraints_df, ...])

approximate the regional field with a constant value. If constraint points of the

regional_filter(grav_df, filter_width[, ...])

separate the regional field with a low-pass filter

regional_trend(grav_df, trend[, regional_shift, ...])

separate the regional field with a trend

regional_eq_sources(grav_df[, depth, damping, ...])

separate the regional field by estimating deep equivalent sources

regional_constraints(grav_df, constraints_df[, ...])

Separate the regional field by sampling and re-gridding the gravity misfit at

regional_constraints_cv(constraints_df[, split_kwargs])

This is a convenience function to wrap

regional_separation(method, grav_df[, ...])

Separate the regional field from the gravity data using the specified method

Module Contents#

_check_grav_cols(grav_df)[source]#

ensure gravity dataframe has the necessary columns

Parameters:

grav_df (pandas.DataFrame) – gravity dataframe

Return type:

None

regional_constant(grav_df, constant=None, constraints_df=None, regional_shift=0, mask_column=None)[source]#

approximate the regional field with a constant value. If constraint points of the layer of interested are supplied, the constant value will be the median misfit value at the constraint points.

Parameters:
  • grav_df (pandas.DataFrame) – gravity data with columns “easting”, “northing”, “gravity_anomaly”, and “starting_gravity”.

  • constant (float) – shift to apply to the data

  • constraints_df (pandas.DataFrame) – a dataframe of constraint points with columns easting and northing.

  • regional_shift (float, optional) – shift to add to the regional field, by default 0

  • mask_column (str | None, optional) – Name of optional column with values to multiply estimated regional field by, should have values of 1 or 0, by default None.

Returns:

grav_df with new columns ‘misfit’, ‘reg’, and ‘res’.

Return type:

pandas.DataFrame

regional_filter(grav_df, filter_width, regional_shift=0, mask_column=None)[source]#

separate the regional field with a low-pass filter

Parameters:
  • grav_df (pandas.DataFrame) – gravity data with columns “easting”, “northing”, “gravity_anomaly”, and “starting_gravity”.

  • filter_width (float) – width in meters to use for the low-pass filter

  • regional_shift (float, optional) – shift to add to the regional field, by default 0

  • mask_column (str | None, optional) – Name of optional column with values to multiply estimated regional field by, should have values of 1 or 0, by default None.

Returns:

grav_df with new columns ‘misfit’, ‘reg’, and ‘res’.

Return type:

pandas.DataFrame

regional_trend(grav_df, trend, regional_shift=0, mask_column=None)[source]#

separate the regional field with a trend

Parameters:
  • grav_df (pandas.DataFrame) – gravity data with columns “easting”, “northing”, “gravity_anomaly”, and “starting_gravity”.

  • trend (int) – order of the polynomial trend to fit to the data

  • regional_shift (float, optional) – shift to add to the regional field, by default 0

  • mask_column (str | None, optional) – Name of optional column with values to multiply estimated regional field by, should have values of 1 or 0, by default None.

Returns:

grav_df with new columns ‘misfit’, ‘reg’, and ‘res’.

Return type:

pandas.DataFrame

regional_eq_sources(grav_df, depth='default', damping=None, block_size=None, points=None, grav_obs_height=None, regional_shift=0, cv=False, weights_column=None, cv_kwargs=None, mask_column=None)[source]#

separate the regional field by estimating deep equivalent sources

Parameters:
  • grav_df (pandas.DataFrame) – gravity data with columns “easting”, “northing”, “gravity_anomaly”, and “starting_gravity”.

  • depth (float) – depth of each source relative to the data elevation

  • damping (float | None, optional) – smoothness to impose on estimated coefficients, by default None

  • block_size (float | None, optional) – block reduce the data to speed up, by default None

  • points (list[numpy.ndarray] | None, optional) – specify source locations for equivalent source fitting, by default None

  • grav_obs_height (float, optional) – Observation height to use predicting the eq sources, by default None and will use the data height from grav_df.

  • regional_shift (float, optional) – shift to add to the regional field, by default 0

  • cv (bool, optional) – use cross-validation to find the best equivalent source parameters, by default False, provide dictionary cv_kwargs which is passed to optimize_eq_source_params and can contain: “n_trials”, “damping_limits”, “depth_limits”, “block_size_limits”, “sampler”, “plot”, “progressbar”, “parallel”, “dtype”, or “delayed”.

  • weights_column (str | None, optional) – column name for weighting values of each gravity point.

  • mask_column (str | None, optional) – Name of optional column with values to multiply estimated regional field by, should have values of 1 or 0, by default None.

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

Returns:

grav_df with new columns ‘misfit’, ‘reg’, and ‘res’.

Return type:

pandas.DataFrame

regional_constraints(grav_df, constraints_df, grid_method='eq_sources', constraints_block_size=None, constraints_weights_column=None, tension_factor=1, registration='g', spline_dampings=None, depth=None, damping=None, cv=False, block_size=None, points=None, grav_obs_height=None, cv_kwargs=None, regional_shift=0, mask_column=None)[source]#

Separate the regional field by sampling and re-gridding the gravity misfit at points of known topography (constraint points). The re-gridding can be done with: 1. Tensioned minimum curvature with PyGMT, using grid_method “pygmt”, 2. Bi-Harmonica splines with Verde, using grid_method “verde”, or 3. Equivalent Sources with Harmonica, using grid_method “eq_sources”. Optionally, a dc-shift can be added to the calculated regional with regional_shift.

Parameters:
  • grav_df (pandas.DataFrame) – gravity data with columns “easting”, “northing”, “gravity_anomaly”, and “starting_gravity”.

  • constraints_df (pandas.DataFrame) – dataframe of constraints with columns “easting”, “northing”, and “upward”.

  • grid_method (str, optional) – method used to grid the sampled gravity data at the constraint points. Choose between “verde”, “pygmt”, or “eq_sources”, by default “eq_sources”

  • constraints_block_size (float | None, optional) – size of block used in a block-mean reduction of the constraints points, by default None

  • constraints_weights_column (str | None, optional) – column name for weighting values of each constraint point. Used if constraint_block_size is not None or if grid_method is “verde” or “eq_sources”, by default None

  • tension_factor (float, optional) – Tension factor used if grid_method is “pygmt”, by default 1

  • registration (str, optional) – grid registration used if grid_method is “pygmt”,, by default “g”

  • spline_dampings (float | list[float] | None, optional) – damping values used if grid_method is “verde”, by default None

  • depth (float | str | None, optional) – depth of each source relative to the data elevation, positive downwards in meters, by default None

  • damping (float | None, optional) – damping values used if grid_method is “eq_sources”, by default None

  • cv (bool, optional) – use cross-validation to find the best equivalent source parameters, by default False, provide dictionary cv_kwargs which is passed to optimization.optimize_eq_source_params and can contain: “n_trials”, “damping_limits”, “depth_limits”, “block_size_limits”, and “progressbar”.

  • block_size (float | None, optional) – block size used if grid_method is “eq_sources”, by default None

  • points (list[numpy.ndarray] | None, optional) – specify source locations for equivalent source fitting, by default None

  • grav_obs_height (float, optional) – Observation height to use if grid_method is “eq_sources”, by default None

  • cv_kwargs (dict[str, Any] | None, optional) – additional keyword arguments for the cross-validation optimization of equivalent source parameters, by default None. Can contain: “n_trials”, “damping_limits”, “depth_limits”, “block_size_limits”, “points”, “sampler”, “plot”, “progressbar”, “parallel”, “fname”, “dtype”, or “delayed”.

  • regional_shift (float, optional) – shift to add to the regional field, by default 0

  • mask_column (str | None, optional) – Name of optional column with values to multiply estimated residual field by, should have values of 1 or 0, by default None.

Returns:

grav_df with new columns ‘misfit’, ‘reg’, and ‘res’.

Return type:

pandas.DataFrame

regional_constraints_cv(constraints_df, split_kwargs=None, **kwargs)[source]#

This is a convenience function to wrap optimization.optimize_regional_constraint_point_minimization. It takes a full constraints dataframe and dictionary split_kwargs, to split the constraints into testing and training sets (with K-folds), uses these folds in a K-Folds hyperparameter optimization to find the set of parameter values which estimates the best regional field. It then uses the optimal parameter values and all of the constraint points to re-calculate the best regional field. All kwargs are passed to the function optimize_regional_constraint_point_minimization

Parameters:
  • constraints_df (pandas.DataFrame) – dataframe of un-separated constraints

  • split_kwargs (dict[str, Any] | None, optional) – kwargs to be passed to split_test_train, by default None

  • **kwargs (Any) – kwargs to be passed to optimize_regional_constraint_point_minimization

Returns:

a gravity dataframe with new columns ‘misfit’, ‘reg’, and ‘res’.

Return type:

pandas.DataFrame

regional_separation(method, grav_df, remove_starting_grav_mean=False, **kwargs)[source]#

Separate the regional field from the gravity data using the specified method and return the dataframe with a new column for the regional field.

Parameters:
  • method (str) – choose method to apply; one of “constant”, “filter”, “trend”, “eq_sources”, “constraints” or “constraints_cv”.

  • grav_df (pandas.DataFrame) – gravity data with columns “easting”, “northing”, “gravity_anomaly”, and “starting_gravity”.

  • remove_starting_grav_mean (bool, optional) – add the mean of the starting gravity to the regional gravity field, by default False.

  • **kwargs (Any) – additional keyword arguments for the specified method.

Returns:

grav_df with new columns ‘misfit’, ‘reg’, and ‘res’.

Return type:

pandas.DataFrame