{ "cells": [ { "cell_type": "markdown", "id": "88c33c1c", "metadata": {}, "source": [ "Begin by installing some Python modules that aren't included in the standard SageMaker environment." ] }, { "cell_type": "code", "execution_count": null, "id": "a8b3fede", "metadata": {}, "outputs": [], "source": [ "!pip install geojson\n", "!pip install awswrangler\n", "!pip install geomet\n", "!pip install shapely" ] }, { "cell_type": "markdown", "id": "e01b8645", "metadata": {}, "source": [ "Next, import all of the packages that we'll need later." ] }, { "cell_type": "code", "execution_count": 22, "id": "5a3873ac", "metadata": {}, "outputs": [], "source": [ "from geomet import wkt\n", "import plotly.express as px\n", "from shapely.geometry import Polygon, mapping\n", "import awswrangler as wr\n", "import pandas as pd\n", "from shapely.wkt import loads\n", "import geojson\n", "import ast" ] }, { "cell_type": "markdown", "id": "e25f6aab", "metadata": {}, "source": [ "Use [AWS Python Data Wrangler](https://github.com/awslabs/aws-data-wrangler) to read earthquake data from an Athena table.\n", "\n", "Data Wrangler is a very easy way to read data from various AWS data sources into Pandas dataframes.\n", "\n", "For this visualisation, we're only interested in earthquakes [within the USA](https://en.wikipedia.org/wiki/List_of_extreme_points_of_the_United_States). So, filter out rows in the dataframe which are outside of the extremities." ] }, { "cell_type": "code", "execution_count": 29, "id": "3149a7f2", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | h3_cell | \n", "boundary | \n", "quake_count | \n", "
---|---|---|---|
0 | \n", "8429807ffffffff | \n", "[POINT (-115.811663 36.988032), POINT (-115.57... | \n", "95 | \n", "
1 | \n", "8429803ffffffff | \n", "[POINT (-116.339706 36.897146), POINT (-116.10... | \n", "82 | \n", "
2 | \n", "8422ed5ffffffff | \n", "[POINT (-174.745324 51.234107), POINT (-174.55... | \n", "54 | \n", "
3 | \n", "8422c69ffffffff | \n", "[POINT (-168.529086 52.205677), POINT (-168.32... | \n", "47 | \n", "
4 | \n", "8422c45ffffffff | \n", "[POINT (-169.099372 52.061348), POINT (-168.89... | \n", "40 | \n", "