|
15 | 15 | "id": "35dba30bf42bd326",
|
16 | 16 | "metadata": {},
|
17 | 17 | "source": [
|
18 |
| - "# TODO #1417\n", |
| 18 | + "### TODO #1417 add description\n", |
| 19 | + "### TODO #1490 fix installation on binder\n", |
19 | 20 | "For more informations about Paraview please refere to [Paraview documentation](https://docs.paraview.org/en/latest/Tutorials/SelfDirectedTutorial/)"
|
20 | 21 | ]
|
21 | 22 | },
|
22 | 23 | {
|
23 | 24 | "cell_type": "code",
|
| 25 | + "execution_count": 1, |
24 | 26 | "id": "93289adf665b5c7f",
|
25 | 27 | "metadata": {
|
26 | 28 | "ExecuteTime": {
|
27 |
| - "end_time": "2024-12-24T09:44:03.286946Z", |
28 |
| - "start_time": "2024-12-24T09:44:03.263186Z" |
| 29 | + "end_time": "2025-01-06T20:42:41.598955Z", |
| 30 | + "start_time": "2025-01-06T20:42:41.591955Z" |
29 | 31 | }
|
30 | 32 | },
|
| 33 | + "outputs": [], |
31 | 34 | "source": [
|
32 | 35 | "import sys\n",
|
33 | 36 | "if 'google.colab' in sys.modules:\n",
|
34 | 37 | " !pip --quiet install open-atmos-jupyter-utils\n",
|
35 | 38 | " from open_atmos_jupyter_utils import pip_install_on_colab\n",
|
36 | 39 | " pip_install_on_colab('PySDM-examples')"
|
| 40 | + ] |
| 41 | + }, |
| 42 | + { |
| 43 | + "cell_type": "code", |
| 44 | + "execution_count": 2, |
| 45 | + "id": "e3537b5faa81e11f", |
| 46 | + "metadata": { |
| 47 | + "ExecuteTime": { |
| 48 | + "end_time": "2025-01-06T20:42:48.835403Z", |
| 49 | + "start_time": "2025-01-06T20:42:42.286569Z" |
| 50 | + } |
| 51 | + }, |
| 52 | + "outputs": [ |
| 53 | + { |
| 54 | + "name": "stdout", |
| 55 | + "output_type": "stream", |
| 56 | + "text": [ |
| 57 | + "paraview version 5.13.1\n" |
| 58 | + ] |
| 59 | + } |
37 | 60 | ],
|
38 |
| - "outputs": [], |
39 |
| - "execution_count": 4 |
| 61 | + "source": [ |
| 62 | + "import os\n", |
| 63 | + "import subprocess\n", |
| 64 | + "SUBPROCESS_ENV = os.environ.copy()\n", |
| 65 | + "\n", |
| 66 | + "if 'google.colab' in sys.modules:\n", |
| 67 | + " !apt-get install -qq ghostscript\n", |
| 68 | + " !wget -nv \"https://paraview.org/paraview-downloads/download.php?submit=Download&version=v5.13&type=binary&os=Linux&downloadFile=ParaView-5.13.1-egl-MPI-Linux-Python3.10-x86_64.tar.gz\" -O paraview.tar.gz\n", |
| 69 | + " !tar xzf paraview.tar.gz\n", |
| 70 | + " SUBPROCESS_ENV['PATH'] += ':' + subprocess.check_output(['bash', '-c', \"echo `pwd`/`dirname ParaView*/bin/pvpython`\"], text=True)[:-1]\n", |
| 71 | + " \n", |
| 72 | + " # check if Ghostscript's ps2pdf works\n", |
| 73 | + " assert subprocess.check_call(['type', 'ps2pdf'], shell=True) == 0\n", |
| 74 | + " \n", |
| 75 | + "# check if Paraview's pvpython works\n", |
| 76 | + "assert subprocess.check_call(['pvpython', '--version'], env=SUBPROCESS_ENV) == 0\n", |
| 77 | + "assert subprocess.check_call(['pvpython', '-c', 'import paraview'], env=SUBPROCESS_ENV) == 0" |
| 78 | + ] |
40 | 79 | },
|
41 | 80 | {
|
42 | 81 | "cell_type": "code",
|
| 82 | + "execution_count": 3, |
43 | 83 | "id": "ee889545",
|
44 | 84 | "metadata": {
|
45 | 85 | "ExecuteTime": {
|
46 |
| - "end_time": "2024-12-24T09:44:06.619086Z", |
47 |
| - "start_time": "2024-12-24T09:44:03.326051Z" |
| 86 | + "end_time": "2025-01-06T20:42:48.845075Z", |
| 87 | + "start_time": "2025-01-06T20:42:48.842291Z" |
48 | 88 | }
|
49 | 89 | },
|
| 90 | + "outputs": [], |
50 | 91 | "source": [
|
51 | 92 | "from PySDM_examples.Arabas_et_al_2015 import Settings, SpinUp\n",
|
52 | 93 | "from PySDM_examples.Szumowski_et_al_1998 import Simulation, Storage\n",
|
53 | 94 | "from PySDM.exporters import VTKExporter\n",
|
54 | 95 | "from PySDM_examples.utils import ProgBarController\n",
|
55 | 96 | "from PySDM import products as PySDM_products\n",
|
56 |
| - "import subprocess\n", |
57 | 97 | "import glob\n",
|
58 | 98 | "import platform"
|
59 |
| - ], |
60 |
| - "outputs": [], |
61 |
| - "execution_count": 5 |
| 99 | + ] |
62 | 100 | },
|
63 | 101 | {
|
64 | 102 | "cell_type": "code",
|
| 103 | + "execution_count": 4, |
65 | 104 | "id": "f0d2581f",
|
66 | 105 | "metadata": {
|
67 | 106 | "ExecuteTime": {
|
68 |
| - "end_time": "2024-12-24T09:44:06.635813Z", |
69 |
| - "start_time": "2024-12-24T09:44:06.633731Z" |
| 107 | + "end_time": "2025-01-06T20:42:49.673689Z", |
| 108 | + "start_time": "2025-01-06T20:42:49.664256Z" |
70 | 109 | }
|
71 | 110 | },
|
| 111 | + "outputs": [], |
72 | 112 | "source": [
|
73 | 113 | "products = [\n",
|
74 | 114 | " PySDM_products.EffectiveRadius(unit='um')\n",
|
75 | 115 | "]"
|
76 |
| - ], |
77 |
| - "outputs": [], |
78 |
| - "execution_count": 6 |
| 116 | + ] |
79 | 117 | },
|
80 | 118 | {
|
81 | 119 | "cell_type": "markdown",
|
|
87 | 125 | },
|
88 | 126 | {
|
89 | 127 | "cell_type": "code",
|
| 128 | + "execution_count": 5, |
90 | 129 | "id": "74c00944",
|
91 | 130 | "metadata": {
|
92 | 131 | "ExecuteTime": {
|
93 |
| - "end_time": "2024-12-24T09:45:09.597772Z", |
94 |
| - "start_time": "2024-12-24T09:44:06.656496Z" |
| 132 | + "end_time": "2025-01-06T20:43:31.937868Z", |
| 133 | + "start_time": "2025-01-06T20:42:51.814553Z" |
95 | 134 | }
|
96 | 135 | },
|
97 |
| - "source": [ |
98 |
| - "settings = Settings()\n", |
99 |
| - "storage = Storage()\n", |
100 |
| - "simulation = Simulation(settings, storage, SpinUp=SpinUp)\n", |
101 |
| - "simulation.reinit(products)\n", |
102 |
| - "\n", |
103 |
| - "vtk_exporter = VTKExporter(path='.') \n", |
104 |
| - "\n", |
105 |
| - "simulation.run(ProgBarController(\"progress:\"), vtk_exporter=vtk_exporter)\n", |
106 |
| - "vtk_exporter.write_pvd()" |
107 |
| - ], |
108 | 136 | "outputs": [
|
109 | 137 | {
|
110 | 138 | "data": {
|
111 |
| - "text/plain": [ |
112 |
| - "FloatProgress(value=0.0, description='progress:', max=1.0)" |
113 |
| - ], |
114 | 139 | "application/vnd.jupyter.widget-view+json": {
|
| 140 | + "model_id": "f9d581fdc60345ff804d5265fc156e1c", |
115 | 141 | "version_major": 2,
|
116 |
| - "version_minor": 0, |
117 |
| - "model_id": "b4d654a45ee143bb86ba1784844568c0" |
118 |
| - } |
| 142 | + "version_minor": 0 |
| 143 | + }, |
| 144 | + "text/plain": [ |
| 145 | + "FloatProgress(value=0.0, description='progress:', max=1.0)" |
| 146 | + ] |
119 | 147 | },
|
120 | 148 | "metadata": {},
|
121 | 149 | "output_type": "display_data"
|
122 | 150 | }
|
123 | 151 | ],
|
124 |
| - "execution_count": 7 |
| 152 | + "source": [ |
| 153 | + "settings = Settings()\n", |
| 154 | + "storage = Storage()\n", |
| 155 | + "simulation = Simulation(settings, storage, SpinUp=SpinUp)\n", |
| 156 | + "simulation.reinit(products)\n", |
| 157 | + "\n", |
| 158 | + "vtk_exporter = VTKExporter(path='.') \n", |
| 159 | + "\n", |
| 160 | + "simulation.run(ProgBarController(\"progress:\"), vtk_exporter=vtk_exporter)\n", |
| 161 | + "vtk_exporter.write_pvd()" |
| 162 | + ] |
125 | 163 | },
|
126 | 164 | {
|
127 | 165 | "cell_type": "markdown",
|
|
133 | 171 | },
|
134 | 172 | {
|
135 | 173 | "cell_type": "code",
|
136 |
| - "id": "94041d98fa896fba", |
137 |
| - "metadata": { |
138 |
| - "ExecuteTime": { |
139 |
| - "end_time": "2024-12-24T09:45:09.607338Z", |
140 |
| - "start_time": "2024-12-24T09:45:09.604990Z" |
141 |
| - } |
142 |
| - }, |
143 |
| - "source": [ |
144 |
| - "if 'google.colab' in sys.modules:\n", |
145 |
| - " !apt-get -qq install python3-paraview\n", |
146 |
| - " \n", |
147 |
| - " # Workaround for a bug in Ubuntu package described here\n", |
148 |
| - " # (https://discourse.paraview.org/t/paraview-error-while-loading-shared-libraries-libpdal-base-so-13-cannot-open-shared-object-file/14000);\n", |
149 |
| - " # with solution taken from that comment: https://github.com/qgis/QGIS/issues/52433#issuecomment-1792285094.\n", |
150 |
| - " ! if [ ! -f /usr/lib/libpdal_base.so.13 ]; then ln -s /usr/lib/libpdal_base.so.15 /usr/lib/libpdal_base.so.13; fi " |
151 |
| - ], |
152 |
| - "outputs": [], |
153 |
| - "execution_count": 8 |
154 |
| - }, |
155 |
| - { |
156 |
| - "cell_type": "code", |
| 174 | + "execution_count": 6, |
157 | 175 | "id": "2030d8e7",
|
158 | 176 | "metadata": {
|
159 | 177 | "ExecuteTime": {
|
160 |
| - "end_time": "2024-12-24T09:45:09.621096Z", |
161 |
| - "start_time": "2024-12-24T09:45:09.615386Z" |
| 178 | + "end_time": "2025-01-06T20:43:32.052989Z", |
| 179 | + "start_time": "2025-01-06T20:43:32.046624Z" |
162 | 180 | }
|
163 | 181 | },
|
| 182 | + "outputs": [ |
| 183 | + { |
| 184 | + "name": "stdout", |
| 185 | + "output_type": "stream", |
| 186 | + "text": [ |
| 187 | + "Overwriting pvscript.py\n" |
| 188 | + ] |
| 189 | + } |
| 190 | + ], |
164 | 191 | "source": [
|
165 | 192 | "%%writefile pvscript.py\n",
|
166 | 193 | "\n",
|
|
297 | 324 | " Rasterize3Dgeometry= False,\n",
|
298 | 325 | " GL2PSdepthsortmethod= 'BSP sorting (slow, best)',\n",
|
299 | 326 | " )"
|
300 |
| - ], |
301 |
| - "outputs": [ |
302 |
| - { |
303 |
| - "name": "stdout", |
304 |
| - "output_type": "stream", |
305 |
| - "text": [ |
306 |
| - "Overwriting pvscript.py\n" |
307 |
| - ] |
308 |
| - } |
309 |
| - ], |
310 |
| - "execution_count": 9 |
| 327 | + ] |
311 | 328 | },
|
312 | 329 | {
|
313 | 330 | "cell_type": "markdown",
|
|
319 | 336 | },
|
320 | 337 | {
|
321 | 338 | "cell_type": "code",
|
| 339 | + "execution_count": 7, |
322 | 340 | "id": "79477d3d",
|
323 | 341 | "metadata": {
|
324 | 342 | "ExecuteTime": {
|
325 |
| - "start_time": "2024-12-24T09:45:09.652231Z" |
| 343 | + "end_time": "2025-01-06T20:44:22.171797Z", |
| 344 | + "start_time": "2025-01-06T20:43:32.099529Z" |
326 | 345 | }
|
327 | 346 | },
|
328 |
| - "source": [ |
329 |
| - "subprocess.run(['pvpython', '--force-offscreen-rendering', 'pvscript.py'], check=platform.system() != 'Windows')" |
| 347 | + "outputs": [ |
| 348 | + { |
| 349 | + "data": { |
| 350 | + "text/plain": [ |
| 351 | + "CompletedProcess(args=['pvpython', '--force-offscreen-rendering', 'pvscript.py'], returncode=0)" |
| 352 | + ] |
| 353 | + }, |
| 354 | + "execution_count": 7, |
| 355 | + "metadata": {}, |
| 356 | + "output_type": "execute_result" |
| 357 | + } |
330 | 358 | ],
|
331 |
| - "outputs": [], |
332 |
| - "execution_count": 10 |
| 359 | + "source": [ |
| 360 | + "subprocess.run(['pvpython', '--force-offscreen-rendering', 'pvscript.py'], check=platform.system() != 'Windows', env=SUBPROCESS_ENV)" |
| 361 | + ] |
333 | 362 | },
|
334 | 363 | {
|
335 | 364 | "cell_type": "markdown",
|
|
343 | 372 | "cell_type": "code",
|
344 | 373 | "execution_count": 8,
|
345 | 374 | "id": "23e0cf61",
|
346 |
| - "metadata": {}, |
| 375 | + "metadata": { |
| 376 | + "ExecuteTime": { |
| 377 | + "end_time": "2025-01-06T20:44:32.623050Z", |
| 378 | + "start_time": "2025-01-06T20:44:22.257021Z" |
| 379 | + } |
| 380 | + }, |
347 | 381 | "outputs": [],
|
348 | 382 | "source": [
|
349 | 383 | "if platform.system() != 'Windows':\n",
|
|
354 | 388 | },
|
355 | 389 | {
|
356 | 390 | "cell_type": "code",
|
357 |
| - "execution_count": 9, |
| 391 | + "execution_count": null, |
358 | 392 | "id": "9d3e4a35",
|
359 |
| - "metadata": {}, |
| 393 | + "metadata": { |
| 394 | + "ExecuteTime": { |
| 395 | + "end_time": "2025-01-06T20:42:10.669031Z", |
| 396 | + "start_time": "2025-01-06T20:42:10.667667Z" |
| 397 | + } |
| 398 | + }, |
360 | 399 | "outputs": [],
|
361 | 400 | "source": []
|
362 | 401 | }
|
|
0 commit comments