invert4geom.Inversion.optimize_inversion_zref_density_contrast_windowed#
- Inversion.optimize_inversion_zref_density_contrast_windowed(n_trials, constraints_df, window_width, window_overlap=0.0, window_buffer=0.0, min_constraints=1, merge_method='spline', merge_damping=None, zref_limits=None, density_contrast_limits=None, starting_topography=None, starting_topography_kwargs=None, regional_grav_kwargs=None, fname=None, progressbar=True, **kwargs)[source]#
Find spatially variable optimal zref and / or density contrast values by running independent zref / density contrast optimizations within windows of the model region, and merging the per-window optimal values into grids used in a final inversion.
The model region is tiled with square windows of width
window_width, optionally overlapping by a fractionwindow_overlapof their width. For each window, the gravity data, model, and constraint points are cropped to the window (padded bywindow_bufferto reduce edge effects) and a standard optimization (optimize_inversion_zref_density_contrast) is run to find the window’s optimal parameter values, scored with the constraint points falling inside the (unpadded) window. Windows containing fewer thanmin_constraintsconstraint points are skipped, as are windows where the optimization fails. The optimal values of all successful windows, located at the window centers, are then merged into continuous grids by interpolation (merge_method), clipped to the range of the per-window values. A final inversion is then run over the full region using these spatially variable zref and / or density contrast grids.K-folds cross-validation (lists of constraint dataframes) is not supported; provide a single dataframe of constraint points.
- Parameters:
n_trials (
int) – number of optimization trials to run within each window.constraints_df (
DataFrame) – constraint points used for scoring, with columns for the two horizontal coordinates and “upward”.window_width (
float) – width of the square windows, in meters (or degrees for tesseroid models).window_overlap (
float) – fraction (0 to <1) of the window width which adjacent windows overlap by, by default 0.0window_buffer (
float) – width of a buffer zone of gravity data included around each window to reduce edge effects, must be a multiple of the grid spacing. Constraint points within the buffer are not used for scoring, by default 0.0min_constraints (
int) – minimum number of constraint points which must fall within a window for it to be included, by default 1merge_method (
str) – method used to interpolate the per-window optimal values into grids, either “spline” (verde.Spline) or “nearest” (verde.KNeighbors), by default “spline”merge_damping (
float|None) – damping parameter for the merging spline, by default Nonezref_limits (
tuple[float,float] |None) – upper and lower limits for the reference level, in meters, by default Nonedensity_contrast_limits (
tuple[float,float] |None) – upper and lower limits for the density contrast, in kg/m^-3, by default Nonestarting_topography (
Dataset|None) – a starting topography model, cropped to each window, by default Nonestarting_topography_kwargs (
dict[str,Any] |None) – kwargs passed to utils.create_topography, same as inoptimize_inversion_zref_density_contrast, by default Noneregional_grav_kwargs (
dict[str,Any] |None) – kwargs passed toDatasetAccessorInvert4Geom.regional_separation. Any dataframes (e.g. training constraints) are automatically cropped to each window, by default Nonefname (
str|None) – root file name for saving results, each window’s results are saved to <fname>_window_<i> and the final inversion to <fname>.pickle, by default a random name.progressbar (
bool) – show a progress bar over the windows, by default True**kwargs (
Any) – additional kwargs passed to each window’soptimize_inversion_zref_density_contrastcall.
- Returns:
Inversion object with the final inversion results, the merged zref and density contrast grids as attributes of the model attribute, and the per-window results in the windowed_optimization_df attribute.
- Return type: