Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5b2a559

Browse files
committed
voila_demo: bugfix for empty gdf, improvements for max_plot_points 2
1 parent 4879287 commit 5b2a559

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

examples/voila_demo.ipynb

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -287,20 +287,26 @@
287287
" max_plot_points = 10000\n",
288288
" if points_dropdown.value == \"100K\":\n",
289289
" max_plot_points = 100000\n",
290-
" elif points_dropdown.value == \"unlimited\":\n",
290+
" elif points_dropdown.value == \"all\":\n",
291291
" max_plot_points = 1000000000\n",
292+
" if max_plot_points > atl06_rsps.shape[0]:\n",
293+
" max_plot_points = atl06_rsps.shape[0]\n",
294+
" print(f'Plotting {max_plot_points} of {atl06_rsps.shape[0]} elevations. This may take 10-60+ seconds for larger point datasets.')\n",
292295
" m.GeoData(atl06_rsps, column_name=SRwidgets.variable.value, cmap=SRwidgets.colormap, max_plot_points=max_plot_points)\n",
293296
"\n",
294297
"# refresh action\n",
295298
"def on_refresh_clicked(b):\n",
296299
" global atl06_rsps\n",
297300
" with refresh_output:\n",
298-
" if atl06_rsps and atl06_rsps.shape[0] > 0:\n",
301+
" if atl06_rsps is not None and atl06_rsps.shape[0] > 0:\n",
299302
" max_plot_points = 10000\n",
300303
" if points_dropdown.value == \"100K\":\n",
301304
" max_plot_points = 100000\n",
302-
" elif points_dropdown.value == \"unlimited\":\n",
305+
" elif points_dropdown.value == \"all\":\n",
303306
" max_plot_points = 1000000000\n",
307+
" if max_plot_points > atl06_rsps.shape[0]:\n",
308+
" max_plot_points = atl06_rsps.shape[0]\n",
309+
" print(f'Plotting {max_plot_points} of {atl06_rsps.shape[0]} elevations. This may take 10-60+ seconds for larger point datasets.')\n",
304310
" m.GeoData(atl06_rsps, column_name=SRwidgets.variable.value, cmap=SRwidgets.colormap, max_plot_points=max_plot_points)\n",
305311
"\n",
306312
"# link buttons\n",
@@ -339,7 +345,7 @@
339345
"\n",
340346
"# points to plot drop down\n",
341347
"points_dropdown = widgets.Dropdown(\n",
342-
" options = [\"10K\", \"100K\", \"unlimited\"],\n",
348+
" options = [\"10K\", \"100K\", \"all\"],\n",
343349
" value = \"10K\",\n",
344350
" description = \"Pts to Draw\",\n",
345351
" disabled = False,\n",
@@ -562,13 +568,6 @@
562568
"display(pc_button)\n",
563569
"display(pc_output)"
564570
]
565-
},
566-
{
567-
"cell_type": "code",
568-
"execution_count": null,
569-
"metadata": {},
570-
"outputs": [],
571-
"source": []
572571
}
573572
],
574573
"metadata": {
@@ -605,7 +604,7 @@
605604
"name": "python",
606605
"nbconvert_exporter": "python",
607606
"pygments_lexer": "ipython3",
608-
"version": "3.8.13"
607+
"version": "3.10.6"
609608
},
610609
"toc-showtags": false
611610
},

0 commit comments

Comments
 (0)