|
1 | 1 | { |
2 | 2 | "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": { |
| 6 | + "toc": true |
| 7 | + }, |
| 8 | + "source": [ |
| 9 | + "<h1>Table of Contents<span class=\"tocSkip\"></span></h1>\n", |
| 10 | + "<div class=\"toc\"><ul class=\"toc-item\"><li><span><a href=\"#Step-1.-Preparation\" data-toc-modified-id=\"Step-1.-Preparation-1\">Step 1. Preparation</a></span></li><li><span><a href=\"#Step-2.-Understanding-the-data-structure-of-EONET-Feed\" data-toc-modified-id=\"Step-2.-Understanding-the-data-structure-of-EONET-Feed-2\">Step 2. Understanding the data structure of EONET Feed</a></span><ul class=\"toc-item\"><li><span><a href=\"#Make-URLs-clickable\" data-toc-modified-id=\"Make-URLs-clickable-2.1\">Make URLs clickable</a></span></li></ul></li><li><span><a href=\"#Step-3.-Plot-the-features\" data-toc-modified-id=\"Step-3.-Plot-the-features-3\">Step 3. Plot the features</a></span></li><li><span><a href=\"#Step-4.-Creating-the-web-map\" data-toc-modified-id=\"Step-4.-Creating-the-web-map-4\">Step 4. Creating the web map</a></span></li><li><span><a href=\"#Step-5.-Explore-the-data-and-the-maps\" data-toc-modified-id=\"Step-5.-Explore-the-data-and-the-maps-5\">Step 5. Explore the data and the maps</a></span></li><li><span><a href=\"#Step-6.-Statistics-of-natural-disaster-occurrences\" data-toc-modified-id=\"Step-6.-Statistics-of-natural-disaster-occurrences-6\">Step 6. Statistics of natural disaster occurrences</a></span></li><li><span><a href=\"#Conclusion\" data-toc-modified-id=\"Conclusion-7\">Conclusion</a></span></li></ul></div>" |
| 11 | + ] |
| 12 | + }, |
3 | 13 | { |
4 | 14 | "cell_type": "markdown", |
5 | 15 | "metadata": {}, |
|
1879 | 1889 | "source": [ |
1880 | 1890 | "The EONet takes liberty in varying the geometry type used to record events of the same type. Thus an Iceburg could be a point or a polygon. The cell below handles this uncertainity. It also picks an appropriate symbol for each geometry type.\n", |
1881 | 1891 | "\n", |
1882 | | - "The boolean variable `if_Changed` is used to represent if the geometry of the features inside the FeatureSet has been changed during the parsing or execution process. A hint here: If you are interested to find out the details of each feature stored in the FeatureSet Class object, use `print(ea.get_value('title'), \" - \", ea.geometry_type, \" - \", ea.geometry)` to display information of each entry." |
| 1892 | + "The boolean variable `if_Changed` is used to represent if the geometry of the features inside the FeatureSet has been changed during the parsing or execution process. A hint here: If you are interested to find out the details of each feature stored in the FeatureSet Class object, use `print(ea.get_value('title'), \" - \", ea.geometry_type, \" - \", ea.geometry)` to display information of each entry.\n", |
| 1893 | + "\n", |
| 1894 | + "Also note that, there are three kinds of representations for cyclones - namely, \"Cyclone\", \"Typhoon\", and \"Tropical Storm\". To determine if the disaster is of type cyclones, we need to confirm it falls within one of three categories." |
1883 | 1895 | ] |
1884 | 1896 | }, |
1885 | 1897 | { |
|
1897 | 1909 | " obj_id = ea.attributes['OBJECTID']\n", |
1898 | 1910 | " obj_type = ea.geometry_type\n", |
1899 | 1911 | " \n", |
1900 | | - " if \"Cyclone\" in title:\n", |
| 1912 | + " if any(disaster_type in title for disaster_type in [\"Cyclone\", \"Typhoon\", \"Tropical Storm\"]):\n", |
1901 | 1913 | " df_sel = df[df['OBJECTID']==obj_id]\n", |
1902 | 1914 | " df_sel.spatial.plot(map_widget=map_g,\n", |
1903 | 1915 | " name=title,\n", |
|
1915 | 1927 | " symbol_style = style_volcano)\n", |
1916 | 1928 | " else: # Polygon\n", |
1917 | 1929 | " if not if_Changed and 'rings' in ea.geometry:\n", |
1918 | | - " tmp = ea.geometry['rings']\n", |
1919 | | - " ea.geometry['rings'] = tmp[0]\n", |
| 1930 | + " if isinstance(ea.geometry['rings'], list) and not isinstance(ea.geometry['rings'][0], float):\n", |
| 1931 | + " ea.geometry['rings'] = ea.geometry['rings'][0]\n", |
| 1932 | + " else:\n", |
| 1933 | + " ea.geometry['rings'] = ea.attributes['SHAPE']['rings'][0]\n", |
1920 | 1934 | " if_Changed = True\n", |
1921 | 1935 | " \n", |
1922 | 1936 | " df_sel = df[df['OBJECTID']==obj_id]\n", |
|
2612 | 2626 | "name": "python", |
2613 | 2627 | "nbconvert_exporter": "python", |
2614 | 2628 | "pygments_lexer": "ipython3", |
2615 | | - "version": "3.6.7" |
| 2629 | + "version": "3.6.8" |
| 2630 | + }, |
| 2631 | + "toc": { |
| 2632 | + "base_numbering": 1, |
| 2633 | + "nav_menu": {}, |
| 2634 | + "number_sections": false, |
| 2635 | + "sideBar": true, |
| 2636 | + "skip_h1_title": true, |
| 2637 | + "title_cell": "Table of Contents", |
| 2638 | + "title_sidebar": "Contents", |
| 2639 | + "toc_cell": true, |
| 2640 | + "toc_position": {}, |
| 2641 | + "toc_section_display": true, |
| 2642 | + "toc_window_display": false |
| 2643 | + }, |
| 2644 | + "varInspector": { |
| 2645 | + "cols": { |
| 2646 | + "lenName": 16, |
| 2647 | + "lenType": 16, |
| 2648 | + "lenVar": 40 |
| 2649 | + }, |
| 2650 | + "kernels_config": { |
| 2651 | + "python": { |
| 2652 | + "delete_cmd_postfix": "", |
| 2653 | + "delete_cmd_prefix": "del ", |
| 2654 | + "library": "var_list.py", |
| 2655 | + "varRefreshCmd": "print(var_dic_list())" |
| 2656 | + }, |
| 2657 | + "r": { |
| 2658 | + "delete_cmd_postfix": ") ", |
| 2659 | + "delete_cmd_prefix": "rm(", |
| 2660 | + "library": "var_list.r", |
| 2661 | + "varRefreshCmd": "cat(var_dic_list()) " |
| 2662 | + } |
| 2663 | + }, |
| 2664 | + "types_to_exclude": [ |
| 2665 | + "module", |
| 2666 | + "function", |
| 2667 | + "builtin_function_or_method", |
| 2668 | + "instance", |
| 2669 | + "_Feature" |
| 2670 | + ], |
| 2671 | + "window_display": false |
2616 | 2672 | } |
2617 | 2673 | }, |
2618 | 2674 | "nbformat": 4, |
|
0 commit comments