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")
[2]:
import geopandas as gpd
[3]:
# This cell's contents only for development purposes.
from importlib.util import find_spec

if find_spec("fractopo") is None:
    import sys

    sys.path.append("../../")
[4]:
from fractopo import Validation
import matplotlib.pyplot as plt

plt.close()

Data (KB11)

[5]:
# Trace and target area data available on GitHub
trace_data_url = "https://raw.githubusercontent.com/nialov/fractopo/master/tests/sample_data/KB11/KB11_traces.geojson"
area_data_url = "https://raw.githubusercontent.com/nialov/fractopo/master/tests/sample_data/KB11/KB11_area.geojson"

# Use geopandas to load data from urls
traces = gpd.read_file(trace_data_url)
area = gpd.read_file(area_data_url)

# Name the dataset
name = "KB11"

Validation (KB11)

[6]:
# Create validation object with fixing (i.e. modification of data) allowed.
kb11_validation = Validation(traces, area, name=name, allow_fix=True)
[7]:
# Run actual validation and capture the outputted validated trace GeoDataFrame
kb11_validated = kb11_validation.run_validation()

Validation results (KB11)

[8]:
# Normal DataFrame methods are available for data inspection
kb11_validated.columns
[8]:
Index(['Name', 'Shape_Leng', 'geometry', 'VALIDATION_ERRORS'], dtype='object')
[9]:
# Convert column data to string to allow hashing and return all unique
# validation errors.
kb11_validated["VALIDATION_ERRORS"].astype(str).unique()
[9]:
array(['()', "('SHARP TURNS',)"], dtype=object)
[10]:
# 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://fractopo.readthedocs.io/en/latest/validation/errors.html