diff --git a/_sources/docs/utility.md b/_sources/docs/utility.md new file mode 100644 index 00000000..7219991c --- /dev/null +++ b/_sources/docs/utility.md @@ -0,0 +1,11 @@ +# Utilities + +Additional tools to help collect, view and process risk data. + +## Merge tiles + +Large raster datasets often comes as a collection of regular tiles. +In order to run the raster analysis offered in our tools, they often need to be merged into one file. +To do that, a simple python script is provided as jupyter notebook. + +[TILE MERGE](utility/merge_tiles/Merge_tiles.ipynb) \ No newline at end of file diff --git a/_sources/utility/merge_tiles/Merge_tiles.ipynb b/_sources/utility/merge_tiles/Merge_tiles.ipynb new file mode 100644 index 00000000..c72eb902 --- /dev/null +++ b/_sources/utility/merge_tiles/Merge_tiles.ipynb @@ -0,0 +1,62 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "b8bf67f8", + "metadata": {}, + "source": [ + "# TILE MERGE SCRIPT\n", + "\n", + "The python script below looks into subfolders of specified directory and merge together all tiff files found, naming the resulting tiff as the folder from which they are generated.\n", + "\n", + "- The function for merging and exporting is found in merge_utils.py\n", + "- GDAL library must be installed in your python environment\n", + "- Output is exported in the same format of the original tiles\n", + "- The scripts makes use of parallel processing for quicker results" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "e3904d3e", + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "import concurrent.futures\n", + "from merge_utils import merge_tifs\n", + "\n", + "# Specify the directory to search for .tif files\n", + "directory = 'C:/YourWorkDirectory/Fathom3/PL/2020/'\n", + "\n", + "# Iterate through each subdirectory\n", + "subdirs = [os.path.join(directory, subdir) for subdir in os.listdir(directory) if os.path.isdir(os.path.join(directory, subdir))]\n", + "\n", + "# Process subdirectories in parallel\n", + "with concurrent.futures.ProcessPoolExecutor() as executor:\n", + " executor.map(merge_tifs, subdirs)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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", + "version": "3.10.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docs/EAE.html b/docs/EAE.html index d432e0b2..d9b60fcd 100644 --- a/docs/EAE.html +++ b/docs/EAE.html @@ -270,6 +270,13 @@ + + + + + +