Notebook - Fractopo – KB11 Trace Data Validation
[1]:
import warnings
warnings.filterwarnings("ignore", message="The Shapely GEOS")
warnings.filterwarnings("ignore", message="In a future version, ")
warnings.filterwarnings("ignore", message="No data for colormapping provided via")
warnings.filterwarnings(
"ignore", message="Shapely 2.0 is installed, but because PyGEOS is also installed"
)
[2]:
from pathlib import Path
import geopandas as gpd
from fractopo import Validation
Data (KB11)
[3]:
traces_path = Path("../../tests/sample_data/KB11/KB11_traces.geojson")
area_path = Path("../../tests/sample_data/KB11/KB11_area.geojson")
traces = gpd.read_file(traces_path)
area = gpd.read_file(area_path)
# Name the dataset
name = "KB11"
Validation (KB11)
[4]:
# Create validation object with fixing (i.e. modification of data) allowed.
kb11_validation = Validation(traces, area, name=name, allow_fix=True)
[5]:
# Run actual validation and capture the outputted validated trace GeoDataFrame
kb11_validated = kb11_validation.run_validation()
Expected the intersection of overlapping geometries to not be a Point
Expected the intersection of overlapping geometries to not be a Point
Expected the intersection of overlapping geometries to not be a Point
Validation results (KB11)
[6]:
# Normal DataFrame methods are available for data inspection
kb11_validated.columns
[6]:
Index(['Name', 'Shape_Leng', 'geometry', 'VALIDATION_ERRORS'], dtype='object')
[7]:
# Convert column data to string to allow hashing and return all unique
# validation errors.
kb11_validated["VALIDATION_ERRORS"].astype(str).unique()
[7]:
array(['()', "('STACKED TRACES',)", "('SHARP TURNS',)"], dtype=object)
[8]:
# Better description function is found in fractopo.cli
from fractopo.cli import describe_results
describe_results(kb11_validated, kb11_validation.ERROR_COLUMN)
Out of 707 traces, 2 were invalid.
There were 2 error types. These were: SHARP TURNS STACKED TRACES
The KB11 dataset only contains SHARP TURNS
errors which are normally non-disruptive in further analyses.
See documentation: https://nialov.github.io/fractopo/validation/errors.html