{ "cells": [ { "cell_type": "markdown", "id": "e9317351", "metadata": {}, "source": [ "# 4. Get input for pySWAP\n", "This example shows how to get input for [`pySWAP`](https://github.com/zawadzkim/pySWAP)." ] }, { "cell_type": "code", "execution_count": 1, "id": "0", "metadata": {}, "outputs": [], "source": [ "import dutchsoils as ds" ] }, { "cell_type": "markdown", "id": "6f44f0b0", "metadata": {}, "source": [ "## 4.0. Get soil profile" ] }, { "cell_type": "code", "execution_count": 2, "id": "f0bd59ba", "metadata": {}, "outputs": [], "source": [ "sp = ds.SoilProfile.from_bofekcluster(1008)" ] }, { "cell_type": "markdown", "id": "0f099700", "metadata": {}, "source": [ "## 4.1. Get `pyswap` soil profile discretisation" ] }, { "cell_type": "code", "execution_count": 3, "id": "9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'ISUBLAY': [1, 2, 3, 4, 5, 6, 7, 8, 9],\n", " 'ISOILLAY': [1, 2, 2, 3, 3, 4, 4, 5, 5],\n", " 'HSUBLAY': [10, 20, 5, 25, 20, 5, 10, 5, 100],\n", " 'HCOMP': [1, 2, 5, 5, 10, 5, 10, 5, 20],\n", " 'NCOMP': [10, 10, 1, 5, 2, 1, 1, 1, 5]}" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sp.get_swapinput_profile(\n", " discretisation_compheights=[1, 2, 5, 10, 20],\n", " discretisation_depths=[10, 20, 30, 40, 100]\n", ")" ] }, { "cell_type": "markdown", "id": "38bc0e10", "metadata": {}, "source": [ "## 4.2. Get `pyswap` soil hydraulic parameters" ] }, { "cell_type": "code", "execution_count": 4, "id": "c1d2f1b4", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'ORES': array([0. , 0.01, 0.01, 0.01, 0.01]),\n", " 'OSAT': array([0.71862598, 0.573268 , 0.84863548, 0.36584689, 0.36584689]),\n", " 'ALFA': array([0.01906191, 0.02785405, 0.01192909, 0.01598691, 0.01598691]),\n", " 'NPAR': array([1.1366583 , 1.07995207, 1.27153561, 2.16275113, 2.16275113]),\n", " 'KSATFIT': array([ 4.48373535, 9.68929074, 3.40200949, 22.32215442, 22.32215442]),\n", " 'LEXP': array([ 1.00000000e-04, -6.09131057e+00, -1.24929996e+00, 2.86796720e+00,\n", " 2.86796720e+00]),\n", " 'H_ENPR': [0.0, 0.0, 0.0, 0.0, 0.0],\n", " 'KSATEXM': array([ 4.48373535, 9.68929074, 3.40200949, 22.32215442, 22.32215442]),\n", " 'BDENS': array([ 641., 1044., 232., 1545., 1668.])}" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sp.get_swapinput_hydraulicparams()" ] }, { "cell_type": "markdown", "id": "8368af83", "metadata": {}, "source": [ "## 4.3. Get `pyswap` soil textural fractions " ] }, { "cell_type": "code", "execution_count": 5, "id": "76b5d148", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'PSAND': array([0.25, 0.1 , 0.25, 0.92, 0.92]),\n", " 'PSILT': array([0.35, 0.35, 0.57, 0.06, 0.06]),\n", " 'PCLAY': array([0.4 , 0.55, 0.18, 0.02, 0.02]),\n", " 'ORGMAT': array([0.2 , 0.07 , 0.75 , 0.03 , 0.004])}" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sp.get_swapinput_fractions()" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "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.13.3" } }, "nbformat": 4, "nbformat_minor": 5 }