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alid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
14 |
+
"\u001b[0m\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
15 |
+
"\u001b[0mCollecting streamlit\n",
|
16 |
+
" Obtaining dependency information for streamlit from https://files.pythonhosted.org/packages/3d/b0/031933cb253d757dfc8791707d413ce90ab52ec7fb4524ef955070136d31/streamlit-1.43.2-py2.py3-none-any.whl.metadata\n",
|
17 |
+
" Downloading streamlit-1.43.2-py2.py3-none-any.whl.metadata (8.9 kB)\n",
|
18 |
+
"Requirement already satisfied: altair<6,>=4.0 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from streamlit) (5.3.0)\n",
|
19 |
+
"Requirement already satisfied: blinker<2,>=1.0.0 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from streamlit) (1.9.0)\n",
|
20 |
+
"Requirement already satisfied: cachetools<6,>=4.0 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from streamlit) (5.3.2)\n",
|
21 |
+
"Requirement already satisfied: click<9,>=7.0 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from streamlit) (8.1.7)\n",
|
22 |
+
"Requirement already satisfied: numpy<3,>=1.23 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from streamlit) (1.26.4)\n",
|
23 |
+
"Requirement already satisfied: packaging<25,>=20 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from streamlit) (24.1)\n",
|
24 |
+
"Requirement already satisfied: pandas<3,>=1.4.0 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from streamlit) (2.0.3)\n",
|
25 |
+
"Requirement already satisfied: pillow<12,>=7.1.0 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from streamlit) (10.2.0)\n",
|
26 |
+
"Requirement already satisfied: protobuf<6,>=3.20 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from streamlit) (4.23.4)\n",
|
27 |
+
"Requirement already satisfied: pyarrow>=7.0 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from streamlit) (15.0.2)\n",
|
28 |
+
"Requirement already satisfied: requests<3,>=2.27 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from streamlit) (2.31.0)\n",
|
29 |
+
"Requirement already satisfied: tenacity<10,>=8.1.0 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from streamlit) (8.4.2)\n",
|
30 |
+
"Collecting toml<2,>=0.10.1 (from streamlit)\n",
|
31 |
+
" Obtaining dependency information for toml<2,>=0.10.1 from https://files.pythonhosted.org/packages/44/6f/7120676b6d73228c96e17f1f794d8ab046fc910d781c8d151120c3f1569e/toml-0.10.2-py2.py3-none-any.whl.metadata\n",
|
32 |
+
" Downloading toml-0.10.2-py2.py3-none-any.whl.metadata (7.1 kB)\n",
|
33 |
+
"Requirement already satisfied: typing-extensions<5,>=4.4.0 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from streamlit) (4.12.2)\n",
|
34 |
+
"Collecting watchdog<7,>=2.1.5 (from streamlit)\n",
|
35 |
+
" Obtaining dependency information for watchdog<7,>=2.1.5 from https://files.pythonhosted.org/packages/b5/e8/dbf020b4d98251a9860752a094d09a65e1b436ad181faf929983f697048f/watchdog-6.0.0-py3-none-manylinux2014_x86_64.whl.metadata\n",
|
36 |
+
" Downloading watchdog-6.0.0-py3-none-manylinux2014_x86_64.whl.metadata (44 kB)\n",
|
37 |
+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m44.3/44.3 kB\u001b[0m \u001b[31m1.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
38 |
+
"\u001b[?25hCollecting gitpython!=3.1.19,<4,>=3.0.7 (from streamlit)\n",
|
39 |
+
" Obtaining dependency information for gitpython!=3.1.19,<4,>=3.0.7 from https://files.pythonhosted.org/packages/1d/9a/4114a9057db2f1462d5c8f8390ab7383925fe1ac012eaa42402ad65c2963/GitPython-3.1.44-py3-none-any.whl.metadata\n",
|
40 |
+
" Downloading GitPython-3.1.44-py3-none-any.whl.metadata (13 kB)\n",
|
41 |
+
"Collecting pydeck<1,>=0.8.0b4 (from streamlit)\n",
|
42 |
+
" Obtaining dependency information for pydeck<1,>=0.8.0b4 from https://files.pythonhosted.org/packages/ab/4c/b888e6cf58bd9db9c93f40d1c6be8283ff49d88919231afe93a6bcf61626/pydeck-0.9.1-py2.py3-none-any.whl.metadata\n",
|
43 |
+
" Downloading pydeck-0.9.1-py2.py3-none-any.whl.metadata (4.1 kB)\n",
|
44 |
+
"Requirement already satisfied: tornado<7,>=6.0.3 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from streamlit) (6.3.3)\n",
|
45 |
+
"Requirement already satisfied: jinja2 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from altair<6,>=4.0->streamlit) (3.1.2)\n",
|
46 |
+
"Requirement already satisfied: jsonschema>=3.0 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from altair<6,>=4.0->streamlit) (4.19.0)\n",
|
47 |
+
"Requirement already satisfied: toolz in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from altair<6,>=4.0->streamlit) (0.12.1)\n",
|
48 |
+
"Collecting gitdb<5,>=4.0.1 (from gitpython!=3.1.19,<4,>=3.0.7->streamlit)\n",
|
49 |
+
" Obtaining dependency information for gitdb<5,>=4.0.1 from https://files.pythonhosted.org/packages/a0/61/5c78b91c3143ed5c14207f463aecfc8f9dbb5092fb2869baf37c273b2705/gitdb-4.0.12-py3-none-any.whl.metadata\n",
|
50 |
+
" Downloading gitdb-4.0.12-py3-none-any.whl.metadata (1.2 kB)\n",
|
51 |
+
"Requirement already satisfied: python-dateutil>=2.8.2 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from pandas<3,>=1.4.0->streamlit) (2.8.2)\n",
|
52 |
+
"Requirement already satisfied: pytz>=2020.1 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from pandas<3,>=1.4.0->streamlit) (2023.3.post1)\n",
|
53 |
+
"Requirement already satisfied: tzdata>=2022.1 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from pandas<3,>=1.4.0->streamlit) (2023.3)\n",
|
54 |
+
"Requirement already satisfied: charset-normalizer<4,>=2 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from requests<3,>=2.27->streamlit) (3.2.0)\n",
|
55 |
+
"Requirement already satisfied: idna<4,>=2.5 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from requests<3,>=2.27->streamlit) (3.4)\n",
|
56 |
+
"Requirement already satisfied: urllib3<3,>=1.21.1 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from requests<3,>=2.27->streamlit) (2.0.4)\n",
|
57 |
+
"Requirement already satisfied: certifi>=2017.4.17 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from requests<3,>=2.27->streamlit) (2024.7.4)\n",
|
58 |
+
"Collecting smmap<6,>=3.0.1 (from gitdb<5,>=4.0.1->gitpython!=3.1.19,<4,>=3.0.7->streamlit)\n",
|
59 |
+
" Obtaining dependency information for smmap<6,>=3.0.1 from https://files.pythonhosted.org/packages/04/be/d09147ad1ec7934636ad912901c5fd7667e1c858e19d355237db0d0cd5e4/smmap-5.0.2-py3-none-any.whl.metadata\n",
|
60 |
+
" Downloading smmap-5.0.2-py3-none-any.whl.metadata (4.3 kB)\n",
|
61 |
+
"Requirement already satisfied: MarkupSafe>=2.0 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from jinja2->altair<6,>=4.0->streamlit) (2.1.3)\n",
|
62 |
+
"Requirement already satisfied: attrs>=22.2.0 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from jsonschema>=3.0->altair<6,>=4.0->streamlit) (23.1.0)\n",
|
63 |
+
"Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from jsonschema>=3.0->altair<6,>=4.0->streamlit) (2023.7.1)\n",
|
64 |
+
"Requirement already satisfied: referencing>=0.28.4 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from jsonschema>=3.0->altair<6,>=4.0->streamlit) (0.30.2)\n",
|
65 |
+
"Requirement already satisfied: rpds-py>=0.7.1 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from jsonschema>=3.0->altair<6,>=4.0->streamlit) (0.10.2)\n",
|
66 |
+
"Requirement already satisfied: six>=1.5 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from python-dateutil>=2.8.2->pandas<3,>=1.4.0->streamlit) (1.16.0)\n",
|
67 |
+
"Downloading streamlit-1.43.2-py2.py3-none-any.whl (9.7 MB)\n",
|
68 |
+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m9.7/9.7 MB\u001b[0m \u001b[31m13.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n",
|
69 |
+
"\u001b[?25hDownloading GitPython-3.1.44-py3-none-any.whl (207 kB)\n",
|
70 |
+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m207.6/207.6 kB\u001b[0m \u001b[31m1.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m\n",
|
71 |
+
"\u001b[?25hDownloading pydeck-0.9.1-py2.py3-none-any.whl (6.9 MB)\n",
|
72 |
+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.9/6.9 MB\u001b[0m \u001b[31m29.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n",
|
73 |
+
"\u001b[?25hDownloading toml-0.10.2-py2.py3-none-any.whl (16 kB)\n",
|
74 |
+
"Downloading watchdog-6.0.0-py3-none-manylinux2014_x86_64.whl (79 kB)\n",
|
75 |
+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m79.1/79.1 kB\u001b[0m \u001b[31m1.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0mta \u001b[36m0:00:01\u001b[0m\n",
|
76 |
+
"\u001b[?25hDownloading gitdb-4.0.12-py3-none-any.whl (62 kB)\n",
|
77 |
+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m62.8/62.8 kB\u001b[0m \u001b[31m2.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
78 |
+
"\u001b[?25hDownloading smmap-5.0.2-py3-none-any.whl (24 kB)\n",
|
79 |
+
"\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
80 |
+
"\u001b[0mInstalling collected packages: watchdog, toml, smmap, pydeck, gitdb, gitpython, streamlit\n",
|
81 |
+
"\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
82 |
+
"\u001b[0m\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
83 |
+
"\u001b[0m\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
84 |
+
"\u001b[0m\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
85 |
+
"\u001b[0m\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
86 |
+
"\u001b[0mSuccessfully installed gitdb-4.0.12 gitpython-3.1.44 pydeck-0.9.1 smmap-5.0.2 streamlit-1.43.2 toml-0.10.2 watchdog-6.0.0\n",
|
87 |
+
"\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
88 |
+
"\u001b[0m\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
89 |
+
"\u001b[0m\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
90 |
+
"\u001b[0m"
|
91 |
+
]
|
92 |
+
}
|
93 |
+
],
|
94 |
+
"source": [
|
95 |
+
"!pip install streamlit "
|
96 |
+
]
|
97 |
+
},
|
98 |
+
{
|
99 |
+
"cell_type": "code",
|
100 |
+
"execution_count": 2,
|
101 |
+
"id": "db4f1d12-4584-45e6-876d-1712092c029d",
|
102 |
+
"metadata": {},
|
103 |
+
"outputs": [
|
104 |
+
{
|
105 |
+
"name": "stdout",
|
106 |
+
"output_type": "stream",
|
107 |
+
"text": [
|
108 |
+
"\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
109 |
+
"\u001b[0m\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
110 |
+
"\u001b[0mCollecting fiona\n",
|
111 |
+
" Obtaining dependency information for fiona from https://files.pythonhosted.org/packages/7b/2e/3f80ba2fda9b8686681f0a1b18c8e95ad152ada1d6fb1d3f25281d9229fd/fiona-1.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata\n",
|
112 |
+
" Downloading fiona-1.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (56 kB)\n",
|
113 |
+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m56.6/56.6 kB\u001b[0m \u001b[31m1.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
|
114 |
+
"\u001b[?25hRequirement already satisfied: attrs>=19.2.0 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from fiona) (23.1.0)\n",
|
115 |
+
"Requirement already satisfied: certifi in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from fiona) (2024.7.4)\n",
|
116 |
+
"Requirement already satisfied: click~=8.0 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from fiona) (8.1.7)\n",
|
117 |
+
"Collecting click-plugins>=1.0 (from fiona)\n",
|
118 |
+
" Obtaining dependency information for click-plugins>=1.0 from https://files.pythonhosted.org/packages/e9/da/824b92d9942f4e472702488857914bdd50f73021efea15b4cad9aca8ecef/click_plugins-1.1.1-py2.py3-none-any.whl.metadata\n",
|
119 |
+
" Downloading click_plugins-1.1.1-py2.py3-none-any.whl.metadata (6.4 kB)\n",
|
120 |
+
"Collecting cligj>=0.5 (from fiona)\n",
|
121 |
+
" Obtaining dependency information for cligj>=0.5 from https://files.pythonhosted.org/packages/73/86/43fa9f15c5b9fb6e82620428827cd3c284aa933431405d1bcf5231ae3d3e/cligj-0.7.2-py3-none-any.whl.metadata\n",
|
122 |
+
" Downloading cligj-0.7.2-py3-none-any.whl.metadata (5.0 kB)\n",
|
123 |
+
"Downloading fiona-1.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)\n",
|
124 |
+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m17.3/17.3 MB\u001b[0m \u001b[31m39.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m00:01\u001b[0m\n",
|
125 |
+
"\u001b[?25hDownloading click_plugins-1.1.1-py2.py3-none-any.whl (7.5 kB)\n",
|
126 |
+
"Downloading cligj-0.7.2-py3-none-any.whl (7.1 kB)\n",
|
127 |
+
"\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
128 |
+
"\u001b[0mInstalling collected packages: cligj, click-plugins, fiona\n",
|
129 |
+
"\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
130 |
+
"\u001b[0m\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
131 |
+
"\u001b[0mSuccessfully installed click-plugins-1.1.1 cligj-0.7.2 fiona-1.10.1\n",
|
132 |
+
"\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
133 |
+
"\u001b[0m\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
134 |
+
"\u001b[0m\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
135 |
+
"\u001b[0m"
|
136 |
+
]
|
137 |
+
}
|
138 |
+
],
|
139 |
+
"source": [
|
140 |
+
"!pip install fiona "
|
141 |
+
]
|
142 |
+
},
|
143 |
+
{
|
144 |
+
"cell_type": "code",
|
145 |
+
"execution_count": 3,
|
146 |
+
"id": "7099edf0-b09c-48dd-ac9c-c25d44b78765",
|
147 |
+
"metadata": {},
|
148 |
+
"outputs": [
|
149 |
+
{
|
150 |
+
"name": "stdout",
|
151 |
+
"output_type": "stream",
|
152 |
+
"text": [
|
153 |
+
"\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
154 |
+
"\u001b[0m\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
155 |
+
"\u001b[0mRequirement already satisfied: shapely in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (2.0.7)\n",
|
156 |
+
"Requirement already satisfied: numpy<3,>=1.14 in /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages (from shapely) (1.26.4)\n",
|
157 |
+
"\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
158 |
+
"\u001b[0m\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
159 |
+
"\u001b[0m\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
160 |
+
"\u001b[0m\u001b[33mWARNING: Ignoring invalid distribution ~vidia-nccl-cu12 (/home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages)\u001b[0m\u001b[33m\n",
|
161 |
+
"\u001b[0m"
|
162 |
+
]
|
163 |
+
}
|
164 |
+
],
|
165 |
+
"source": [
|
166 |
+
"!pip install shapely"
|
167 |
+
]
|
168 |
+
},
|
169 |
+
{
|
170 |
+
"cell_type": "code",
|
171 |
+
"execution_count": 4,
|
172 |
+
"id": "4b531f13-2f5c-4bf3-b821-a3e0b2438c18",
|
173 |
+
"metadata": {},
|
174 |
+
"outputs": [],
|
175 |
+
"source": [
|
176 |
+
"import streamlit as st\n",
|
177 |
+
"import geopandas as gpd\n",
|
178 |
+
"import zipfile\n",
|
179 |
+
"import os\n",
|
180 |
+
"from pathlib import Path"
|
181 |
+
]
|
182 |
+
},
|
183 |
+
{
|
184 |
+
"cell_type": "code",
|
185 |
+
"execution_count": 5,
|
186 |
+
"id": "377ffc26-f4e3-44fa-af73-782f8e62274d",
|
187 |
+
"metadata": {},
|
188 |
+
"outputs": [],
|
189 |
+
"source": [
|
190 |
+
"# Constants\n",
|
191 |
+
"UTM_CRS = 'EPSG:32618' # UTM Zone 18N for NYC, in meters\n",
|
192 |
+
"ACRES_PER_SQ_METER = 1 / 4046.86"
|
193 |
+
]
|
194 |
+
},
|
195 |
+
{
|
196 |
+
"cell_type": "code",
|
197 |
+
"execution_count": 6,
|
198 |
+
"id": "cc9648f7-9cff-42bb-a237-e0f433b3454e",
|
199 |
+
"metadata": {
|
200 |
+
"scrolled": True
|
201 |
+
},
|
202 |
+
"outputs": [
|
203 |
+
{
|
204 |
+
"name": "stderr",
|
205 |
+
"output_type": "stream",
|
206 |
+
"text": [
|
207 |
+
"2025-03-23 18:43:09.475 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager\n",
|
208 |
+
"2025-03-23 18:43:09.480 WARNING streamlit.runtime.scriptrunner_utils.script_run_context: Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
209 |
+
"2025-03-23 18:43:10.640 \n",
|
210 |
+
" \u001b[33m\u001b[1mWarning:\u001b[0m to view this Streamlit app on a browser, run it with the following\n",
|
211 |
+
" command:\n",
|
212 |
+
"\n",
|
213 |
+
" streamlit run /home/stu10/s18/kd4849/miniconda3/envs/idai610/lib/python3.11/site-packages/ipykernel_launcher.py [ARGUMENTS]\n",
|
214 |
+
"2025-03-23 18:43:10.642 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
215 |
+
"2025-03-23 18:43:10.643 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
216 |
+
"2025-03-23 18:43:10.644 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
217 |
+
"2025-03-23 18:43:10.645 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
218 |
+
"2025-03-23 18:43:10.647 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
219 |
+
"2025-03-23 18:43:10.648 No runtime found, using MemoryCacheStorageManager\n",
|
220 |
+
"2025-03-23 18:43:10.649 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
221 |
+
"2025-03-23 18:43:10.650 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
222 |
+
"2025-03-23 18:43:10.652 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
223 |
+
"2025-03-23 18:43:11.200 Thread 'Thread-5': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
224 |
+
"2025-03-23 18:43:11.216 Thread 'Thread-5': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
225 |
+
"2025-03-23 18:43:11.218 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
226 |
+
"2025-03-23 18:43:11.219 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
227 |
+
"2025-03-23 18:43:11.222 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
228 |
+
"2025-03-23 18:43:11.223 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
229 |
+
"2025-03-23 18:43:11.224 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
230 |
+
"2025-03-23 18:43:11.225 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
231 |
+
"2025-03-23 18:43:11.227 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
232 |
+
"2025-03-23 18:43:11.228 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n",
|
233 |
+
"2025-03-23 18:43:11.229 Thread 'MainThread': missing ScriptRunContext! This warning can be ignored when running in bare mode.\n"
|
234 |
+
]
|
235 |
+
}
|
236 |
+
],
|
237 |
+
"source": [
|
238 |
+
"# Cache floodplain data loading\n",
|
239 |
+
"@st.cache_data\n",
|
240 |
+
"def load_floodplain_data():\n",
|
241 |
+
" # Replace with the actual path to your downloaded shapefile\n",
|
242 |
+
" floodplain_gdf = gpd.read_file('S_FLD_HAZ_AR.shp')\n",
|
243 |
+
" return floodplain_gdf.to_crs(UTM_CRS)\n",
|
244 |
+
"\n",
|
245 |
+
"# Process uploaded KML/KMZ file\n",
|
246 |
+
"def process_uploaded_file(uploaded_file):\n",
|
247 |
+
" if uploaded_file.name.endswith('.kmz'):\n",
|
248 |
+
" with zipfile.ZipFile(uploaded_file, 'r') as kmz:\n",
|
249 |
+
" kmz.extract('doc.kml', 'temp')\n",
|
250 |
+
" boundary_gdf = gpd.read_file('temp/doc.kml', driver='KML')\n",
|
251 |
+
" os.remove('temp/doc.kml')\n",
|
252 |
+
" else:\n",
|
253 |
+
" boundary_gdf = gpd.read_file(uploaded_file, driver='KML')\n",
|
254 |
+
" \n",
|
255 |
+
" # Assume single polygon (modify for multi-polygons if needed)\n",
|
256 |
+
" boundary_geom = boundary_gdf.geometry.iloc[0]\n",
|
257 |
+
" boundary_gdf = gpd.GeoDataFrame(geometry=[boundary_geom], crs='EPSG:4326')\n",
|
258 |
+
" return boundary_gdf.to_crs(UTM_CRS)\n",
|
259 |
+
"\n",
|
260 |
+
"# Main application\n",
|
261 |
+
"def main():\n",
|
262 |
+
" st.title(\"NYC Floodland Analysis Tool\")\n",
|
263 |
+
" st.write(\"Upload a KML or KMZ file to analyze floodland areas within your boundary.\")\n",
|
264 |
+
"\n",
|
265 |
+
" # Load floodplain data\n",
|
266 |
+
" floodplain_gdf = load_floodplain_data()\n",
|
267 |
+
"\n",
|
268 |
+
" # File uploader\n",
|
269 |
+
" uploaded_file = st.file_uploader(\"Choose a KML or KMZ file\", type=['kml', 'kmz'])\n",
|
270 |
+
"\n",
|
271 |
+
" if uploaded_file:\n",
|
272 |
+
" try:\n",
|
273 |
+
" # Process file and get boundary\n",
|
274 |
+
" boundary_gdf = process_uploaded_file(uploaded_file)\n",
|
275 |
+
" boundary_geom = boundary_gdf.geometry.iloc[0]\n",
|
276 |
+
"\n",
|
277 |
+
" # Calculate total boundary area\n",
|
278 |
+
" boundary_area_m2 = boundary_geom.area\n",
|
279 |
+
" boundary_area_acres = boundary_area_m2 * ACRES_PER_SQ_METER\n",
|
280 |
+
"\n",
|
281 |
+
" # Calculate floodplain area within boundary\n",
|
282 |
+
" intersection_gdf = gpd.overlay(boundary_gdf, floodplain_gdf, how='intersection')\n",
|
283 |
+
" floodplain_area_m2 = intersection_gdf.geometry.area.sum() if not intersection_gdf.empty else 0\n",
|
284 |
+
" floodplain_area_acres = floodplain_area_m2 * ACRES_PER_SQ_METER\n",
|
285 |
+
"\n",
|
286 |
+
" # Calculate usable land\n",
|
287 |
+
" usable_land_acres = boundary_area_acres - floodplain_area_acres\n",
|
288 |
+
"\n",
|
289 |
+
" # Display results\n",
|
290 |
+
" st.subheader(\"Analysis Summary\")\n",
|
291 |
+
" st.write(f\"**Total Boundary Area:** {boundary_area_acres:.2f} acres\")\n",
|
292 |
+
" st.write(f\"**Floodland Area:** {floodplain_area_acres:.2f} acres\")\n",
|
293 |
+
" st.write(f\"**Usable Land Area:** {usable_land_acres:.2f} acres\")\n",
|
294 |
+
" except Exception as e:\n",
|
295 |
+
" st.error(f\"Error: {e}\")\n",
|
296 |
+
" else:\n",
|
297 |
+
" st.info(\"Please upload a file to begin.\")\n",
|
298 |
+
"\n",
|
299 |
+
"if __name__ == \"__main__\":\n",
|
300 |
+
" main()"
|
301 |
+
]
|
302 |
+
},
|
303 |
+
{
|
304 |
+
"cell_type": "code",
|
305 |
+
"execution_count": None,
|
306 |
+
"id": "25aa4514-4f6e-4c93-87e3-706f77113bc7",
|
307 |
+
"metadata": {},
|
308 |
+
"outputs": [],
|
309 |
+
"source": []
|
310 |
+
},
|
311 |
+
{
|
312 |
+
"cell_type": "code",
|
313 |
+
"execution_count": None,
|
314 |
+
"id": "c3e54fa1-914c-4bdf-a9b7-f46846e91321",
|
315 |
+
"metadata": {},
|
316 |
+
"outputs": [],
|
317 |
+
"source": []
|
318 |
+
},
|
319 |
+
{
|
320 |
+
"cell_type": "code",
|
321 |
+
"execution_count": None,
|
322 |
+
"id": "95ae4a91-5aae-496b-b909-d6782a808cb3",
|
323 |
+
"metadata": {},
|
324 |
+
"outputs": [],
|
325 |
+
"source": []
|
326 |
+
},
|
327 |
+
{
|
328 |
+
"cell_type": "code",
|
329 |
+
"execution_count": None,
|
330 |
+
"id": "9c1f22cb-db62-4163-bdeb-4bf93017a3b6",
|
331 |
+
"metadata": {},
|
332 |
+
"outputs": [],
|
333 |
+
"source": []
|
334 |
+
},
|
335 |
+
{
|
336 |
+
"cell_type": "code",
|
337 |
+
"execution_count": None,
|
338 |
+
"id": "2ee9a7fd-1c38-40c7-84fa-151bdeacf779",
|
339 |
+
"metadata": {},
|
340 |
+
"outputs": [],
|
341 |
+
"source": []
|
342 |
+
},
|
343 |
+
{
|
344 |
+
"cell_type": "code",
|
345 |
+
"execution_count": None,
|
346 |
+
"id": "e99ceda3-593b-4ace-a622-cdc116a015a4",
|
347 |
+
"metadata": {},
|
348 |
+
"outputs": [],
|
349 |
+
"source": []
|
350 |
+
},
|
351 |
+
{
|
352 |
+
"cell_type": "code",
|
353 |
+
"execution_count": None,
|
354 |
+
"id": "3419a04f-8616-4ce8-9599-101b3f943302",
|
355 |
+
"metadata": {},
|
356 |
+
"outputs": [],
|
357 |
+
"source": []
|
358 |
+
},
|
359 |
+
{
|
360 |
+
"cell_type": "code",
|
361 |
+
"execution_count": None,
|
362 |
+
"id": "bfe60fd7-9a2d-4ceb-b0c0-7f830332346a",
|
363 |
+
"metadata": {},
|
364 |
+
"outputs": [],
|
365 |
+
"source": []
|
366 |
+
},
|
367 |
+
{
|
368 |
+
"cell_type": "code",
|
369 |
+
"execution_count": None,
|
370 |
+
"id": "be15f149-1a46-4389-a66d-5ad0423997ad",
|
371 |
+
"metadata": {},
|
372 |
+
"outputs": [],
|
373 |
+
"source": []
|
374 |
+
},
|
375 |
+
{
|
376 |
+
"cell_type": "code",
|
377 |
+
"execution_count": None,
|
378 |
+
"id": "f021d119-9f54-4572-bcac-159dfcfd3650",
|
379 |
+
"metadata": {},
|
380 |
+
"outputs": [],
|
381 |
+
"source": []
|
382 |
+
},
|
383 |
+
{
|
384 |
+
"cell_type": "code",
|
385 |
+
"execution_count": None,
|
386 |
+
"id": "d7b85977-7aec-481a-ba61-a5944135585c",
|
387 |
+
"metadata": {},
|
388 |
+
"outputs": [],
|
389 |
+
"source": []
|
390 |
+
},
|
391 |
+
{
|
392 |
+
"cell_type": "code",
|
393 |
+
"execution_count": None,
|
394 |
+
"id": "a70b7e20-eb9f-4100-8e18-6aed9ede40cd",
|
395 |
+
"metadata": {},
|
396 |
+
"outputs": [],
|
397 |
+
"source": []
|
398 |
+
},
|
399 |
+
{
|
400 |
+
"cell_type": "code",
|
401 |
+
"execution_count": None,
|
402 |
+
"id": "787aa7f2-7744-4b2a-86bf-3d45402b282c",
|
403 |
+
"metadata": {},
|
404 |
+
"outputs": [],
|
405 |
+
"source": []
|
406 |
+
},
|
407 |
+
{
|
408 |
+
"cell_type": "code",
|
409 |
+
"execution_count": None,
|
410 |
+
"id": "f7d903d1-ed0f-4769-b5ec-a5f9a4377906",
|
411 |
+
"metadata": {},
|
412 |
+
"outputs": [],
|
413 |
+
"source": []
|
414 |
+
},
|
415 |
+
{
|
416 |
+
"cell_type": "code",
|
417 |
+
"execution_count": None,
|
418 |
+
"id": "a02414c7-8d4e-41de-aa08-818e653abf93",
|
419 |
+
"metadata": {},
|
420 |
+
"outputs": [],
|
421 |
+
"source": []
|
422 |
+
}
|
423 |
+
],
|
424 |
+
"metadata": {
|
425 |
+
"kernelspec": {
|
426 |
+
"display_name": "Python 3 (ipykernel)",
|
427 |
+
"language": "python",
|
428 |
+
"name": "python3"
|
429 |
+
},
|
430 |
+
"language_info": {
|
431 |
+
"codemirror_mode": {
|
432 |
+
"name": "ipython",
|
433 |
+
"version": 3
|
434 |
+
},
|
435 |
+
"file_extension": ".py",
|
436 |
+
"mimetype": "text/x-python",
|
437 |
+
"name": "python",
|
438 |
+
"nbconvert_exporter": "python",
|
439 |
+
"pygments_lexer": "ipython3",
|
440 |
+
"version": "3.11.5"
|
441 |
+
}
|
442 |
+
},
|
443 |
+
"nbformat": 4,
|
444 |
+
"nbformat_minor": 5
|
445 |
+
}
|