From c7b52992895d24d6ec8dd65e02c5d447177d5928 Mon Sep 17 00:00:00 2001 From: avgils Date: Tue, 22 Mar 2022 21:11:04 +0100 Subject: [PATCH 1/3] read waterdepths from excel --- notebooks/waterdepths/read_waterdepth.ipynb | 1752 +++++++++++++++++++ 1 file changed, 1752 insertions(+) create mode 100644 notebooks/waterdepths/read_waterdepth.ipynb diff --git a/notebooks/waterdepths/read_waterdepth.ipynb b/notebooks/waterdepths/read_waterdepth.ipynb new file mode 100644 index 0000000..b7e4aea --- /dev/null +++ b/notebooks/waterdepths/read_waterdepth.ipynb @@ -0,0 +1,1752 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 199, + "id": "c7d1f238", + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import geopandas as gpd\n", + "from pathlib import Path\n", + "import geojson\n" + ] + }, + { + "cell_type": "code", + "execution_count": 208, + "id": "52d0a0f2", + "metadata": {}, + "outputs": [], + "source": [ + "# betrekkingslijnen (From Remi)\n", + "data = Path('~/data/vaarwegen/Betrekkingslijnen2018/Betrekkingslijnen_2018_h-Lobith_650-1780_rkm.xlsx')\n", + "\n", + "# https://geodata.nationaalgeoregister.nl/nwbvaarwegen/wfs?request=GetFeature&service=WFS&version=2.0.0&outputFormat=json&typeNames=nwbvaarwegen:kmmarkeringen\n", + "kmmarkering = Path('~/data/vaarwegen/kilometerraaien/kmmarkeringen.geojson').expanduser()\n", + "\n", + "# https://geodata.nationaalgeoregister.nl/nwbvaarwegen/wfs?request=GetFeature&service=WFS&version=1.1.0&outputFormat=json&typeName=vaarwegvakken\n", + "vaarwegvakken = Path('~/data/vaarwegen/kilometerraaien/vaarwegvakken.geojson').expanduser()\n", + "\n", + "# Excel sheet names with corresponding vaarwegvakken names\n", + "sheet_names = {\n", + " \"Bovenrijn-Waal\": \"Boven-Rijn|Waal\",\n", + " \"Pkan-NRijn-Lek\": \"Pannerdensch Kanaal|Neder-Rijn|Lek\",\n", + " \"IJssel\": \"IJssel\"\n", + "}\n" + ] + }, + { + "cell_type": "code", + "execution_count": 257, + "id": "45d8fdcc", + "metadata": {}, + "outputs": [], + "source": [ + "# Read betrekingslijnen NOTE: usecols is hardcoded!\n", + "df = pd.read_excel(data, sheet_name=list(sheet_names.keys()), skiprows=[0, 1, 3, 4, 5], header=0, usecols=\"B:DL\", index_col=0)" + ] + }, + { + "cell_type": "code", + "execution_count": 232, + "id": "27fb7a6e", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
703.30738.98774.78810.84847.19883.69919.63958.35999.801040.45...13046.7413366.1013691.6914023.4714361.3514705.3015055.2315411.1215772.9316140.64
878.4606.0776006.1691586.2640636.3491006.4359876.5246066.6148366.7065606.7996586.894011...14.11517214.18961814.26485814.34096114.41799914.49604614.57517514.65546414.73699014.819835
879.0006.0100006.1000006.1900006.2800006.3700006.4500006.5300006.6300006.7200006.810000...13.89000013.95000014.01000014.08000014.14000014.21000014.28000014.34000014.41000014.480000
880.0005.8600005.9500006.0400006.1200006.2100006.3000006.4000006.4900006.5800006.670000...13.62000013.67000013.72000013.77000013.82000013.87000013.92000013.96000014.01000014.050000
881.0005.7400005.8200005.9100006.0000006.0900006.1800006.2700006.3600006.4500006.540000...13.47000013.52000013.56000013.61000013.65000013.69000013.73000013.77000013.80000013.840000
881.0755.7302325.8172545.9049855.9934256.0825736.1724316.2629986.3542746.4462596.538953...13.46041213.50766313.55337513.59747513.63989013.68054313.71935613.75624913.79113813.823940
..................................................................
1002.000-0.390000-0.390000-0.390000-0.390000-0.400000-0.390000-0.390000-0.380000-0.370000-0.370000...0.7200000.7500000.7900000.8200000.8600000.9000000.9400000.9800001.0300001.070000
1003.000-0.390000-0.390000-0.390000-0.390000-0.400000-0.390000-0.390000-0.380000-0.370000-0.370000...0.6600000.6800000.7100000.7500000.7900000.8300000.8600000.9000000.9500000.990000
1004.000-0.390000-0.390000-0.390000-0.390000-0.400000-0.390000-0.390000-0.380000-0.380000-0.370000...0.5700000.5700000.6000000.6400000.6800000.7200000.7200000.7700000.8100000.860000
1005.000-0.390000-0.390000-0.390000-0.390000-0.400000-0.390000-0.390000-0.390000-0.380000-0.370000...0.4900000.4800000.5100000.5500000.5900000.6300000.6100000.6500000.7000000.750000
1006.000-0.394500-0.394500-0.394500-0.394500-0.402941-0.396712-0.395783-0.389555-0.383326-0.377097...0.3345930.2867730.3222870.3592760.3977790.4378360.3655880.4088750.4538370.500514
\n", + "

133 rows × 114 columns

\n", + "
" + ], + "text/plain": [ + " 703.30 738.98 774.78 810.84 847.19 883.69 \\\n", + "878.460 6.077600 6.169158 6.264063 6.349100 6.435987 6.524606 \n", + "879.000 6.010000 6.100000 6.190000 6.280000 6.370000 6.450000 \n", + "880.000 5.860000 5.950000 6.040000 6.120000 6.210000 6.300000 \n", + "881.000 5.740000 5.820000 5.910000 6.000000 6.090000 6.180000 \n", + "881.075 5.730232 5.817254 5.904985 5.993425 6.082573 6.172431 \n", + "... ... ... ... ... ... ... \n", + "1002.000 -0.390000 -0.390000 -0.390000 -0.390000 -0.400000 -0.390000 \n", + "1003.000 -0.390000 -0.390000 -0.390000 -0.390000 -0.400000 -0.390000 \n", + "1004.000 -0.390000 -0.390000 -0.390000 -0.390000 -0.400000 -0.390000 \n", + "1005.000 -0.390000 -0.390000 -0.390000 -0.390000 -0.400000 -0.390000 \n", + "1006.000 -0.394500 -0.394500 -0.394500 -0.394500 -0.402941 -0.396712 \n", + "\n", + " 919.63 958.35 999.80 1040.45 ... 13046.74 13366.10 \\\n", + "878.460 6.614836 6.706560 6.799658 6.894011 ... 14.115172 14.189618 \n", + "879.000 6.530000 6.630000 6.720000 6.810000 ... 13.890000 13.950000 \n", + "880.000 6.400000 6.490000 6.580000 6.670000 ... 13.620000 13.670000 \n", + "881.000 6.270000 6.360000 6.450000 6.540000 ... 13.470000 13.520000 \n", + "881.075 6.262998 6.354274 6.446259 6.538953 ... 13.460412 13.507663 \n", + "... ... ... ... ... ... ... ... \n", + "1002.000 -0.390000 -0.380000 -0.370000 -0.370000 ... 0.720000 0.750000 \n", + "1003.000 -0.390000 -0.380000 -0.370000 -0.370000 ... 0.660000 0.680000 \n", + "1004.000 -0.390000 -0.380000 -0.380000 -0.370000 ... 0.570000 0.570000 \n", + "1005.000 -0.390000 -0.390000 -0.380000 -0.370000 ... 0.490000 0.480000 \n", + "1006.000 -0.395783 -0.389555 -0.383326 -0.377097 ... 0.334593 0.286773 \n", + "\n", + " 13691.69 14023.47 14361.35 14705.30 15055.23 15411.12 \\\n", + "878.460 14.264858 14.340961 14.417999 14.496046 14.575175 14.655464 \n", + "879.000 14.010000 14.080000 14.140000 14.210000 14.280000 14.340000 \n", + "880.000 13.720000 13.770000 13.820000 13.870000 13.920000 13.960000 \n", + "881.000 13.560000 13.610000 13.650000 13.690000 13.730000 13.770000 \n", + "881.075 13.553375 13.597475 13.639890 13.680543 13.719356 13.756249 \n", + "... ... ... ... ... ... ... \n", + "1002.000 0.790000 0.820000 0.860000 0.900000 0.940000 0.980000 \n", + "1003.000 0.710000 0.750000 0.790000 0.830000 0.860000 0.900000 \n", + "1004.000 0.600000 0.640000 0.680000 0.720000 0.720000 0.770000 \n", + "1005.000 0.510000 0.550000 0.590000 0.630000 0.610000 0.650000 \n", + "1006.000 0.322287 0.359276 0.397779 0.437836 0.365588 0.408875 \n", + "\n", + " 15772.93 16140.64 \n", + "878.460 14.736990 14.819835 \n", + "879.000 14.410000 14.480000 \n", + "880.000 14.010000 14.050000 \n", + "881.000 13.800000 13.840000 \n", + "881.075 13.791138 13.823940 \n", + "... ... ... \n", + "1002.000 1.030000 1.070000 \n", + "1003.000 0.950000 0.990000 \n", + "1004.000 0.810000 0.860000 \n", + "1005.000 0.700000 0.750000 \n", + "1006.000 0.453837 0.500514 \n", + "\n", + "[133 rows x 114 columns]" + ] + }, + "execution_count": 232, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Column: Discharge Lobith [m3/s]\n", + "# Row: Kilometermarkering\n", + "# Cell: ws -> waterstand [m+NAP]\n", + "\n", + "df['IJssel']" + ] + }, + { + "cell_type": "code", + "execution_count": 278, + "id": "fbcab87f", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "epsg:28992\n" + ] + }, + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
703.3738.98774.78810.84847.19883.69919.63958.35999.81040.45...15772.9316140.64idvwk_idvwk_begindatumpos_tov_asltrwaardeafstandmst_codegeometry
gtlwaarde
854.07.93007.99008.06008.13008.2100008.2900008.3900008.4800008.5700008.660000...19.69000019.840000NaNNaNNaNNaNNaNNaNNaNNone
855.07.71007.78007.85007.93008.0100008.1000008.1900008.2800008.3700008.470000...19.39000019.530000NaNNaNNaNNaNNaNNaNNaNNone
856.07.43007.51007.58007.67007.7500007.8400007.9300008.0300008.1200008.220000...19.21000019.350000NaNNaNNaNNaNNaNNaNNaNNone
857.07.21007.29007.37007.46007.5500007.6400007.7600007.8600007.9500008.050000...19.03000019.160000NaNNaNNaNNaNNaNNaNNaNNone
858.07.04007.13007.22007.31007.4000007.4900007.6200007.7100007.8100007.910000...18.74000018.860000kmmarkeringen.18735641.02019-10-31RNone245.0BPOINT (208483.685 428425.162)
..................................................................
1002.0-0.3900-0.3900-0.3900-0.3900-0.400000-0.390000-0.390000-0.380000-0.370000-0.370000...1.0300001.070000kmmarkeringen.8981412.02012-12-31RNone446.0PPOINT (185552.685 510632.630)
1003.0-0.3900-0.3900-0.3900-0.3900-0.400000-0.390000-0.390000-0.380000-0.370000-0.370000...0.9500000.990000kmmarkeringen.11691413.02012-12-31RNone923.0PPOINT (184456.920 510711.802)
1004.0-0.3900-0.3900-0.3900-0.3900-0.400000-0.390000-0.390000-0.380000-0.380000-0.370000...0.8100000.860000kmmarkeringen.8991413.02012-12-31RNone1919.0PPOINT (183461.379 510741.195)
1005.0-0.3900-0.3900-0.3900-0.3900-0.400000-0.390000-0.390000-0.390000-0.380000-0.370000...0.7000000.750000kmmarkeringen.11701413.02012-12-31RNone2903.0PPOINT (182477.586 510735.885)
1006.0-0.3945-0.3945-0.3945-0.3945-0.402941-0.396712-0.395783-0.389555-0.383326-0.377097...0.4538370.500514NaNNaNNaNNaNNaNNaNNaNNone
\n", + "

384 rows × 122 columns

\n", + "
" + ], + "text/plain": [ + " 703.3 738.98 774.78 810.84 847.19 883.69 919.63 \\\n", + "gtlwaarde \n", + "854.0 7.9300 7.9900 8.0600 8.1300 8.210000 8.290000 8.390000 \n", + "855.0 7.7100 7.7800 7.8500 7.9300 8.010000 8.100000 8.190000 \n", + "856.0 7.4300 7.5100 7.5800 7.6700 7.750000 7.840000 7.930000 \n", + "857.0 7.2100 7.2900 7.3700 7.4600 7.550000 7.640000 7.760000 \n", + "858.0 7.0400 7.1300 7.2200 7.3100 7.400000 7.490000 7.620000 \n", + "... ... ... ... ... ... ... ... \n", + "1002.0 -0.3900 -0.3900 -0.3900 -0.3900 -0.400000 -0.390000 -0.390000 \n", + "1003.0 -0.3900 -0.3900 -0.3900 -0.3900 -0.400000 -0.390000 -0.390000 \n", + "1004.0 -0.3900 -0.3900 -0.3900 -0.3900 -0.400000 -0.390000 -0.390000 \n", + "1005.0 -0.3900 -0.3900 -0.3900 -0.3900 -0.400000 -0.390000 -0.390000 \n", + "1006.0 -0.3945 -0.3945 -0.3945 -0.3945 -0.402941 -0.396712 -0.395783 \n", + "\n", + " 958.35 999.8 1040.45 ... 15772.93 16140.64 \\\n", + "gtlwaarde ... \n", + "854.0 8.480000 8.570000 8.660000 ... 19.690000 19.840000 \n", + "855.0 8.280000 8.370000 8.470000 ... 19.390000 19.530000 \n", + "856.0 8.030000 8.120000 8.220000 ... 19.210000 19.350000 \n", + "857.0 7.860000 7.950000 8.050000 ... 19.030000 19.160000 \n", + "858.0 7.710000 7.810000 7.910000 ... 18.740000 18.860000 \n", + "... ... ... ... ... ... ... \n", + "1002.0 -0.380000 -0.370000 -0.370000 ... 1.030000 1.070000 \n", + "1003.0 -0.380000 -0.370000 -0.370000 ... 0.950000 0.990000 \n", + "1004.0 -0.380000 -0.380000 -0.370000 ... 0.810000 0.860000 \n", + "1005.0 -0.390000 -0.380000 -0.370000 ... 0.700000 0.750000 \n", + "1006.0 -0.389555 -0.383326 -0.377097 ... 0.453837 0.500514 \n", + "\n", + " id vwk_id vwk_begindatum pos_tov_as ltrwaarde \\\n", + "gtlwaarde \n", + "854.0 NaN NaN NaN NaN NaN \n", + "855.0 NaN NaN NaN NaN NaN \n", + "856.0 NaN NaN NaN NaN NaN \n", + "857.0 NaN NaN NaN NaN NaN \n", + "858.0 kmmarkeringen.1873 5641.0 2019-10-31 R None \n", + "... ... ... ... ... ... \n", + "1002.0 kmmarkeringen.898 1412.0 2012-12-31 R None \n", + "1003.0 kmmarkeringen.1169 1413.0 2012-12-31 R None \n", + "1004.0 kmmarkeringen.899 1413.0 2012-12-31 R None \n", + "1005.0 kmmarkeringen.1170 1413.0 2012-12-31 R None \n", + "1006.0 NaN NaN NaN NaN NaN \n", + "\n", + " afstand mst_code geometry \n", + "gtlwaarde \n", + "854.0 NaN NaN None \n", + "855.0 NaN NaN None \n", + "856.0 NaN NaN None \n", + "857.0 NaN NaN None \n", + "858.0 245.0 B POINT (208483.685 428425.162) \n", + "... ... ... ... \n", + "1002.0 446.0 P POINT (185552.685 510632.630) \n", + "1003.0 923.0 P POINT (184456.920 510711.802) \n", + "1004.0 1919.0 P POINT (183461.379 510741.195) \n", + "1005.0 2903.0 P POINT (182477.586 510735.885) \n", + "1006.0 NaN NaN None \n", + "\n", + "[384 rows x 122 columns]" + ] + }, + "execution_count": 278, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# read kilometermarkering\n", + "kmm_df= gpd.read_file(kmmarkering, crs=28992)\n", + "\n", + "# read vaarwegvakken\n", + "vwv_df = gpd.read_file(vaarwegvakken, crs=28992)\n", + "\n", + "print(vwv_df.crs)\n", + "\n", + "vwv = {}\n", + "kmm = {}\n", + "waterdepth = {}\n", + "\n", + "# Dict with vaarwegvakken per River\n", + "for key, value in sheet_names.items():\n", + " # Select vaarwegvakken for River\n", + " vwv[key] = vwv_df.loc[vwv_df[\"vrt_naam\"].str.contains(value, case=False)]\n", + " # Select kilometermarkeringen\n", + " kmm[key] = kmm_df.loc[kmm_df[\"vwk_id\"].isin(vwv[key][\"vwk_id\"])]\n", + " # Merge kilometermarkering with waterdepth data\n", + " waterdepth[key] = df[key].merge(kmm[key], how=\"left\", left_index=True, right_index=False, right_on=\"gtlwaarde\" ).set_index('gtlwaarde')\n", + " \n", + "\n", + "\n", + "ws = pd.concat([waterdepth[\"Bovenrijn-Waal\"], waterdepth[\"Pkan-NRijn-Lek\"], waterdepth[\"IJssel\"]])\n", + "\n", + "ws" + ] + }, + { + "cell_type": "code", + "execution_count": 281, + "id": "be4efdd8", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
703.3738.98774.78810.84847.19883.69919.63958.35999.81040.45...15772.9316140.64idvwk_idvwk_begindatumpos_tov_asltrwaardeafstandmst_codegeometry
gtlwaarde
858.07.047.137.227.317.407.497.627.717.817.91...18.7418.86kmmarkeringen.18735641.02019-10-31RNone245.0BPOINT (208483.685 428425.162)
859.06.906.997.087.187.277.377.497.597.687.78...18.5918.71kmmarkeringen.18745641.02019-10-31RNone1218.0BPOINT (207577.070 428777.472)
860.06.766.866.957.047.147.247.367.467.567.66...18.4618.58kmmarkeringen.18755641.02019-10-31RNone2181.0BPOINT (206648.079 429027.343)
861.06.636.736.826.927.027.127.237.337.437.53...18.2718.38kmmarkeringen.18765641.02019-10-31RNone3193.0BPOINT (205639.535 429074.712)
862.06.526.626.726.826.927.027.137.237.337.43...17.8717.98kmmarkeringen.18775641.02019-10-31RNone4199.0BPOINT (204636.708 429104.943)
..................................................................
1001.0-0.39-0.39-0.39-0.39-0.40-0.39-0.38-0.38-0.37-0.37...1.121.17kmmarkeringen.12604551.02012-12-31RNone1255.0PPOINT (186370.638 510558.876)
1002.0-0.39-0.39-0.39-0.39-0.40-0.39-0.39-0.38-0.37-0.37...1.031.07kmmarkeringen.8981412.02012-12-31RNone446.0PPOINT (185552.685 510632.630)
1003.0-0.39-0.39-0.39-0.39-0.40-0.39-0.39-0.38-0.37-0.37...0.950.99kmmarkeringen.11691413.02012-12-31RNone923.0PPOINT (184456.920 510711.802)
1004.0-0.39-0.39-0.39-0.39-0.40-0.39-0.39-0.38-0.38-0.37...0.810.86kmmarkeringen.8991413.02012-12-31RNone1919.0PPOINT (183461.379 510741.195)
1005.0-0.39-0.39-0.39-0.39-0.40-0.39-0.39-0.39-0.38-0.37...0.700.75kmmarkeringen.11701413.02012-12-31RNone2903.0PPOINT (182477.586 510735.885)
\n", + "

342 rows × 122 columns

\n", + "
" + ], + "text/plain": [ + " 703.3 738.98 774.78 810.84 847.19 883.69 919.63 958.35 \\\n", + "gtlwaarde \n", + "858.0 7.04 7.13 7.22 7.31 7.40 7.49 7.62 7.71 \n", + "859.0 6.90 6.99 7.08 7.18 7.27 7.37 7.49 7.59 \n", + "860.0 6.76 6.86 6.95 7.04 7.14 7.24 7.36 7.46 \n", + "861.0 6.63 6.73 6.82 6.92 7.02 7.12 7.23 7.33 \n", + "862.0 6.52 6.62 6.72 6.82 6.92 7.02 7.13 7.23 \n", + "... ... ... ... ... ... ... ... ... \n", + "1001.0 -0.39 -0.39 -0.39 -0.39 -0.40 -0.39 -0.38 -0.38 \n", + "1002.0 -0.39 -0.39 -0.39 -0.39 -0.40 -0.39 -0.39 -0.38 \n", + "1003.0 -0.39 -0.39 -0.39 -0.39 -0.40 -0.39 -0.39 -0.38 \n", + "1004.0 -0.39 -0.39 -0.39 -0.39 -0.40 -0.39 -0.39 -0.38 \n", + "1005.0 -0.39 -0.39 -0.39 -0.39 -0.40 -0.39 -0.39 -0.39 \n", + "\n", + " 999.8 1040.45 ... 15772.93 16140.64 id \\\n", + "gtlwaarde ... \n", + "858.0 7.81 7.91 ... 18.74 18.86 kmmarkeringen.1873 \n", + "859.0 7.68 7.78 ... 18.59 18.71 kmmarkeringen.1874 \n", + "860.0 7.56 7.66 ... 18.46 18.58 kmmarkeringen.1875 \n", + "861.0 7.43 7.53 ... 18.27 18.38 kmmarkeringen.1876 \n", + "862.0 7.33 7.43 ... 17.87 17.98 kmmarkeringen.1877 \n", + "... ... ... ... ... ... ... \n", + "1001.0 -0.37 -0.37 ... 1.12 1.17 kmmarkeringen.1260 \n", + "1002.0 -0.37 -0.37 ... 1.03 1.07 kmmarkeringen.898 \n", + "1003.0 -0.37 -0.37 ... 0.95 0.99 kmmarkeringen.1169 \n", + "1004.0 -0.38 -0.37 ... 0.81 0.86 kmmarkeringen.899 \n", + "1005.0 -0.38 -0.37 ... 0.70 0.75 kmmarkeringen.1170 \n", + "\n", + " vwk_id vwk_begindatum pos_tov_as ltrwaarde afstand mst_code \\\n", + "gtlwaarde \n", + "858.0 5641.0 2019-10-31 R None 245.0 B \n", + "859.0 5641.0 2019-10-31 R None 1218.0 B \n", + "860.0 5641.0 2019-10-31 R None 2181.0 B \n", + "861.0 5641.0 2019-10-31 R None 3193.0 B \n", + "862.0 5641.0 2019-10-31 R None 4199.0 B \n", + "... ... ... ... ... ... ... \n", + "1001.0 4551.0 2012-12-31 R None 1255.0 P \n", + "1002.0 1412.0 2012-12-31 R None 446.0 P \n", + "1003.0 1413.0 2012-12-31 R None 923.0 P \n", + "1004.0 1413.0 2012-12-31 R None 1919.0 P \n", + "1005.0 1413.0 2012-12-31 R None 2903.0 P \n", + "\n", + " geometry \n", + "gtlwaarde \n", + "858.0 POINT (208483.685 428425.162) \n", + "859.0 POINT (207577.070 428777.472) \n", + "860.0 POINT (206648.079 429027.343) \n", + "861.0 POINT (205639.535 429074.712) \n", + "862.0 POINT (204636.708 429104.943) \n", + "... ... \n", + "1001.0 POINT (186370.638 510558.876) \n", + "1002.0 POINT (185552.685 510632.630) \n", + "1003.0 POINT (184456.920 510711.802) \n", + "1004.0 POINT (183461.379 510741.195) \n", + "1005.0 POINT (182477.586 510735.885) \n", + "\n", + "[342 rows x 122 columns]" + ] + }, + "execution_count": 281, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Not all records have a geometry. Remove all data without geometry\n", + "# This is data between kilometermarkeringen and some points in germany\n", + "ws = ws.loc[~ws['geometry'].isnull()]\n", + "ws" + ] + }, + { + "cell_type": "code", + "execution_count": 285, + "id": "b1d3ff8e", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
703.3738.98774.78810.84847.19883.69919.63958.35999.81040.45...15772.9316140.64idvwk_idvwk_begindatumpos_tov_asltrwaardeafstandmst_codegeometry
gtlwaarde
858.07.047.137.227.317.407.497.627.717.817.91...18.7418.86kmmarkeringen.18735641.02019-10-31RNone245.0BPOINT (6.16330 51.84184)
859.06.906.997.087.187.277.377.497.597.687.78...18.5918.71kmmarkeringen.18745641.02019-10-31RNone1218.0BPOINT (6.15020 51.84509)
860.06.766.866.957.047.147.247.367.467.567.66...18.4618.58kmmarkeringen.18755641.02019-10-31RNone2181.0BPOINT (6.13676 51.84743)
861.06.636.736.826.927.027.127.237.337.437.53...18.2718.38kmmarkeringen.18765641.02019-10-31RNone3193.0BPOINT (6.12213 51.84795)
862.06.526.626.726.826.927.027.137.237.337.43...17.8717.98kmmarkeringen.18775641.02019-10-31RNone4199.0BPOINT (6.10758 51.84831)
..................................................................
1001.0-0.39-0.39-0.39-0.39-0.40-0.39-0.38-0.38-0.37-0.37...1.121.17kmmarkeringen.12604551.02012-12-31RNone1255.0PPOINT (5.85004 52.58171)
1002.0-0.39-0.39-0.39-0.39-0.40-0.39-0.39-0.38-0.37-0.37...1.031.07kmmarkeringen.8981412.02012-12-31RNone446.0PPOINT (5.83798 52.58242)
1003.0-0.39-0.39-0.39-0.39-0.40-0.39-0.39-0.38-0.37-0.37...0.950.99kmmarkeringen.11691413.02012-12-31RNone923.0PPOINT (5.82182 52.58319)
1004.0-0.39-0.39-0.39-0.39-0.40-0.39-0.39-0.38-0.38-0.37...0.810.86kmmarkeringen.8991413.02012-12-31RNone1919.0PPOINT (5.80714 52.58351)
1005.0-0.39-0.39-0.39-0.39-0.40-0.39-0.39-0.39-0.38-0.37...0.700.75kmmarkeringen.11701413.02012-12-31RNone2903.0PPOINT (5.79262 52.58351)
\n", + "

342 rows × 122 columns

\n", + "
" + ], + "text/plain": [ + " 703.3 738.98 774.78 810.84 847.19 883.69 919.63 958.35 \\\n", + "gtlwaarde \n", + "858.0 7.04 7.13 7.22 7.31 7.40 7.49 7.62 7.71 \n", + "859.0 6.90 6.99 7.08 7.18 7.27 7.37 7.49 7.59 \n", + "860.0 6.76 6.86 6.95 7.04 7.14 7.24 7.36 7.46 \n", + "861.0 6.63 6.73 6.82 6.92 7.02 7.12 7.23 7.33 \n", + "862.0 6.52 6.62 6.72 6.82 6.92 7.02 7.13 7.23 \n", + "... ... ... ... ... ... ... ... ... \n", + "1001.0 -0.39 -0.39 -0.39 -0.39 -0.40 -0.39 -0.38 -0.38 \n", + "1002.0 -0.39 -0.39 -0.39 -0.39 -0.40 -0.39 -0.39 -0.38 \n", + "1003.0 -0.39 -0.39 -0.39 -0.39 -0.40 -0.39 -0.39 -0.38 \n", + "1004.0 -0.39 -0.39 -0.39 -0.39 -0.40 -0.39 -0.39 -0.38 \n", + "1005.0 -0.39 -0.39 -0.39 -0.39 -0.40 -0.39 -0.39 -0.39 \n", + "\n", + " 999.8 1040.45 ... 15772.93 16140.64 id \\\n", + "gtlwaarde ... \n", + "858.0 7.81 7.91 ... 18.74 18.86 kmmarkeringen.1873 \n", + "859.0 7.68 7.78 ... 18.59 18.71 kmmarkeringen.1874 \n", + "860.0 7.56 7.66 ... 18.46 18.58 kmmarkeringen.1875 \n", + "861.0 7.43 7.53 ... 18.27 18.38 kmmarkeringen.1876 \n", + "862.0 7.33 7.43 ... 17.87 17.98 kmmarkeringen.1877 \n", + "... ... ... ... ... ... ... \n", + "1001.0 -0.37 -0.37 ... 1.12 1.17 kmmarkeringen.1260 \n", + "1002.0 -0.37 -0.37 ... 1.03 1.07 kmmarkeringen.898 \n", + "1003.0 -0.37 -0.37 ... 0.95 0.99 kmmarkeringen.1169 \n", + "1004.0 -0.38 -0.37 ... 0.81 0.86 kmmarkeringen.899 \n", + "1005.0 -0.38 -0.37 ... 0.70 0.75 kmmarkeringen.1170 \n", + "\n", + " vwk_id vwk_begindatum pos_tov_as ltrwaarde afstand mst_code \\\n", + "gtlwaarde \n", + "858.0 5641.0 2019-10-31 R None 245.0 B \n", + "859.0 5641.0 2019-10-31 R None 1218.0 B \n", + "860.0 5641.0 2019-10-31 R None 2181.0 B \n", + "861.0 5641.0 2019-10-31 R None 3193.0 B \n", + "862.0 5641.0 2019-10-31 R None 4199.0 B \n", + "... ... ... ... ... ... ... \n", + "1001.0 4551.0 2012-12-31 R None 1255.0 P \n", + "1002.0 1412.0 2012-12-31 R None 446.0 P \n", + "1003.0 1413.0 2012-12-31 R None 923.0 P \n", + "1004.0 1413.0 2012-12-31 R None 1919.0 P \n", + "1005.0 1413.0 2012-12-31 R None 2903.0 P \n", + "\n", + " geometry \n", + "gtlwaarde \n", + "858.0 POINT (6.16330 51.84184) \n", + "859.0 POINT (6.15020 51.84509) \n", + "860.0 POINT (6.13676 51.84743) \n", + "861.0 POINT (6.12213 51.84795) \n", + "862.0 POINT (6.10758 51.84831) \n", + "... ... \n", + "1001.0 POINT (5.85004 52.58171) \n", + "1002.0 POINT (5.83798 52.58242) \n", + "1003.0 POINT (5.82182 52.58319) \n", + "1004.0 POINT (5.80714 52.58351) \n", + "1005.0 POINT (5.79262 52.58351) \n", + "\n", + "[342 rows x 122 columns]" + ] + }, + "execution_count": 285, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Transform geometry\n", + "\n", + "\n", + "ws = gpd.GeoDataFrame(ws, crs=28992, geometry=\"geometry\")\n", + "\n", + "# correct crs\n", + "ws = ws.to_crs(4326)\n", + "\n", + "ws" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "444afcdf", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "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.8.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 0518370e2845af61f1f7dd422e7039b71b38d959 Mon Sep 17 00:00:00 2001 From: avgils Date: Mon, 28 Mar 2022 13:05:49 +0200 Subject: [PATCH 2/3] pivot waterdepth data --- notebooks/waterdepths/read_waterdepth.ipynb | 960 +++++++++++++++++++- 1 file changed, 948 insertions(+), 12 deletions(-) diff --git a/notebooks/waterdepths/read_waterdepth.ipynb b/notebooks/waterdepths/read_waterdepth.ipynb index b7e4aea..9b0684f 100644 --- a/notebooks/waterdepths/read_waterdepth.ipynb +++ b/notebooks/waterdepths/read_waterdepth.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 199, + "execution_count": 2, "id": "c7d1f238", "metadata": {}, "outputs": [], @@ -15,7 +15,7 @@ }, { "cell_type": "code", - "execution_count": 208, + "execution_count": 3, "id": "52d0a0f2", "metadata": {}, "outputs": [], @@ -39,7 +39,7 @@ }, { "cell_type": "code", - "execution_count": 257, + "execution_count": 4, "id": "45d8fdcc", "metadata": {}, "outputs": [], @@ -50,7 +50,7 @@ }, { "cell_type": "code", - "execution_count": 232, + "execution_count": 5, "id": "27fb7a6e", "metadata": {}, "outputs": [ @@ -424,7 +424,7 @@ "[133 rows x 114 columns]" ] }, - "execution_count": 232, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -439,7 +439,7 @@ }, { "cell_type": "code", - "execution_count": 278, + "execution_count": 6, "id": "fbcab87f", "metadata": {}, "outputs": [ @@ -848,7 +848,7 @@ "[384 rows x 122 columns]" ] }, - "execution_count": 278, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -884,7 +884,7 @@ }, { "cell_type": "code", - "execution_count": 281, + "execution_count": 7, "id": "be4efdd8", "metadata": {}, "outputs": [ @@ -1286,7 +1286,7 @@ "[342 rows x 122 columns]" ] }, - "execution_count": 281, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -1300,7 +1300,7 @@ }, { "cell_type": "code", - "execution_count": 285, + "execution_count": 8, "id": "b1d3ff8e", "metadata": {}, "outputs": [ @@ -1702,7 +1702,7 @@ "[342 rows x 122 columns]" ] }, - "execution_count": 285, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -1719,10 +1719,946 @@ "ws" ] }, + { + "cell_type": "code", + "execution_count": 20, + "id": "444afcdf", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "703.3\n", + "738.98\n", + "774.78\n", + "810.84\n", + "847.19\n", + "883.69\n", + "919.63\n", + "958.35\n", + "999.8\n", + "1040.45\n", + "1086.43\n", + "1132.09\n", + "1174.75\n", + "1220.3\n", + "1276.71\n", + "1332.89\n", + "1389.89\n", + "1440.46\n", + "1491.85\n", + "1548.53\n", + "1604.12\n", + "1663.56\n", + "1727.38\n", + "1800.0\n", + "1876.32\n", + "1956.62\n", + "2036.96\n", + "2116.38\n", + "2197.67\n", + "2281.39\n", + "2370.8\n", + "2458.96\n", + "2545.62\n", + "2631.89\n", + "2710.93\n", + "2779.94\n", + "2846.66\n", + "2918.79\n", + "2994.65\n", + "3069.62\n", + "3144.53\n", + "3226.28\n", + "3313.69\n", + "3400.9\n", + "3487.51\n", + "3573.57\n", + "3659.33\n", + "3745.05\n", + "3831.06\n", + "3918.13\n", + "4005.78\n", + "4093.2\n", + "4179.64\n", + "4268.09\n", + "4367.78\n", + "4482.65\n", + "4582.86\n", + "4691.63\n", + "4795.37\n", + "4894.45\n", + "4990.69\n", + "5085.69\n", + "5181.0\n", + "5278.17\n", + "5378.76\n", + "5484.33\n", + "5596.42\n", + "5716.61\n", + "5843.44\n", + "5970.38\n", + "6097.83\n", + "6224.09\n", + "6350.46\n", + "6477.09\n", + "6603.79\n", + "6730.57\n", + "6857.39\n", + "6984.21\n", + "7111.01\n", + "7237.78\n", + "7364.52\n", + "7491.26\n", + "7633.14\n", + "7813.33\n", + "7999.62\n", + "8192.04\n", + "8390.61\n", + "8595.36\n", + "8806.33\n", + "9023.53\n", + "9247.01\n", + "9476.79\n", + "9712.91\n", + "9955.4\n", + "10204.27\n", + "10459.56\n", + "10721.28\n", + "10989.44\n", + "11264.06\n", + "11545.12\n", + "11832.64\n", + "12126.59\n", + "12426.94\n", + "12733.67\n", + "13046.74\n", + "13366.1\n", + "13691.69\n", + "14023.47\n", + "14361.35\n", + "14705.3\n", + "15055.23\n", + "15411.12\n", + "15772.93\n", + "16140.64\n", + "id\n", + "vwk_id\n", + "vwk_begindatum\n", + "pos_tov_as\n", + "ltrwaarde\n", + "afstand\n", + "mst_code\n", + "geometry\n" + ] + } + ], + "source": [ + "for col in ws.columns:\n", + " ws = ws.rename(columns={col: str(col)})\n" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "a6fb08a1", + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "ws.to_file(\"ws.geojson\", driver='GeoJSON')" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "ce99b5a6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
703.3738.98774.78810.84847.19883.69919.63958.35999.81040.45...15772.9316140.64idvwk_idvwk_begindatumpos_tov_asltrwaardeafstandmst_codegeometry
gtlwaarde
858.07.047.137.227.317.407.497.627.717.817.91...18.7418.86kmmarkeringen.18735641.02019-10-31RNone245.0BPOINT (6.16330 51.84184)
859.06.906.997.087.187.277.377.497.597.687.78...18.5918.71kmmarkeringen.18745641.02019-10-31RNone1218.0BPOINT (6.15020 51.84509)
860.06.766.866.957.047.147.247.367.467.567.66...18.4618.58kmmarkeringen.18755641.02019-10-31RNone2181.0BPOINT (6.13676 51.84743)
861.06.636.736.826.927.027.127.237.337.437.53...18.2718.38kmmarkeringen.18765641.02019-10-31RNone3193.0BPOINT (6.12213 51.84795)
862.06.526.626.726.826.927.027.137.237.337.43...17.8717.98kmmarkeringen.18775641.02019-10-31RNone4199.0BPOINT (6.10758 51.84831)
..................................................................
1001.0-0.39-0.39-0.39-0.39-0.40-0.39-0.38-0.38-0.37-0.37...1.121.17kmmarkeringen.12604551.02012-12-31RNone1255.0PPOINT (5.85004 52.58171)
1002.0-0.39-0.39-0.39-0.39-0.40-0.39-0.39-0.38-0.37-0.37...1.031.07kmmarkeringen.8981412.02012-12-31RNone446.0PPOINT (5.83798 52.58242)
1003.0-0.39-0.39-0.39-0.39-0.40-0.39-0.39-0.38-0.37-0.37...0.950.99kmmarkeringen.11691413.02012-12-31RNone923.0PPOINT (5.82182 52.58319)
1004.0-0.39-0.39-0.39-0.39-0.40-0.39-0.39-0.38-0.38-0.37...0.810.86kmmarkeringen.8991413.02012-12-31RNone1919.0PPOINT (5.80714 52.58351)
1005.0-0.39-0.39-0.39-0.39-0.40-0.39-0.39-0.39-0.38-0.37...0.700.75kmmarkeringen.11701413.02012-12-31RNone2903.0PPOINT (5.79262 52.58351)
\n", + "

342 rows × 122 columns

\n", + "
" + ], + "text/plain": [ + " 703.3 738.98 774.78 810.84 847.19 883.69 919.63 958.35 \\\n", + "gtlwaarde \n", + "858.0 7.04 7.13 7.22 7.31 7.40 7.49 7.62 7.71 \n", + "859.0 6.90 6.99 7.08 7.18 7.27 7.37 7.49 7.59 \n", + "860.0 6.76 6.86 6.95 7.04 7.14 7.24 7.36 7.46 \n", + "861.0 6.63 6.73 6.82 6.92 7.02 7.12 7.23 7.33 \n", + "862.0 6.52 6.62 6.72 6.82 6.92 7.02 7.13 7.23 \n", + "... ... ... ... ... ... ... ... ... \n", + "1001.0 -0.39 -0.39 -0.39 -0.39 -0.40 -0.39 -0.38 -0.38 \n", + "1002.0 -0.39 -0.39 -0.39 -0.39 -0.40 -0.39 -0.39 -0.38 \n", + "1003.0 -0.39 -0.39 -0.39 -0.39 -0.40 -0.39 -0.39 -0.38 \n", + "1004.0 -0.39 -0.39 -0.39 -0.39 -0.40 -0.39 -0.39 -0.38 \n", + "1005.0 -0.39 -0.39 -0.39 -0.39 -0.40 -0.39 -0.39 -0.39 \n", + "\n", + " 999.8 1040.45 ... 15772.93 16140.64 id \\\n", + "gtlwaarde ... \n", + "858.0 7.81 7.91 ... 18.74 18.86 kmmarkeringen.1873 \n", + "859.0 7.68 7.78 ... 18.59 18.71 kmmarkeringen.1874 \n", + "860.0 7.56 7.66 ... 18.46 18.58 kmmarkeringen.1875 \n", + "861.0 7.43 7.53 ... 18.27 18.38 kmmarkeringen.1876 \n", + "862.0 7.33 7.43 ... 17.87 17.98 kmmarkeringen.1877 \n", + "... ... ... ... ... ... ... \n", + "1001.0 -0.37 -0.37 ... 1.12 1.17 kmmarkeringen.1260 \n", + "1002.0 -0.37 -0.37 ... 1.03 1.07 kmmarkeringen.898 \n", + "1003.0 -0.37 -0.37 ... 0.95 0.99 kmmarkeringen.1169 \n", + "1004.0 -0.38 -0.37 ... 0.81 0.86 kmmarkeringen.899 \n", + "1005.0 -0.38 -0.37 ... 0.70 0.75 kmmarkeringen.1170 \n", + "\n", + " vwk_id vwk_begindatum pos_tov_as ltrwaarde afstand mst_code \\\n", + "gtlwaarde \n", + "858.0 5641.0 2019-10-31 R None 245.0 B \n", + "859.0 5641.0 2019-10-31 R None 1218.0 B \n", + "860.0 5641.0 2019-10-31 R None 2181.0 B \n", + "861.0 5641.0 2019-10-31 R None 3193.0 B \n", + "862.0 5641.0 2019-10-31 R None 4199.0 B \n", + "... ... ... ... ... ... ... \n", + "1001.0 4551.0 2012-12-31 R None 1255.0 P \n", + "1002.0 1412.0 2012-12-31 R None 446.0 P \n", + "1003.0 1413.0 2012-12-31 R None 923.0 P \n", + "1004.0 1413.0 2012-12-31 R None 1919.0 P \n", + "1005.0 1413.0 2012-12-31 R None 2903.0 P \n", + "\n", + " geometry \n", + "gtlwaarde \n", + "858.0 POINT (6.16330 51.84184) \n", + "859.0 POINT (6.15020 51.84509) \n", + "860.0 POINT (6.13676 51.84743) \n", + "861.0 POINT (6.12213 51.84795) \n", + "862.0 POINT (6.10758 51.84831) \n", + "... ... \n", + "1001.0 POINT (5.85004 52.58171) \n", + "1002.0 POINT (5.83798 52.58242) \n", + "1003.0 POINT (5.82182 52.58319) \n", + "1004.0 POINT (5.80714 52.58351) \n", + "1005.0 POINT (5.79262 52.58351) \n", + "\n", + "[342 rows x 122 columns]" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ws" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "02e8671e", + "metadata": {}, + "outputs": [], + "source": [ + "values = ['703.3',\n", + "'738.98',\n", + "'774.78',\n", + "'810.84',\n", + "'847.19',\n", + "'883.69',\n", + "'919.63',\n", + "'958.35',\n", + "'999.8',\n", + "'1040.45',\n", + "'1086.43',\n", + "'1132.09',\n", + "'1174.75',\n", + "'1220.3',\n", + "'1276.71',\n", + "'1332.89',\n", + "'1389.89',\n", + "'1440.46',\n", + "'1491.85',\n", + "'1548.53',\n", + "'1604.12',\n", + "'1663.56',\n", + "'1727.38',\n", + "'1800.0',\n", + "'1876.32',\n", + "'1956.62',\n", + "'2036.96',\n", + "'2116.38',\n", + "'2197.67',\n", + "'2281.39',\n", + "'2370.8',\n", + "'2458.96',\n", + "'2545.62',\n", + "'2631.89',\n", + "'2710.93',\n", + "'2779.94',\n", + "'2846.66',\n", + "'2918.79',\n", + "'2994.65',\n", + "'3069.62',\n", + "'3144.53',\n", + "'3226.28',\n", + "'3313.69',\n", + "'3400.9',\n", + "'3487.51',\n", + "'3573.57',\n", + "'3659.33',\n", + "'3745.05',\n", + "'3831.06',\n", + "'3918.13',\n", + "'4005.78',\n", + "'4093.2',\n", + "'4179.64',\n", + "'4268.09',\n", + "'4367.78',\n", + "'4482.65',\n", + "'4582.86',\n", + "'4691.63',\n", + "'4795.37',\n", + "'4894.45',\n", + "'4990.69',\n", + "'5085.69',\n", + "'5181.0',\n", + "'5278.17',\n", + "'5378.76',\n", + "'5484.33',\n", + "'5596.42',\n", + "'5716.61',\n", + "'5843.44',\n", + "'5970.38',\n", + "'6097.83',\n", + "'6224.09',\n", + "'6350.46',\n", + "'6477.09',\n", + "'6603.79',\n", + "'6730.57',\n", + "'6857.39',\n", + "'6984.21',\n", + "'7111.01',\n", + "'7237.78',\n", + "'7364.52',\n", + "'7491.26',\n", + "'7633.14',\n", + "'7813.33',\n", + "'7999.62',\n", + "'8192.04',\n", + "'8390.61',\n", + "'8595.36',\n", + "'8806.33',\n", + "'9023.53',\n", + "'9247.01',\n", + "'9476.79',\n", + "'9712.91',\n", + "'9955.4',\n", + "'10204.27',\n", + "'10459.56',\n", + "'10721.28',\n", + "'10989.44',\n", + "'11264.06',\n", + "'11545.12',\n", + "'11832.64',\n", + "'12126.59',\n", + "'12426.94',\n", + "'12733.67',\n", + "'13046.74',\n", + "'13366.1',\n", + "'13691.69',\n", + "'14023.47',\n", + "'14361.35',\n", + "'14705.3',\n", + "'15055.23',\n", + "'15411.12',\n", + "'15772.93',\n", + "'16140.64',]\n", + "\n", + "\n", + "ids = ['id',\n", + "'vwk_id',\n", + "'vwk_begindatum',\n", + "'pos_tov_as',\n", + "'ltrwaarde',\n", + "'afstand',\n", + "'mst_code',\n", + "'geometry',]\n", + "\n", + "ws = ws.melt(id_vars=ids, value_vars=values).rename(columns={\"variable\": \"discharge\", \"value\": \"ws\"})" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "e5fe84ae", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
idvwk_idvwk_begindatumpos_tov_asltrwaardeafstandmst_codegeometrydischargews
0kmmarkeringen.18735641.02019-10-31RNone245.0BPOINT (6.16330 51.84184)703.37.04
1kmmarkeringen.18745641.02019-10-31RNone1218.0BPOINT (6.15020 51.84509)703.36.90
2kmmarkeringen.18755641.02019-10-31RNone2181.0BPOINT (6.13676 51.84743)703.36.76
3kmmarkeringen.18765641.02019-10-31RNone3193.0BPOINT (6.12213 51.84795)703.36.63
4kmmarkeringen.18775641.02019-10-31RNone4199.0BPOINT (6.10758 51.84831)703.36.52
.................................
38983kmmarkeringen.12604551.02012-12-31RNone1255.0PPOINT (5.85004 52.58171)16140.641.17
38984kmmarkeringen.8981412.02012-12-31RNone446.0PPOINT (5.83798 52.58242)16140.641.07
38985kmmarkeringen.11691413.02012-12-31RNone923.0PPOINT (5.82182 52.58319)16140.640.99
38986kmmarkeringen.8991413.02012-12-31RNone1919.0PPOINT (5.80714 52.58351)16140.640.86
38987kmmarkeringen.11701413.02012-12-31RNone2903.0PPOINT (5.79262 52.58351)16140.640.75
\n", + "

38988 rows × 10 columns

\n", + "
" + ], + "text/plain": [ + " id vwk_id vwk_begindatum pos_tov_as ltrwaarde \\\n", + "0 kmmarkeringen.1873 5641.0 2019-10-31 R None \n", + "1 kmmarkeringen.1874 5641.0 2019-10-31 R None \n", + "2 kmmarkeringen.1875 5641.0 2019-10-31 R None \n", + "3 kmmarkeringen.1876 5641.0 2019-10-31 R None \n", + "4 kmmarkeringen.1877 5641.0 2019-10-31 R None \n", + "... ... ... ... ... ... \n", + "38983 kmmarkeringen.1260 4551.0 2012-12-31 R None \n", + "38984 kmmarkeringen.898 1412.0 2012-12-31 R None \n", + "38985 kmmarkeringen.1169 1413.0 2012-12-31 R None \n", + "38986 kmmarkeringen.899 1413.0 2012-12-31 R None \n", + "38987 kmmarkeringen.1170 1413.0 2012-12-31 R None \n", + "\n", + " afstand mst_code geometry discharge ws \n", + "0 245.0 B POINT (6.16330 51.84184) 703.3 7.04 \n", + "1 1218.0 B POINT (6.15020 51.84509) 703.3 6.90 \n", + "2 2181.0 B POINT (6.13676 51.84743) 703.3 6.76 \n", + "3 3193.0 B POINT (6.12213 51.84795) 703.3 6.63 \n", + "4 4199.0 B POINT (6.10758 51.84831) 703.3 6.52 \n", + "... ... ... ... ... ... \n", + "38983 1255.0 P POINT (5.85004 52.58171) 16140.64 1.17 \n", + "38984 446.0 P POINT (5.83798 52.58242) 16140.64 1.07 \n", + "38985 923.0 P POINT (5.82182 52.58319) 16140.64 0.99 \n", + "38986 1919.0 P POINT (5.80714 52.58351) 16140.64 0.86 \n", + "38987 2903.0 P POINT (5.79262 52.58351) 16140.64 0.75 \n", + "\n", + "[38988 rows x 10 columns]" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ws" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "id": "d0b41ab9", + "metadata": {}, + "outputs": [], + "source": [ + "ws.to_file(\"ws.geojson\", driver='GeoJSON')" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "444afcdf", + "id": "f48fa0b9", "metadata": {}, "outputs": [], "source": [] From 838a02448a22fcf94731ca2df231a9d00e5e7c6e Mon Sep 17 00:00:00 2001 From: avgils Date: Mon, 28 Mar 2022 13:14:11 +0200 Subject: [PATCH 3/3] cleanup notebook --- notebooks/waterdepths/read_waterdepth.ipynb | 320 +++----------------- 1 file changed, 34 insertions(+), 286 deletions(-) diff --git a/notebooks/waterdepths/read_waterdepth.ipynb b/notebooks/waterdepths/read_waterdepth.ipynb index 9b0684f..4a4f91e 100644 --- a/notebooks/waterdepths/read_waterdepth.ipynb +++ b/notebooks/waterdepths/read_waterdepth.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": 43, "id": "c7d1f238", "metadata": {}, "outputs": [], @@ -15,7 +15,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 44, "id": "52d0a0f2", "metadata": {}, "outputs": [], @@ -39,7 +39,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 45, "id": "45d8fdcc", "metadata": {}, "outputs": [], @@ -50,7 +50,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 46, "id": "27fb7a6e", "metadata": {}, "outputs": [ @@ -424,7 +424,7 @@ "[133 rows x 114 columns]" ] }, - "execution_count": 5, + "execution_count": 46, "metadata": {}, "output_type": "execute_result" } @@ -439,7 +439,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 47, "id": "fbcab87f", "metadata": {}, "outputs": [ @@ -848,7 +848,7 @@ "[384 rows x 122 columns]" ] }, - "execution_count": 6, + "execution_count": 47, "metadata": {}, "output_type": "execute_result" } @@ -884,7 +884,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 48, "id": "be4efdd8", "metadata": {}, "outputs": [ @@ -1286,7 +1286,7 @@ "[342 rows x 122 columns]" ] }, - "execution_count": 7, + "execution_count": 48, "metadata": {}, "output_type": "execute_result" } @@ -1300,7 +1300,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 49, "id": "b1d3ff8e", "metadata": {}, "outputs": [ @@ -1702,7 +1702,7 @@ "[342 rows x 122 columns]" ] }, - "execution_count": 8, + "execution_count": 49, "metadata": {}, "output_type": "execute_result" } @@ -1721,159 +1721,21 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 50, "id": "444afcdf", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "703.3\n", - "738.98\n", - "774.78\n", - "810.84\n", - "847.19\n", - "883.69\n", - "919.63\n", - "958.35\n", - "999.8\n", - "1040.45\n", - "1086.43\n", - "1132.09\n", - "1174.75\n", - "1220.3\n", - "1276.71\n", - "1332.89\n", - "1389.89\n", - "1440.46\n", - "1491.85\n", - "1548.53\n", - "1604.12\n", - "1663.56\n", - "1727.38\n", - "1800.0\n", - "1876.32\n", - "1956.62\n", - "2036.96\n", - "2116.38\n", - "2197.67\n", - "2281.39\n", - "2370.8\n", - "2458.96\n", - "2545.62\n", - "2631.89\n", - "2710.93\n", - "2779.94\n", - "2846.66\n", - "2918.79\n", - "2994.65\n", - "3069.62\n", - "3144.53\n", - "3226.28\n", - "3313.69\n", - "3400.9\n", - "3487.51\n", - "3573.57\n", - "3659.33\n", - "3745.05\n", - "3831.06\n", - "3918.13\n", - "4005.78\n", - "4093.2\n", - "4179.64\n", - "4268.09\n", - "4367.78\n", - "4482.65\n", - "4582.86\n", - "4691.63\n", - "4795.37\n", - "4894.45\n", - "4990.69\n", - "5085.69\n", - "5181.0\n", - "5278.17\n", - "5378.76\n", - "5484.33\n", - "5596.42\n", - "5716.61\n", - "5843.44\n", - "5970.38\n", - "6097.83\n", - "6224.09\n", - "6350.46\n", - "6477.09\n", - "6603.79\n", - "6730.57\n", - "6857.39\n", - "6984.21\n", - "7111.01\n", - "7237.78\n", - "7364.52\n", - "7491.26\n", - "7633.14\n", - "7813.33\n", - "7999.62\n", - "8192.04\n", - "8390.61\n", - "8595.36\n", - "8806.33\n", - "9023.53\n", - "9247.01\n", - "9476.79\n", - "9712.91\n", - "9955.4\n", - "10204.27\n", - "10459.56\n", - "10721.28\n", - "10989.44\n", - "11264.06\n", - "11545.12\n", - "11832.64\n", - "12126.59\n", - "12426.94\n", - "12733.67\n", - "13046.74\n", - "13366.1\n", - "13691.69\n", - "14023.47\n", - "14361.35\n", - "14705.3\n", - "15055.23\n", - "15411.12\n", - "15772.93\n", - "16140.64\n", - "id\n", - "vwk_id\n", - "vwk_begindatum\n", - "pos_tov_as\n", - "ltrwaarde\n", - "afstand\n", - "mst_code\n", - "geometry\n" - ] - } - ], - "source": [ - "for col in ws.columns:\n", - " ws = ws.rename(columns={col: str(col)})\n" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "id": "a6fb08a1", - "metadata": {}, "outputs": [], "source": [ "\n", - "ws.to_file(\"ws.geojson\", driver='GeoJSON')" + "\n", + "# for col in ws.columns:\n", + "# ws = ws.rename(columns={col: str(col)})\n" ] }, { "cell_type": "code", - "execution_count": 23, - "id": "ce99b5a6", + "execution_count": 51, + "id": "806c89ec", "metadata": {}, "outputs": [ { @@ -2274,7 +2136,7 @@ "[342 rows x 122 columns]" ] }, - "execution_count": 23, + "execution_count": 51, "metadata": {}, "output_type": "execute_result" } @@ -2285,143 +2147,29 @@ }, { "cell_type": "code", - "execution_count": 32, - "id": "02e8671e", + "execution_count": 53, + "id": "646772ee", "metadata": {}, "outputs": [], "source": [ - "values = ['703.3',\n", - "'738.98',\n", - "'774.78',\n", - "'810.84',\n", - "'847.19',\n", - "'883.69',\n", - "'919.63',\n", - "'958.35',\n", - "'999.8',\n", - "'1040.45',\n", - "'1086.43',\n", - "'1132.09',\n", - "'1174.75',\n", - "'1220.3',\n", - "'1276.71',\n", - "'1332.89',\n", - "'1389.89',\n", - "'1440.46',\n", - "'1491.85',\n", - "'1548.53',\n", - "'1604.12',\n", - "'1663.56',\n", - "'1727.38',\n", - "'1800.0',\n", - "'1876.32',\n", - "'1956.62',\n", - "'2036.96',\n", - "'2116.38',\n", - "'2197.67',\n", - "'2281.39',\n", - "'2370.8',\n", - "'2458.96',\n", - "'2545.62',\n", - "'2631.89',\n", - "'2710.93',\n", - "'2779.94',\n", - "'2846.66',\n", - "'2918.79',\n", - "'2994.65',\n", - "'3069.62',\n", - "'3144.53',\n", - "'3226.28',\n", - "'3313.69',\n", - "'3400.9',\n", - "'3487.51',\n", - "'3573.57',\n", - "'3659.33',\n", - "'3745.05',\n", - "'3831.06',\n", - "'3918.13',\n", - "'4005.78',\n", - "'4093.2',\n", - "'4179.64',\n", - "'4268.09',\n", - "'4367.78',\n", - "'4482.65',\n", - "'4582.86',\n", - "'4691.63',\n", - "'4795.37',\n", - "'4894.45',\n", - "'4990.69',\n", - "'5085.69',\n", - "'5181.0',\n", - "'5278.17',\n", - "'5378.76',\n", - "'5484.33',\n", - "'5596.42',\n", - "'5716.61',\n", - "'5843.44',\n", - "'5970.38',\n", - "'6097.83',\n", - "'6224.09',\n", - "'6350.46',\n", - "'6477.09',\n", - "'6603.79',\n", - "'6730.57',\n", - "'6857.39',\n", - "'6984.21',\n", - "'7111.01',\n", - "'7237.78',\n", - "'7364.52',\n", - "'7491.26',\n", - "'7633.14',\n", - "'7813.33',\n", - "'7999.62',\n", - "'8192.04',\n", - "'8390.61',\n", - "'8595.36',\n", - "'8806.33',\n", - "'9023.53',\n", - "'9247.01',\n", - "'9476.79',\n", - "'9712.91',\n", - "'9955.4',\n", - "'10204.27',\n", - "'10459.56',\n", - "'10721.28',\n", - "'10989.44',\n", - "'11264.06',\n", - "'11545.12',\n", - "'11832.64',\n", - "'12126.59',\n", - "'12426.94',\n", - "'12733.67',\n", - "'13046.74',\n", - "'13366.1',\n", - "'13691.69',\n", - "'14023.47',\n", - "'14361.35',\n", - "'14705.3',\n", - "'15055.23',\n", - "'15411.12',\n", - "'15772.93',\n", - "'16140.64',]\n", + "# Pivot dataframe l for a waterdepth as function of the discharge at Lobith\n", "\n", + "values = []\n", + "ids = []\n", "\n", - "ids = ['id',\n", - "'vwk_id',\n", - "'vwk_begindatum',\n", - "'pos_tov_as',\n", - "'ltrwaarde',\n", - "'afstand',\n", - "'mst_code',\n", - "'geometry',]\n", + "for col in ws.columns:\n", + " if type(col) is float:\n", + " values.append(col)\n", + " else:\n", + " ids.append(col)\n", "\n", "ws = ws.melt(id_vars=ids, value_vars=values).rename(columns={\"variable\": \"discharge\", \"value\": \"ws\"})" ] }, { "cell_type": "code", - "execution_count": 33, - "id": "e5fe84ae", + "execution_count": 54, + "id": "fb9fa986", "metadata": {}, "outputs": [ { @@ -2636,7 +2384,7 @@ "[38988 rows x 10 columns]" ] }, - "execution_count": 33, + "execution_count": 54, "metadata": {}, "output_type": "execute_result" } @@ -2647,8 +2395,8 @@ }, { "cell_type": "code", - "execution_count": 34, - "id": "d0b41ab9", + "execution_count": 55, + "id": "aa2cf440", "metadata": {}, "outputs": [], "source": [ @@ -2658,7 +2406,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f48fa0b9", + "id": "008c5c58", "metadata": {}, "outputs": [], "source": []