Notebook - Fractopo – KB11 Trace Data Validation
[1]:
from pathlib import Path
import geopandas as gpd
from fractopo import Validation
Data (KB11)
[2]:
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)
[3]:
# Create validation object with fixing (i.e. modification of data) allowed.
kb11_validation = Validation(traces, area, name=name, allow_fix=True)
[4]:
# 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)
[5]:
# Normal DataFrame methods are available for data inspection
kb11_validated.columns
[5]:
Index(['Name', 'Shape_Leng', 'geometry', 'VALIDATION_ERRORS'], dtype='object')
[6]:
# Convert column data to string to allow hashing and return all unique
# validation errors.
unique_errors = kb11_validated["VALIDATION_ERRORS"].astype(str).unique()
unique_errors
[6]:
array(['()', "('SHARP TURNS',)"], dtype=object)
[7]:
# Check that only empty and SHARP TURNS error values are found
assert len(unique_errors) == 2
[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, 1 were invalid.
There were 1 error types. These were: SHARP TURNS
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