Skip to content

Commit

Permalink
Update freeze dir
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonstyle committed Sep 26, 2023
1 parent 0c90129 commit df1c7f2
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
4 changes: 2 additions & 2 deletions _freeze/notebooks/data-screening/execute-results/html.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"hash": "d87b6d9ac2228b736962871bfd9167c0",
"result": {
"markdown": "---\ntitle: Data Screening\ndescription: Screening and filtering data from the IGN catalog down to the relevant events for La Palma\nauthors:\n - name: Steve Purves\n orcid: 0000-0002-0760-5497\n - name: Charlotte Wickham\n note: Edited original notebook by Steve Purves\n---\n\n::: {#449de9e1 .cell execution_count=1}\n``` {}\nimport pandas as pd\nimport matplotlib.pyplot as plt\n```\n:::\n\n\n:::{#d5c28ec9 .cell .markdown}\nImport `la-palma.csv` - a clean subset of [`catalogoComunSV_1663233588717.csv`](https://github.com/Notebooks-Now/submission-quarto-full/blob/main/data/catalogoComunSV_1663233588717.csv):\n:::\n\n::: {#5a99b744 .cell execution_count=2}\n``` {}\ndf = pd.read_csv('la-palma.csv')\ndf['DateTime'] = pd.to_datetime(df['DateTime'])\ndf = df.sort_values(by=['DateTime'], ascending=True)\ndf.head()\n```\n\n::: {.cell-output .cell-output-display execution_count=51}\n```{=html}\n<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>Longitude</th>\n <th>Latitude</th>\n <th>Depth(km)</th>\n <th>Magnitude</th>\n <th>DateTime</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>11346</th>\n <td>-17.8349</td>\n <td>28.5346</td>\n <td>26.0</td>\n <td>1.6</td>\n <td>2017-03-09 23:44:06+00:00</td>\n </tr>\n <tr>\n <th>11343</th>\n <td>-17.8459</td>\n <td>28.5491</td>\n <td>27.0</td>\n <td>2.0</td>\n <td>2017-03-10 00:16:10+00:00</td>\n </tr>\n <tr>\n <th>11344</th>\n <td>-17.8863</td>\n <td>28.5008</td>\n <td>20.0</td>\n <td>2.1</td>\n <td>2017-03-10 00:16:11+00:00</td>\n </tr>\n <tr>\n <th>11345</th>\n <td>-17.8657</td>\n <td>28.5204</td>\n <td>30.0</td>\n <td>1.6</td>\n <td>2017-03-10 03:20:26+00:00</td>\n </tr>\n <tr>\n <th>11342</th>\n <td>-17.7156</td>\n <td>28.5985</td>\n <td>0.0</td>\n <td>1.6</td>\n <td>2017-08-21 02:06:55+00:00</td>\n </tr>\n </tbody>\n</table>\n</div>\n```\n:::\n:::\n\n\n::: {#21723e11 .cell execution_count=3}\n``` {}\ndf.describe()\n```\n\n::: {.cell-output .cell-output-display execution_count=52}\n```{=html}\n<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>Longitude</th>\n <th>Latitude</th>\n <th>Depth(km)</th>\n <th>Magnitude</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>count</th>\n <td>11347.000000</td>\n <td>11347.000000</td>\n <td>11347.000000</td>\n <td>11347.000000</td>\n </tr>\n <tr>\n <th>mean</th>\n <td>-17.844062</td>\n <td>28.568893</td>\n <td>14.089345</td>\n <td>2.432423</td>\n </tr>\n <tr>\n <th>std</th>\n <td>0.027345</td>\n <td>0.021899</td>\n <td>8.624787</td>\n <td>0.705282</td>\n </tr>\n <tr>\n <th>min</th>\n <td>-17.995800</td>\n <td>28.310200</td>\n <td>0.000000</td>\n <td>0.200000</td>\n </tr>\n <tr>\n <th>25%</th>\n <td>-17.854100</td>\n <td>28.558000</td>\n <td>10.100000</td>\n <td>1.900000</td>\n </tr>\n <tr>\n <th>50%</th>\n <td>-17.838700</td>\n <td>28.564000</td>\n <td>11.300000</td>\n <td>2.600000</td>\n </tr>\n <tr>\n <th>75%</th>\n <td>-17.829700</td>\n <td>28.574300</td>\n <td>13.900000</td>\n <td>2.900000</td>\n </tr>\n <tr>\n <th>max</th>\n <td>-17.705700</td>\n <td>28.697800</td>\n <td>46.900000</td>\n <td>5.100000</td>\n </tr>\n </tbody>\n</table>\n</div>\n```\n:::\n:::\n\n\n::: {#9068959c .cell execution_count=4}\n``` {}\ndf.plot.scatter(x=\"Longitude\", y=\"Latitude\", figsize=(12,12), grid=\"on\");\n```\n\n::: {.cell-output .cell-output-display}\n![](data-screening_files/figure-html/cell-5-output-1.png){width=978 height=947}\n:::\n:::\n\n\n:::{#e174c67e .cell .markdown}\n### Filter \n\nAlso some rows seem to be missing depth measurements, (see differences in the **count** for columns above) - take only rows with valid depths\n:::\n\n::: {#7f572f04 .cell execution_count=5}\n``` {}\ndf = df[df['Depth(km)'].notna()]\ndf.describe()\n```\n\n::: {.cell-output .cell-output-display execution_count=54}\n```{=html}\n<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>Longitude</th>\n <th>Latitude</th>\n <th>Depth(km)</th>\n <th>Magnitude</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>count</th>\n <td>11347.000000</td>\n <td>11347.000000</td>\n <td>11347.000000</td>\n <td>11347.000000</td>\n </tr>\n <tr>\n <th>mean</th>\n <td>-17.844062</td>\n <td>28.568893</td>\n <td>14.089345</td>\n <td>2.432423</td>\n </tr>\n <tr>\n <th>std</th>\n <td>0.027345</td>\n <td>0.021899</td>\n <td>8.624787</td>\n <td>0.705282</td>\n </tr>\n <tr>\n <th>min</th>\n <td>-17.995800</td>\n <td>28.310200</td>\n <td>0.000000</td>\n <td>0.200000</td>\n </tr>\n <tr>\n <th>25%</th>\n <td>-17.854100</td>\n <td>28.558000</td>\n <td>10.100000</td>\n <td>1.900000</td>\n </tr>\n <tr>\n <th>50%</th>\n <td>-17.838700</td>\n <td>28.564000</td>\n <td>11.300000</td>\n <td>2.600000</td>\n </tr>\n <tr>\n <th>75%</th>\n <td>-17.829700</td>\n <td>28.574300</td>\n <td>13.900000</td>\n <td>2.900000</td>\n </tr>\n <tr>\n <th>max</th>\n <td>-17.705700</td>\n <td>28.697800</td>\n <td>46.900000</td>\n <td>5.100000</td>\n </tr>\n </tbody>\n</table>\n</div>\n```\n:::\n:::\n\n\n::: {#033910d5 .cell execution_count=6}\n``` {}\nplt.figure(figsize=(20,6))\nplt.subplot(1,3,1)\ndf[\"Latitude\"].plot.hist(bins=20, density=True)\nplt.subplot(1,3,2)\ndf[\"Longitude\"].plot.hist(bins=20, density=True)\nplt.subplot(1,3,3)\ndf[\"Depth(km)\"].plot.hist(bins=50, density=True)\n```\n\n::: {.cell-output .cell-output-display execution_count=55}\n```\n<Axes: ylabel='Frequency'>\n```\n:::\n\n::: {.cell-output .cell-output-display}\n![](data-screening_files/figure-html/cell-7-output-2.png){width=1565 height=485}\n:::\n:::\n\n\n:::{#054be9fd .cell .markdown}\n## Spatial Plot\n\nScatter plot the spatial locations of events\n:::\n\n::: {#cell-fig-spatial-plot .cell execution_count=7}\n``` {}\n#| label: fig-spatial-plot\n#| fig-cap: Locations of earthquakes on La Palma since 2017.\n#| fig-alt: A scatterplot of earthquake locations plotting latitude against longitude.\nfrom matplotlib import colormaps\ncmap = colormaps['viridis_r']\nax = df.plot.scatter(x=\"Longitude\", y=\"Latitude\", \n s=47-df[\"Depth(km)\"], c=df[\"Magnitude\"], \n figsize=(12,10), grid=\"on\", cmap=cmap)\ncolorbar = ax.collections[0].colorbar\ncolorbar.set_label(\"Magnitude\")\n\nplt.show()\n```\n\n::: {.cell-output .cell-output-display}\n![Locations of earthquakes on La Palma since 2017.](data-screening_files/figure-html/fig-spatial-plot-output-1.png){#fig-spatial-plot width=917 height=799 fig-alt='A scatterplot of earthquake locations plotting latitude against longitude.'}\n:::\n:::\n\n\n:::{#28d136a3 .cell .markdown}\n### Timeline Plot\n\nScatter plot the event time series and look for any quantization issues. Have times & dates been loaded correctly?\n\n\nax = df.plot.scatter(x='DateTime', y='Depth(km)', figsize=(20,8))\nax.set_ylim(50,0);\n:::\n\n",
"markdown": "---\ntitle: Data Screening\ndescription: Screening and filtering data from the IGN catalog down to the relevant events for La Palma\nauthors:\n - name: Steve Purves\n orcid: 0000-0002-0760-5497\n - name: Charlotte Wickham\n note: Edited original notebook by Steve Purves\n---\n\n::: {#6c6b8b20 .cell execution_count=1}\n``` {}\nimport pandas as pd\nimport matplotlib.pyplot as plt\n```\n:::\n\n\n:::{#a6b6d890 .cell .markdown}\nImport `la-palma.csv` - a clean subset of [`catalogoComunSV_1663233588717.csv`](https://github.com/Notebooks-Now/submission-quarto-full/blob/main/data/catalogoComunSV_1663233588717.csv):\n:::\n\n::: {#09c76fc6 .cell execution_count=2}\n``` {}\ndf = pd.read_csv('la-palma.csv')\ndf['DateTime'] = pd.to_datetime(df['DateTime'])\ndf = df.sort_values(by=['DateTime'], ascending=True)\ndf.head()\n```\n\n::: {.cell-output .cell-output-display execution_count=2}\n```{=html}\n<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>Longitude</th>\n <th>Latitude</th>\n <th>Depth(km)</th>\n <th>Magnitude</th>\n <th>DateTime</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>11346</th>\n <td>-17.8349</td>\n <td>28.5346</td>\n <td>26.0</td>\n <td>1.6</td>\n <td>2017-03-09 23:44:06+00:00</td>\n </tr>\n <tr>\n <th>11343</th>\n <td>-17.8459</td>\n <td>28.5491</td>\n <td>27.0</td>\n <td>2.0</td>\n <td>2017-03-10 00:16:10+00:00</td>\n </tr>\n <tr>\n <th>11344</th>\n <td>-17.8863</td>\n <td>28.5008</td>\n <td>20.0</td>\n <td>2.1</td>\n <td>2017-03-10 00:16:11+00:00</td>\n </tr>\n <tr>\n <th>11345</th>\n <td>-17.8657</td>\n <td>28.5204</td>\n <td>30.0</td>\n <td>1.6</td>\n <td>2017-03-10 03:20:26+00:00</td>\n </tr>\n <tr>\n <th>11342</th>\n <td>-17.7156</td>\n <td>28.5985</td>\n <td>0.0</td>\n <td>1.6</td>\n <td>2017-08-21 02:06:55+00:00</td>\n </tr>\n </tbody>\n</table>\n</div>\n```\n:::\n:::\n\n\n::: {#e8ff1eca .cell execution_count=3}\n``` {}\ndf.describe()\n```\n\n::: {.cell-output .cell-output-display execution_count=3}\n```{=html}\n<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>Longitude</th>\n <th>Latitude</th>\n <th>Depth(km)</th>\n <th>Magnitude</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>count</th>\n <td>11347.000000</td>\n <td>11347.000000</td>\n <td>11347.000000</td>\n <td>11347.000000</td>\n </tr>\n <tr>\n <th>mean</th>\n <td>-17.844062</td>\n <td>28.568893</td>\n <td>14.089345</td>\n <td>2.432423</td>\n </tr>\n <tr>\n <th>std</th>\n <td>0.027345</td>\n <td>0.021899</td>\n <td>8.624787</td>\n <td>0.705282</td>\n </tr>\n <tr>\n <th>min</th>\n <td>-17.995800</td>\n <td>28.310200</td>\n <td>0.000000</td>\n <td>0.200000</td>\n </tr>\n <tr>\n <th>25%</th>\n <td>-17.854100</td>\n <td>28.558000</td>\n <td>10.100000</td>\n <td>1.900000</td>\n </tr>\n <tr>\n <th>50%</th>\n <td>-17.838700</td>\n <td>28.564000</td>\n <td>11.300000</td>\n <td>2.600000</td>\n </tr>\n <tr>\n <th>75%</th>\n <td>-17.829700</td>\n <td>28.574300</td>\n <td>13.900000</td>\n <td>2.900000</td>\n </tr>\n <tr>\n <th>max</th>\n <td>-17.705700</td>\n <td>28.697800</td>\n <td>46.900000</td>\n <td>5.100000</td>\n </tr>\n </tbody>\n</table>\n</div>\n```\n:::\n:::\n\n\n::: {#64dcb61f .cell execution_count=4}\n``` {}\ndf.plot.scatter(x=\"Longitude\", y=\"Latitude\", figsize=(12,12), grid=\"on\");\n```\n\n::: {.cell-output .cell-output-display}\n![](data-screening_files/figure-html/cell-5-output-1.png){width=978 height=947}\n:::\n:::\n\n\n:::{#ff18cec9 .cell .markdown}\n### Filter \n\nAlso some rows seem to be missing depth measurements, (see differences in the **count** for columns above) - take only rows with valid depths\n:::\n\n::: {#a3612d29 .cell execution_count=5}\n``` {}\ndf = df[df['Depth(km)'].notna()]\ndf.describe()\n```\n\n::: {.cell-output .cell-output-display execution_count=5}\n```{=html}\n<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>Longitude</th>\n <th>Latitude</th>\n <th>Depth(km)</th>\n <th>Magnitude</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>count</th>\n <td>11347.000000</td>\n <td>11347.000000</td>\n <td>11347.000000</td>\n <td>11347.000000</td>\n </tr>\n <tr>\n <th>mean</th>\n <td>-17.844062</td>\n <td>28.568893</td>\n <td>14.089345</td>\n <td>2.432423</td>\n </tr>\n <tr>\n <th>std</th>\n <td>0.027345</td>\n <td>0.021899</td>\n <td>8.624787</td>\n <td>0.705282</td>\n </tr>\n <tr>\n <th>min</th>\n <td>-17.995800</td>\n <td>28.310200</td>\n <td>0.000000</td>\n <td>0.200000</td>\n </tr>\n <tr>\n <th>25%</th>\n <td>-17.854100</td>\n <td>28.558000</td>\n <td>10.100000</td>\n <td>1.900000</td>\n </tr>\n <tr>\n <th>50%</th>\n <td>-17.838700</td>\n <td>28.564000</td>\n <td>11.300000</td>\n <td>2.600000</td>\n </tr>\n <tr>\n <th>75%</th>\n <td>-17.829700</td>\n <td>28.574300</td>\n <td>13.900000</td>\n <td>2.900000</td>\n </tr>\n <tr>\n <th>max</th>\n <td>-17.705700</td>\n <td>28.697800</td>\n <td>46.900000</td>\n <td>5.100000</td>\n </tr>\n </tbody>\n</table>\n</div>\n```\n:::\n:::\n\n\n::: {#265563e8 .cell execution_count=6}\n``` {}\nplt.figure(figsize=(20,6))\nplt.subplot(1,3,1)\ndf[\"Latitude\"].plot.hist(bins=20, density=True)\nplt.subplot(1,3,2)\ndf[\"Longitude\"].plot.hist(bins=20, density=True)\nplt.subplot(1,3,3)\ndf[\"Depth(km)\"].plot.hist(bins=50, density=True)\n```\n\n::: {.cell-output .cell-output-display execution_count=6}\n```\n<Axes: ylabel='Frequency'>\n```\n:::\n\n::: {.cell-output .cell-output-display}\n![](data-screening_files/figure-html/cell-7-output-2.png){width=1565 height=485}\n:::\n:::\n\n\n:::{#387bb661 .cell .markdown}\n## Spatial Plot\n\nScatter plot the spatial locations of events\n:::\n\n::: {#cell-fig-spatial-plot .cell execution_count=7}\n``` {}\n#| label: fig-spatial-plot\n#| fig-cap: Locations of earthquakes on La Palma since 2017.\n#| fig-alt: A scatterplot of earthquake locations plotting latitude against longitude.\nfrom matplotlib import colormaps\ncmap = colormaps['viridis_r']\nax = df.plot.scatter(x=\"Longitude\", y=\"Latitude\", \n s=47-df[\"Depth(km)\"], c=df[\"Magnitude\"], \n figsize=(12,10), grid=\"on\", cmap=cmap)\ncolorbar = ax.collections[0].colorbar\ncolorbar.set_label(\"Magnitude\")\n\nplt.show()\n```\n\n::: {.cell-output .cell-output-display}\n![Locations of earthquakes on La Palma since 2017.](data-screening_files/figure-html/fig-spatial-plot-output-1.png){#fig-spatial-plot width=917 height=799 fig-alt='A scatterplot of earthquake locations plotting latitude against longitude.'}\n:::\n:::\n\n\n:::{#d3cde14f .cell .markdown}\n### Timeline Plot\n\nScatter plot the event time series and look for any quantization issues. Have times & dates been loaded correctly?\n\n\nax = df.plot.scatter(x='DateTime', y='Depth(km)', figsize=(20,8))\nax.set_ylim(50,0);\n:::\n\n",
"supporting": [
"data-screening_files/figure-html"
"data-screening_files"
],
"filters": [],
"includes": {
Expand Down
Loading

0 comments on commit df1c7f2

Please sign in to comment.