Skip to content

Commit d8d8368

Browse files
authored
Merge pull request Esri#521 from Esri/chun7642/update_sample_natural_disaster_detect
updates to json spec change in NASA disaster feed
2 parents 72ad250 + 658fc1e commit d8d8368

File tree

1 file changed

+61
-5
lines changed

1 file changed

+61
-5
lines changed

samples/05_content_publishers/hey_gis_give_me_a_map_of_the_recent_natural_disasters.ipynb

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
"# Hey GIS, Give me a map of the recent natural disasters"
88
]
99
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {
13+
"toc": true
14+
},
15+
"source": [
16+
"<h1>Table of Contents<span class=\"tocSkip\"></span></h1>\n",
17+
"<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>"
18+
]
19+
},
1020
{
1121
"cell_type": "markdown",
1222
"metadata": {},
@@ -1879,7 +1889,9 @@
18791889
"source": [
18801890
"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",
18811891
"\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."
18831895
]
18841896
},
18851897
{
@@ -1897,7 +1909,7 @@
18971909
" obj_id = ea.attributes['OBJECTID']\n",
18981910
" obj_type = ea.geometry_type\n",
18991911
" \n",
1900-
" if \"Cyclone\" in title:\n",
1912+
" if any(disaster_type in title for disaster_type in [\"Cyclone\", \"Typhoon\", \"Tropical Storm\"]):\n",
19011913
" df_sel = df[df['OBJECTID']==obj_id]\n",
19021914
" df_sel.spatial.plot(map_widget=map_g,\n",
19031915
" name=title,\n",
@@ -1915,8 +1927,10 @@
19151927
" symbol_style = style_volcano)\n",
19161928
" else: # Polygon\n",
19171929
" 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",
19201934
" if_Changed = True\n",
19211935
" \n",
19221936
" df_sel = df[df['OBJECTID']==obj_id]\n",
@@ -2612,7 +2626,49 @@
26122626
"name": "python",
26132627
"nbconvert_exporter": "python",
26142628
"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
26162672
}
26172673
},
26182674
"nbformat": 4,

0 commit comments

Comments
 (0)