{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import sys\n", "from pathlib import Path\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", "triskele_path = Path('../triskele/python/')\n", "sys.path.append(str(triskele_path.resolve()))\n", "import triskele\n", "\n", "def DFC_filter(raster):\n", " raster[raster > 1e4] = raster[raster < 1e4].max()\n", "\n", "def show(im, im_size=1, save=None):\n", " plt.figure(figsize=(16*im_size,3*im_size))\n", " plt.imshow(im)\n", " plt.colorbar()\n", " \n", " if save is not None:\n", " plt.savefig(save, bbox_inches='tight', pad_inches=1)\n", " \n", " plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "raster = triskele.read('../Data/phase1_rasters/DEM+B_C123/UH17_GEM051_TR.tif')\n", "DFC_filter(raster)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "show(raster)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "t = triskele.Triskele(raster, verbose=False)\n", "\n", "area = np.array([1e3, 1e4, 1e5])\n", "\n", "res = t.filter(area=area)\n", "res.shape" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#old_res = res" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 2 }