invert4geom.create_topography#
- create_topography(method, region, spacing, dampings=None, registration='g', upward=None, upwards=None, coord_names=('easting', 'northing'), projection=None, constraints_df=None, weights=None, weights_col=None, block_size=None, block_reduction='median', upper_confining_layer=None, lower_confining_layer=None, dataset_to_add=None)[source]#
Create a grid of topography data from either the interpolation (with splines) of point data or creating a grid of constant value. Optionally, a subset of point data can be interpolated and then merged with an existing grid. To do this,
constraints_dfmust contain two additional columns of booleans,insidewhich is True for points inside the region of interest, and False otherwise, andbufferwhich is True for points within a buffer region around the region of interest, and False otherwise. Inside and Buffer points are used to interpolated the data, and then the interpolated data (without the buffer zone) is merged with the points outside the region of interest. For interpolations,block_sizecan be supplied to perform a block-median filtering of the points before fitting the spline, reducing the computational cost.- Parameters:
method (str) β method to use, either
flatorsplinesregion (tuple[float, float, float, float]) β bounding region to use for the output grid. If you are using projected coordinates (meters), this is in the format (min_easting, max_easting, min_northing, max_northing). If using geographic coordinates (latitude and longitude), this is in the format (min_longitude, max_longitude, min_latitude, max_latitude)
spacing (float) β spacing of the grid in meters if using projected coordinates, or in decimal degrees if using geographic coordinates
dampings (list[float] | None, optional) β damping values to use in spline cross validation for method
spline, by default Noneregistration (str, optional) β choose between gridline
gor pixelpregistration, by defaultgupward (float | None, optional) β constant elevation in meters to use for method
flat, by default Noneupwards (float | None, optional) β deprecated, use upward instead, by default None
coord_names (tuple[str, str], optional) β names to use for coordinates, should be either (easting, northing) or (longitude, latitude), by default (easting, northing)
projection (pyproj.Proj | None, optional) β if using geographic coordinates (latitude and longitude) and the splines method, provide a pyproj Proj object to convert to cartesian coordinates, by default None
constraints_df (pandas.DataFrame | None, optional) β dataframe with column βupwardβ to use for method
splines, and optionally columnsinsideandbuffer, by default Noneweights (pandas.Series | numpy.ndarray | None, optional) β weight to use for fitting the spline. Typically, this should be 1 over the data uncertainty squared, by default None
weights_col (str | None, optional) β instead of passing the weights, pass the name of the column containing the weights, by default None
block_size (float | None, optional) β block size to use for block-reduction of constraint points before fitting splines. In meters if using projected coordinates, or in decimal degrees if using geographic coordinates. If None, no block-reduction is applied, by default None
block_reduction (str, optional) β type of block reduction to apply, if
median, weights will be ignored, ofmean, and weights are provided, they will be used in the block reduction. Defaults tomedian.upper_confining_layer (xarray.DataArray | None, optional) β layer which the inverted topography should always be below, by default None
lower_confining_layer (xarray.DataArray | None, optional) β layer which the inverted topography should always be above, by default None
dataset_to_add (xarray.Dataset | None, optional) β additional variables to add to the topography dataset, such as variables mask or geocentric_radius, by default None
- Returns:
a topography grid
- Return type: