Skip to content

Commit

Permalink
docs(notebooks): update notebook
Browse files Browse the repository at this point in the history
New error types are found with updated validation code.
  • Loading branch information
nialov committed Jan 16, 2025
1 parent cea6dbd commit 69b5c6d
Showing 1 changed file with 19 additions and 33 deletions.
52 changes: 19 additions & 33 deletions docs_src/notebooks/fractopo_validation_2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"\n",
"import geopandas as gpd\n",
"from fractopo import Validation\n",
"import matplotlib.pyplot as plt"
"import matplotlib.pyplot as plt\n",
"from shapely.geometry import box\n",
"import numpy as np"
]
},
{
Expand Down Expand Up @@ -134,7 +136,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The KB7 dataset contains the above errors of which `MULTI JUNCTION` and `TRACE UNDERLAPS TARGET AREA` are disruptive in further analysis.\n",
"The KB7 dataset contains the above errors of which `MULTI JUNCTION`, `V NODE`, `STACKED TRACES` and `TRACE UNDERLAPS TARGET AREA` are disruptive in further analysis.\n",
"\n",
"See documentation: https://nialov.github.io/fractopo/validation/errors.html"
]
Expand All @@ -143,7 +145,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Visualization of errors in notebook\n",
"## Visualization of `MULTI JUNCTION` and `TRACE UNDERLAPS TARGET AREA` errors in notebook\n",
"\n",
"Though visualization here is possible, GIS-software (e.g. QGIS, ArcGIS) are much more interactive and are recommended for actual fixing and further error inspection."
]
Expand All @@ -161,13 +163,23 @@
"metadata": {},
"outputs": [],
"source": [
"# Find MULTI JUNCTION erroneous traces in GeoDataFrame\n",
"kb7_multijunctions = kb7_validated.loc[\n",
" [\"MULTI JUNCTION\" in err for err in kb7_validated[kb7_validation.ERROR_COLUMN]]\n",
"are_in_box = kb7_validated.intersects(box(466020, 6692090, 466030, 6692105))\n",
"are_multi_junction = [\n",
" \"MULTI JUNCTION\" in err for err in kb7_validated[kb7_validation.ERROR_COLUMN]\n",
"]\n",
"kb7_multijunctions = kb7_validated.loc[np.logical_and(are_in_box, are_multi_junction)]\n",
"kb7_multijunctions"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"kb7_multijunctions.plot()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -193,25 +205,6 @@
"Additionally the orange trace has a dangling end instead of being accurately snapped to the black trace. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Example fix for blue and green traces\n",
"from shapely.ops import linemerge\n",
"\n",
"gpd.GeoSeries(\n",
" [\n",
" linemerge(\n",
" [kb7_multijunctions.geometry.iloc[4], kb7_multijunctions.geometry.iloc[2]]\n",
" ),\n",
" kb7_multijunctions.geometry.iloc[0],\n",
" ]\n",
").plot(colors=[\"green\", \"red\"])"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -261,13 +254,6 @@
"source": [
"The plot shows that the trace underlaps the target area at least on the northern end and maybe on the southern end. The fix is implemented by extending the trace to meet the target area boundary."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -286,7 +272,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
"version": "3.12.5"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 69b5c6d

Please sign in to comment.