<jupyter_start><jupyter_text>Define our search parameters and send to the USGS Use a dict, with same names as used by the USGS web call.Send a query to the web server. The result is a list of events also in a dict format.<jupyter_code>search_params = {
    'starttime':  "2018-05-01",
    'endtime':  "2018-05-17",
    'minmagnitude':  6.8,
    'maxmagnitude': 10.0,
    'mindepth': 0.0,
    'maxdepth': 50.0,
    'minlongitude': -180.0,
    'maxlongitude': -97.0,
    'minlatitude':  0.0,
    'maxlatitude': 45.0,
    'limit': 50,
    'producttype': 'shakemap'
}

events = usgs_web.search_usgsevents(search_params)<jupyter_output>Sending query to get events...
Parsing...
	...1 events returned (limit of 50)
		 70116556 : M 6.9 - 19km SSW of Leilani Estates, Hawaii<jupyter_text>Check the metadata  Display metadata including number of earthquakes returned and what url was used for the query<jupyter_code>for k, v in events['metadata'].items():
    print(k,":", v)<jupyter_output>generated : 1575582197000
url : https://earthquake.usgs.gov/fdsnws/event/1/query?starttime=2018-05-01&endtime=2018-05-17&minmagnitude=6.8&maxmagnitude=10.0&mindepth=0.0&maxdepth=50.0&minlongitude=-180.0&maxlongitude=-97.0&minlatitude=0.0&maxlatitude=45.0&limit=50&producttype=shakemap&format=geojson&jsonerror=true
title : USGS Earthquakes
status : 200
api : 1.8.1
limit : 50
offset : 1
count : 1<jupyter_text>Selection of event from candidates<jupyter_code>my_event = usgs_web.choose_event(events)
my_event<jupyter_output>USER SELECTION OF EVENT:
========================
   0: M 6.9 - 19km SSW of Leilani Estates, Hawaii (70116556)
None: First on list
  -1: Exit

Choice: 
	... selected M 6.9 - 19km SSW of Leilani Estates, Hawaii (70116556)<jupyter_text>Select which ShakeMap for the selected event<jupyter_code>smDetail = usgs_web.query_shakemapdetail(my_event['properties'])<jupyter_output>Querying detailed event info for eventId=70116556...
	...2 shakemaps found

USER SELECTION OF SHAKEMAP:
===========================
Option 0:
	   eventsourcecode: 70116556
	           version: 1
	 process-timestamp: 2018-09-08T02:52:24Z
Option 1:
	   eventsourcecode: 1000dyad
	           version: 11
	 process-timestamp: 2018-06-15T23:02:03Z

Choice [default 0]: 
	... selected 0<jupyter_text>Display available content for the ShakeMap<jupyter_code>print("Available Content\n=================")
for k, v in smDetail['contents'].items():
    print("{:32s}: {} [{}]".format(k, v['contentType'], v['length']))<jupyter_output>Available Content
=================
about_formats.html              : text/html [28820]
contents.xml                    : application/xml [9187]
download/70116556.kml           : application/vnd.google-earth.kml+xml [1032]
download/cont_mi.json           : application/json [79388]
download/cont_mi.kmz            : application/vnd.google-earth.kmz [17896]
download/cont_pga.json          : application/json [17499]
download/cont_pga.kmz           : application/vnd.google-earth.kmz [4362]
download/cont_pgv.json          : application/json [12352]
download/cont_pgv.kmz           : application/vnd.google-earth.kmz [3309]
download/cont_psa03.json        : application/json [24669]
download/cont_psa03.kmz         : application/vnd.google-earth.kmz [5843]
download/cont_psa10.json        : application/json [15028]
download/cont_psa10.kmz         : application/vnd.google-earth.kmz [3843]
download/cont_psa30.json        : application/json [7537]
download/cont_psa30.kmz         : application/vnd.goo[...]<jupyter_text>Get download linksClick on the link to download<jupyter_code># Extract the shakemap grid urls and version from the detail
grid = smDetail['contents']['download/grid.xml.zip']
print(grid['url'])
grid = smDetail['contents']['download/uncertainty.xml.zip']
print(grid['url'])<jupyter_output>https://earthquake.usgs.gov/archive/product/shakemap/hv70116556/us/1536375199192/download/uncertainty.xml.zip
{'fraction_non_alphanumeric': 0.14300306435137897, 'fraction_numerical': 0.07839632277834525, 'mean_word_length': 4.201859229747676, 'pattern_counts': {'":': 1, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '1486', 'license': 'MIT', 'n_tokens_mistral': 1576, 'n_tokens_neox': 1352, 'n_words': 284, 'path': 'notebooks/find_a_shakemap.ipynb', 'repo_name': 'iwbailey/shakemap_lookup', 'size': '3916'}