geost.base.Collection#
- class geost.base.Collection(data: DataFrame = None, *, header: GeoDataFrame = None, has_inclined: bool = False, vertical_datum: str | int | CRS = None)[source]#
A Collection is GeoST’s data container for any kind of subsurface data. It keeps survey data in a “header” and “data” table and ensures that they remain aligned when applying methods.
The header is a GeoDataFrame that contains one row per survey (e.g. borehole, CPT,
etc.) with metadata about the survey and spatial information. - The data is a DataFrame that contains the logged information for all surveys, with one row per logged layer in the survey.
- Parameters:
data (
pd.DataFrame, optional) – Data table containing the logged information for all surveys, with one row per logged layer in the survey. If not given, an empty DataFrame is set. The default is None.header (
gpd.GeoDataFrame, optional) – Header containing one row per survey with metadata and spatial information. If not given, the header will automatically be set from the data by dropping duplicates in the column identifying the survey (e.g. “nr”) and keeping the first row for each survey. The default is None.has_inclined (bool, optional) – Boolean indicating whether there are inclined objects within the collection. This is used to determine whether the collection contains objects with bottom coordinates (e.g. “x_bot”, “y_bot”) in the data table. The default is False.
vertical_reference (str | int | CRS, optional) – Vertical datum represented by an instance of pyproj.crs.CRS or anything that can be interpreted by pyproj.crs.CRS.from_user_input(). This is used to keep track of the vertical reference of the surface levels in the collection, which is important for any method that involves vertical reference transformations. The default is 5709.
- __init__(data: DataFrame = None, *, header: GeoDataFrame = None, has_inclined: bool = False, vertical_datum: str | int | CRS = None)[source]#
Methods
__init__([data, header, has_inclined, ...])add_header_column_to_data(column_name)Add a column from the header to the data table.
Two-way check to warn of any misalignment between the header and data attributes.
determine_end_depth([survey_id_as_index])Determine the end depth of each survey based on the surface and depth columns in the data table of the Collection.
get(selection_values[, column])Select all survey data by selecting a subset of the header table of the Collection instance.
get_cumulative_thickness(column, values[, ...])Get the cumulative thickness of layers where a column contains a specified search value or values.
get_layer_base(column, values[, ...])Find the depth at which a specified layer occurs last, starting at min_depth and looking downwards until the first layer of min_thickness is found of the specified layer.
get_layer_top(column, values[, ...])Find the depth at which a specified layer first occurs, starting at min_depth and looking downwards until the first layer of min_thickness is found of the specified layer.
Refresh the header based on the loaded data in case the header got messed up.
select_by_condition(condition[, invert])Do a condition-based selection on the data table of the `Collection: return the rows in the data where the 'condition' evaluates to True, see examples below.
select_by_elevation([top_min, top_max, ...])Select surveys by elevation constraints: e.g. all surveys with their surface level and end depths between specified minimum and maximum values.
select_by_length([min_length, max_length])Select data from length constraints: e.g. all surveys between 50 and 150 m long.
select_by_values(column, values[, how, ...])Select data based on the presence of values in a given column.
select_with_lines(lines, max_distance[, invert])Select all data that lie within a maximum distance from given line geometries.
select_with_points(points, max_distance[, ...])Select all data that lie within a maximum distance from given point geometries.
select_within_bbox(xmin, ymin, xmax, ymax[, ...])Make a selection of the collection based on a bounding box.
select_within_polygons(polygons[, buffer, ...])Select all data that lie within given polygon geometries.
set_crs(crs[, allow_override])Set the coordinate reference system (CRS) for the collection's header geometry column.
set_header(header)set_vertical_datum(vertical_datum)Set the vertical datum of the collection's surface levels without performing a transformation of the surface levels.
slice_by_values(column, values[, invert, ...])Slice rows from data based on matching condition.
slice_depth_interval([upper_boundary, ...])Slice data based on given upper and lower boundaries.
spatial_join(geometries, label_id[, ...])Join information from another GeoDataFrame by a spatial relationship (e.g. overlap) between the geometries in the header table of the Collection with the geometries in the other GeoDataFrame.
to_crs(crs[, xbot, ybot])Change the horizontal reference (i.e. coordinate reference system, crs) of the collection to the given target crs.
to_csv(outfile[, data_table])Export the data or header table to a csv file.
to_geopackage(outfile[, metadata])Write header and data to a geopackage.
to_geoparquet(outfile, **kwargs)Write header data to geoparquet.
to_kingdom(outfile[, tdstart, vw, vs])Write 2 csv files for visualisation of data in Kingdom seismic interpretation software: - interval data: contains the layer boundaries and properties of the layers.
to_parquet(outfile[, data_table])Export the data or header table to a parquet file.
to_pickle(outfile, **kwargs)Export the complete Collection to a pickle file.
to_pyvista_cylinders(displayed_variables[, ...])Create a Pyvista MultiBlock object of cylinder-shaped geometries to represent boreholes.
to_pyvista_grid(displayed_variables[, radius])Create a PyVista UnstructuredGrid object of the data in this instance.
to_qgis3d(outfile[, crs])Write data to geopackage file that can be directly loaded in the Qgis2threejs plugin.
to_shape(outfile, **kwargs)Write header data to shapefile.
to_vertical_datum(vertical_datum)Change the vertical reference of the collection object's surface levels
Attributes
Coordinate reference system represented by an instance of pyproj.crs.CRS.
The collection's data.
Boolean indicating whether there are inclined objects within the collection
The collection's header.
header_has_geometryNumber of objects in the collection.
Vertical datum represented by an instance of pyproj.crs.CRS.