CS logo

Analysis of deep-focus earthquakes by the Creative Society Scientific community team¶


Introduction¶

The team of scientific community of the Creative Society has analyzed and prepared visualizations of deep-focus earthquake data. Some of the results of this analysis are presented in the form of graphics on April 22, 2023, at the International Online Forum "Global Crisis. There is a Way Out.".

Goal of the Creative Society Scientific community: Identification of impacts and processes that form cyclic planetary cataclysms in order to search for adaptive mechanisms and prevent the global threat of irreversible changes in climate and geodynamics in order to save billions of human lives.

Deep-focus earthquake data analysis problems:

  1. Identify patterns in deep-focus earthquakes that reflect the internal processes occurring within the Earth's core.
  2. Monitor the activity of magmatic processes in the vicinity of the Mariana Trench.
  3. Identify how events within the mantle are reflected in the occurrence of swarms of earthquakes, volcano activation, and strong earthquakes.
  4. Assess the heating dynamics of the Earth's core based on the quantity and magnitude of deep-focus earthquakes. This in turn will help us understand what to expect in the coming years.
  5. Revealing of manipulation of seismic data, such as underestimation or falsification of magnitude, exclusion or deliberate omission of seismic events by international seismic databases.

This work allows for a deeper understanding of the processes occurring in the Earth's mantle at depths ranging from 300 to 800 km, and will be useful for identifying patterns, as well as for forecasting and preparing for future strong earthquakes. All presented graphics are interactive, allowing for independent analysis of the provided data.

Among other things, according to the results we can see some inconsistencies in the data (see for example “Density Heatmap (Year, Magnitude)”), which may indicate possible manipulations with the data.

The source data has been downloaded from the International Seismological Centre (ISC) website, selecting events with depths of 300 km and more, and dates from 1979 to March 31, 2023 (file repack_deep.csv).

If you have any questions, feel free to reach out to us at [email protected]

Fast-forward¶

Navigate to "Analyse" section to see results.

  • Highlights
  • Geographical distribution
  • Heatmaps
  • Trend for annual number of earthquakes
  • Earthquakes deeper than 700km
  • Middle East
  • Nicaragua
  • 6 <= Magnitude
  • Clusters

Details¶

Dataset¶

Data on earthquake events is sourced from ISC website. It was downloaded for each year manually.

Please note that data for the most recent years may still be incomplete.

All earthquake data is filtered for events with depth >= 300 km and starting 1979 year ending March 31, 2023.

Data downloaded from ISC on April 03, 2023.

Dataset pre-handling¶

We used a separate program to pre-handle data retrieved from ISC.

The program takes a list of magnitude estimates from different agencies for an earthquake event and outputs the most preferred magnitude according to a pre-defined priority order. The priority order is defined in an array named 'p' in the source code.

See more in select-mag-isc.c's description.

Library¶

We extracted common code used to visualize the data into a separate library that is using Plotly at its core.

How to repeat results¶

Download archive with original .ipynb and follow instructions described there.

All graphics are also available separately in the file.


Prepare¶

This section is purely technical, skip to next section "Read data".

Ensure packages are installed¶

In [1]:
# Conda installation is better, when accessible

# Used for clustering
try:
    import sklearn
except ImportError as exc:
    print(exc)
    !conda install -q -y scikit-learn

# Used for trendlines
try:
    import statsmodels
except ImportError as exc:
    print(exc)
    !conda install -q -y -c conda-forge statsmodels
In [2]:
try:
    import arcsage
except ImportError as exc:
    print(exc)
    !pip install -q arcsage-0.1.0a11-py3-none-any.whl[all]

Imports¶

In [3]:
%matplotlib inline

import datetime
import pathlib
import logging
from functools import partial

import numpy as np  # linear algebra
import pandas as pd  # data processing, CSV file I/O (e.g. pd.read_csv)
import plotly.express as px
import plotly.offline as offline
from arcsage.config.dataset import DatasetSettings
from arcsage.config.notebook import notebook_settings
from arcsage.config.plotter import default_plotter_settings
from arcsage.data.data import SelectedData
from arcsage.data.selector import DataSelector
from arcsage.visualize.density.mag_depth import MagDepthHeatmapPlotter
from arcsage.visualize.density.map import DensityMapboxPlotter
from arcsage.visualize.density.time_depth import YearDepthHeatmapPlotter
from arcsage.visualize.density.time_mag import DayMagHeatmapPlotter, YearMagHeatmapPlotter
from arcsage.visualize.scatter.coord3d import ScatterCoordPlotter
from arcsage.visualize.scatter.map import ScatterMapboxPlotter
from arcsage.visualize.scatter.time_depth import ScatterYearDepthPlotter
from arcsage.visualize.scatter.time_mag_depth import ScatterDayMagDepthPlotter, ScatterYearMagDepthPlotter
from arcsage.visualize.utils import for_each
from arcsage.visualize.writer import PlotWriter

offline.init_notebook_mode()

Settings¶

Constants¶

In [4]:
DATA_DIR = pathlib.Path('./data/')
OUTPUT_DIR = pathlib.Path('./output/')

# presentation mode
logging.getLogger('arcsage').setLevel(logging.ERROR)
notebook_settings.LOG_LEVEL = "error"
notebook_settings.DEBUG = False
default_plotter_settings.DEBUG = False

default_plotter_settings.OUTPUT_DIR = OUTPUT_DIR

DEEP_EARTHQUAKES_START: int = 300
DEEPEST_EARTHQUAKES_START: int = 700

Dataset Settings¶

In [5]:
dataset_settings = DatasetSettings(
    dataset_name='ISC',
    timestamp_column='timestamp',
    depth_column='depth',
    magnitude_column='magnitude',
    latitude_column='latitude',
    longitude_column='longitude',
)

Plotter Settings¶

In [6]:
import plotly.io as pio

pio.templates.default = "plotly_white"


plotter_settings = default_plotter_settings.copy()
plotter_settings.HEIGHT = 800
plotter_settings.WIDTH = 1200
plotter_settings.DEPTH_BINS_MULTIPLIER = 1 / 10
plotter_settings.DAY_BINS_MULTIPLIER = 1 / 14
plotter_settings.DEPTH_DECIMALS = 0
plotter_settings.MAPBOX_ZOOM = 1

plotter_heatmap_settings = plotter_settings.copy()
plotter_heatmap_settings.COLOR_CONTINUOUS_SCALE = [
    [0, 'rgb(12,51,131)'],
    [0.01, 'rgb(10,136,186)'],
    [0.2, 'rgb(242,211,56)'],
    [0.5, 'rgb(242,143,56)'],
    [1, 'rgb(217,30,30)'],
]
plotter_heatmap_settings.ADDITIONAL_OPTIONS = dict(
    marginal_x='histogram',
    marginal_y='histogram',
)

density_mapbox_settings = plotter_settings.copy()
density_mapbox_settings.COLOR_CONTINUOUS_SCALE = [
    [0, '#FFFF66'],
    [0.05, '#FFFF66'],
    [0.7, '#ff0000'],
    [1, '#ff0000']
]
In [7]:
plot_writer = PlotWriter.from_settings(plotter_settings)

Tools definition¶

On top of tools from library, this notebook defines few helper functions to build plots.

In [8]:
def depth_ranges_count_by_year(data: SelectedData, depth_step: int, depth_end: int,
                               depth_start: int = DEEP_EARTHQUAKES_START) -> pd.DataFrame:
    years_arr = np.arange(data.left_year, data.right_year + 1)

    depth_start_arr = np.arange(depth_start, depth_end, depth_step)

    size = len(years_arr) * len(depth_start_arr)

    out_df = pd.DataFrame({
        'count': np.zeros((size,)),
        'year': [year for year in years_arr for _ in depth_start_arr],
        'depth_start': [depth_start for _ in years_arr for depth_start in depth_start_arr],
        # 'depth_end': [depth_start + depth_step for _ in years_arr for depth_start in depth_start_arr],
    })
    out_df['depth_end'] = [depth_start + depth_step for depth_start in out_df['depth_start']]
    out_df = out_df.astype({
        'year': 'int64',
        'depth_start': 'int64',
        'depth_end': 'int64',
    })

    for idx, item in out_df.iterrows():
        year = int(item['year'])
        bottom_depth = int(item['depth_start'])
        top_depth = int(item['depth_end'])

        events = DataSelector(
            dataset_settings=dataset_settings,
            bottom_depth=bottom_depth,
            top_depth=top_depth,
            oldest_dt=datetime.datetime(year, 1, 1),
            newest_dt=datetime.datetime(year + 1, 1, 1),
        ).select(data.data)

        count = len(events)
        out_df.at[idx, 'count'] = count

    out_df['depth_range_cat'] = [f'{start}..{end}' for start, end in zip(out_df['depth_start'], out_df['depth_end'])]
    out_df = out_df.astype({
        'count': 'int',
        'depth_range_cat': 'category',
    })

    return out_df
In [9]:
def heatmap_grouped_by_depth_ranges_annually(data: SelectedData):
    fig = px.density_heatmap(
        data.data,
        x=data.dataset_settings.timestamp_column,
        y=data.dataset_settings.depth_column,
        range_y=[800, DEEP_EARTHQUAKES_START],
        nbinsy=6,
        nbinsx=data.right_year - data.left_year + 1,
        height=plotter_settings.HEIGHT,
        width=plotter_settings.WIDTH,
        color_continuous_scale=None,
        text_auto=plotter_settings.TEXT_AUTO,
        marginal_x='histogram',
        marginal_y='histogram',
        title='Heatmap - Events grouped by depth ranges by year',
    )
    plot_writer.write(fig)
    return fig
In [10]:
def histogram_depth_ranges_annually(data_df: pd.DataFrame):
    fig = px.histogram(
        data_frame=data_df,
        x='year',
        y='count',
        nbins=len(data_df['year'].unique()),
        color='depth_range_cat',
        barmode='relative',
        opacity=.8,
        height=plotter_settings.HEIGHT,
        width=plotter_settings.WIDTH,
        text_auto=plotter_settings.TEXT_AUTO,
        title='Histogram - depth ranges - by year',
    )
    plot_writer.write(fig)
    return fig
In [11]:
def scatter_depth_ranges_annually(data_df: pd.DataFrame):
    trend = 'lowess'  # options: OLS, LOWESS
    fig = px.scatter(
        data_frame=data_df,
        x='year',
        y='count',
        log_y=True,
        # size='count',
        color='depth_range_cat',
        trendline=trend,
        height=plotter_settings.HEIGHT,
        width=plotter_settings.WIDTH,
        title=f'Scatter - depth ranges - by year - log count - trend={trend}',
    )
    plot_writer.write(fig)
    return fig

Read data¶

In [12]:
df = pd.read_csv(
    DATA_DIR / 'repack_deep.csv',
    parse_dates=[dataset_settings.timestamp_column],
    dtype={
        "depfix": "boolean",
        "type": "category",
        "type.1": "category",
        "author": "category",
        "author.1": "category",
    },
)

df
Out[12]:
timestamp latitude longitude depth magnitude depfix type type.1 author author.1 eventid eventid0
0 1979-01-01 20:30:48 -17.9408 -178.4997 579.0 5.0 True ke mb ISC ISC 670460 284070648
1 1979-01-02 12:18:26 -17.2346 -176.7175 400.0 4.8 True ke mb ISC ISC 670495 284127506
2 1979-01-04 09:25:50 -21.4721 -178.4963 540.4 5.2 <NA> ke mb ISC ISC 670595 284289950
3 1979-01-06 07:31:33 -12.7818 168.9612 625.0 5.0 True ke mb ISC ISC 670681 284455893
4 1979-01-06 21:16:33 -17.5014 -178.7215 539.0 4.4 True ke mb ISC ISC 670708 284505393
... ... ... ... ... ... ... ... ... ... ... ... ...
72112 2023-03-30 15:29:21 32.9620 136.7120 408.6 4.3 <NA> se M GFZ NEIC 625930888 1680190161
72113 2023-03-30 20:55:00 -17.9510 -178.5690 572.0 4.4 <NA> se M NEIC NEIC 625931017 1680209700
72114 2023-03-31 00:33:27 -18.4000 -178.0620 591.3 4.4 <NA> se M GFZ NEIC 625931031 1680222807
72115 2023-03-31 14:50:10 48.1500 145.8900 500.0 4.3 <NA> se MB MOS MOS 625933896 1680274210
72116 2023-03-31 16:00:01 -17.3830 -178.4090 543.0 4.5 <NA> se M NEIC NEIC 625934017 1680278401

72117 rows × 12 columns


Analyse¶

In [13]:
data = SelectedData.select(
    data_df=df,
    dataset_settings=dataset_settings,
    title_comment='deep',
)
Selected 72117 rows into "deep from ISC"

Highlights¶

Plots shared on International Online Forum "Global Crisis. There is a Way Out." on April 22, 2023

Number of deep-focus earthquakes by year and depth (M3.0+)¶

In [14]:
YearDepthHeatmapPlotter(
    data=SelectedData.select_from(data, DataSelector(min_magnitude=3., dataset_settings=dataset_settings), title_comment_suffix='M3.0+'),
    plotter_settings=plotter_heatmap_settings,
).plot()
Selected 59096 rows into "deep - M3.0+ from ISC"

Increase in the number of deep-focus earthquakes at different depths (M3.0+)¶

In [15]:
ranges_count_df = depth_ranges_count_by_year(
    data=SelectedData.select_from(data, DataSelector(min_magnitude=3., dataset_settings=dataset_settings), title_comment_suffix='M3.0+'),
    depth_step=100, depth_end=800,
)
histogram_depth_ranges_annually(data_df=ranges_count_df)
Selected 59096 rows into "deep - M3.0+ from ISC"

Geographical distribution¶

300km <= Depth, 1979 - March 2023

In [16]:
DensityMapboxPlotter(data=data, plotter_settings=density_mapbox_settings).plot()
In [17]:
fig = ScatterCoordPlotter(
    data=data,
    plotter_settings=plotter_settings,
).plot()

# update appearance
fig.update_traces(marker=dict(line=dict(width=0)))
# save updated into files
plot_writer.write(figure=fig)

fig

Heatmaps¶

300km <= Depth, 1979 - March 2023 Earthquakes distribution by Year, Magnitude and Depth.

In [18]:
for_each(
    data=data,
    plotter_settings=plotter_heatmap_settings,
    plotter_factories=[YearMagHeatmapPlotter, YearDepthHeatmapPlotter, MagDepthHeatmapPlotter],
)

Trend for annual number of earthquakes¶

This section analyses trend in count of earthquakes for ranges of depths, by year.

In [19]:
ranges_count_df = depth_ranges_count_by_year(data=data, depth_step=100, depth_end=800)

ranges_count_df
Out[19]:
count year depth_start depth_end depth_range_cat
0 62 1979 300 400 300..400
1 61 1979 400 500 400..500
2 171 1979 500 600 500..600
3 45 1979 600 700 600..700
4 0 1979 700 800 700..800
... ... ... ... ... ...
220 139 2023 300 400 300..400
221 146 2023 400 500 400..500
222 267 2023 500 600 500..600
223 66 2023 600 700 600..700
224 0 2023 700 800 700..800

225 rows × 5 columns

Heatmap - depth ranges - annually¶

In [20]:
heatmap_grouped_by_depth_ranges_annually(data=data)

Mind years 1995 and 2018.

Histogram - depth ranges - annually¶

In [21]:
histogram_depth_ranges_annually(data_df=ranges_count_df)

Scatter - depth ranges - annually - logarithmic scale¶

In [22]:
scatter_depth_ranges_annually(data_df=ranges_count_df)

Earthquakes deeper than 700km¶

This section analyses deepest earthquakes.

In [23]:
deepest_data = SelectedData.select_from(
    data=data,
    selector=DataSelector(dataset_settings=data.dataset_settings, bottom_depth=DEEPEST_EARTHQUAKES_START),
    title_comment='700km+',
)
Selected 553 rows into "700km+ from ISC"

Reported depth distribution analysis¶

Graph below indicates poor resolution of depth for that range of depth - there's huge inconsistency in distribution.

In [24]:
px.histogram(
    deepest_data.data,
    x=deepest_data.dataset_settings.depth_column,
    histnorm='probability',
)

Plots¶

In [25]:
DensityMapboxPlotter(
    data=deepest_data,
    plotter_settings=density_mapbox_settings,
).plot()
In [26]:
ScatterMapboxPlotter(
    data=deepest_data,
    plotter_settings=plotter_settings,
    color=dataset_settings.magnitude_column,
).plot()
In [27]:
ScatterCoordPlotter(
    data=deepest_data,
    plotter_settings=plotter_settings,
).plot()
In [28]:
ScatterYearMagDepthPlotter(
    data=deepest_data,
    plotter_settings=plotter_settings,
    size=dataset_settings.magnitude_column,
    color=dataset_settings.magnitude_column,
).plot()

year 2021¶

In [29]:
deepest_data_2021 = SelectedData.select_from(
    deepest_data,
    selector=DataSelector(
        dataset_settings=deepest_data.dataset_settings,
        left_year=2021,
        right_year=2022,
    ),
    title_comment_suffix='2021',
)
Selected 263 rows into "700km+ - 2021 from ISC"
In [30]:
DensityMapboxPlotter(data=deepest_data_2021, plotter_settings=density_mapbox_settings).plot()
In [31]:
ScatterMapboxPlotter(
    data=deepest_data_2021,
    plotter_settings=plotter_settings,
    color=dataset_settings.magnitude_column,
).plot()
In [32]:
ScatterDayMagDepthPlotter(
    data=deepest_data_2021,
    plotter_settings=plotter_settings,
    size=dataset_settings.magnitude_column,
    color=dataset_settings.magnitude_column,
).plot()
In [33]:
# as the scatter above shows, depth distribution is not great - choosing plane without depth for heatmap
DayMagHeatmapPlotter(
    data=deepest_data_2021,
    plotter_settings=plotter_heatmap_settings,
).plot()

Middle East¶

This section is important in context of devastating events in February of 2023 in Turkey and Syria.

In [34]:
data_ME = SelectedData.select_from(
    data=data,
    selector=DataSelector(
        dataset_settings=data.dataset_settings,
        upper_limit_sign='<=',
        south_latitude = 20,
        north_latitude = 42,
        west_longitude = 20,
        east_longitude = 55,
    ),
    title_comment_suffix='Middle East',
)

data_ME.data
Selected 232 rows into "deep - Middle East from ISC"
Out[34]:
timestamp latitude longitude depth magnitude depfix type type.1 author author.1 eventid eventid0
6789 1995-01-12 20:52:39 40.6300 22.9500 361.1 3.3 <NA> ke mb EIDC EIDC 302230276 789943959
58135 2018-08-29 09:09:38 27.3830 35.1490 565.3 7.1 <NA> ke MD THR THR 620347051 1535533778
62581 2020-01-15 04:26:24 30.9300 37.9500 750.0 3.2 <NA> se MLv JSO JSO 624385522 1579062384
62665 2020-01-25 19:37:55 31.0700 37.7500 750.0 3.4 <NA> se MLv JSO JSO 624385531 1579981075
62668 2020-01-25 21:38:30 30.8700 38.0000 750.0 3.5 <NA> se MLv JSO JSO 624385533 1579988310
... ... ... ... ... ... ... ... ... ... ... ... ...
68747 2021-12-18 23:59:56 32.3940 52.8687 655.4 4.3 <NA> se M JSO JSO 625388429 1639871996
68763 2021-12-21 22:52:50 38.9034 35.2018 750.0 4.9 <NA> se M JSO JSO 625388435 1640127170
68794 2021-12-26 15:59:55 30.9395 39.2668 750.0 4.0 <NA> se M JSO JSO 625388464 1640534395
68810 2021-12-29 04:08:11 39.0468 37.1430 750.0 4.8 <NA> se M JSO JSO 625388469 1640750891
68826 2021-12-30 13:24:29 29.9734 41.5240 750.0 4.6 <NA> se M JSO JSO 625388471 1640870669

232 rows × 12 columns

Only 2 events reported in 1995 and 2018 years.

Events before 2020¶

In [35]:
ScatterMapboxPlotter(
    data=SelectedData.select_from(data_ME, DataSelector(right_year=2020, dataset_settings=dataset_settings), title_comment_suffix='before 2020'),
    plotter_settings=plotter_settings.copy(update=dict(MAPBOX_ZOOM=4, COLOR_CONTINUOUS_SCALE='viridis_r')),
).plot()
Selected 2 rows into "deep - Middle East - before 2020 from ISC"

Starting 2020¶

In [36]:
data_ME_2020p = SelectedData.select_from(
    data=data_ME,
    selector=DataSelector(
        dataset_settings=data.dataset_settings,
        left_year=2020,
    ),
    title_comment_suffix='Middle East - 2020..',
)
Selected 230 rows into "deep - Middle East - Middle East - 2020.. from ISC"
In [37]:
for_each(
    data=data_ME_2020p,
    plotter_settings=plotter_settings.copy(update=dict(MAPBOX_ZOOM=4)),
    plotter_factories=[
        partial(ScatterMapboxPlotter, color=dataset_settings.magnitude_column),
        partial(ScatterCoordPlotter, size=dataset_settings.magnitude_column, color=dataset_settings.magnitude_column),
        partial(ScatterDayMagDepthPlotter, color=dataset_settings.magnitude_column, size=dataset_settings.magnitude_column),
    ],
)
In [38]:
# other 2 heatmaps are not very useful due to poor depth resolution
DayMagHeatmapPlotter(
    data=data_ME_2020p,
    plotter_settings=plotter_heatmap_settings.copy(update=dict(
        DAY_BINS_MULTIPLIER=1/14,
    )),
).plot()

Nicaragua¶

All years (reported 1979 - March 2023)

In [39]:
data_Nicaragua = SelectedData.select_from(
    data=data,
    selector=DataSelector(
        dataset_settings=data.dataset_settings,
        upper_limit_sign='<=',
        south_latitude = 13 - 10,
        north_latitude = 13 + 10,
        west_longitude = -86 - 10,
        east_longitude = -86 + 10,
    ),
    title_comment_suffix='Nicaragua',
)

data_Nicaragua.data
Selected 129 rows into "deep - Nicaragua from ISC"
Out[39]:
timestamp latitude longitude depth magnitude depfix type type.1 author author.1 eventid eventid0
2271 1985-07-18 02:37:26 17.5669 -92.0286 300.0 4.3 True ke mb ISC NEIC 520571 490502246
5642 1992-11-11 02:26:11 12.3700 -83.5570 328.5 3.9 <NA> ke md CADCG CADCG 262028 721448771
6001 1993-07-04 20:02:38 14.2390 -90.1620 317.0 3.3 <NA> ke md CADCG CADCG 218081 741816158
6063 1993-08-15 02:24:31 12.6540 -87.0500 308.7 4.1 <NA> ke md CADCG CADCG 214195 745381471
6134 1993-10-02 16:22:22 7.7540 -82.5710 445.4 3.8 <NA> ke md CADCG CADCG 200744 749578942
... ... ... ... ... ... ... ... ... ... ... ... ...
68768 2021-12-22 06:03:08 13.5756 -86.3214 750.0 3.9 <NA> se M SNET SNET 625356957 1640152988
68817 2021-12-29 18:43:38 14.5366 -91.3043 750.0 4.6 <NA> se M SNET SNET 625357416 1640803418
68818 2021-12-29 18:43:39 14.3001 -91.1118 750.0 4.7 <NA> se M SNET SNET 625357419 1640803419
68819 2021-12-29 18:43:39 14.5033 -90.9613 750.0 4.7 <NA> se M SNET SNET 625357422 1640803419
68820 2021-12-29 18:44:01 15.4153 -90.4169 501.4 4.5 <NA> se M SNET SNET 625357413 1640803441

129 rows × 12 columns

Geographic distribution¶

In [40]:
# scatter is enough, density not needed
ScatterMapboxPlotter(
    data=data_Nicaragua,
    plotter_settings=plotter_settings.copy(update=dict(MAPBOX_ZOOM=5, COLOR_CONTINUOUS_SCALE='viridis_r')),
    # color=dataset_settings.depth_column,
    title_core='colored by depth',
).plot()
In [41]:
ScatterMapboxPlotter(
    data=data_Nicaragua,
    plotter_settings=plotter_settings.copy(update=dict(MAPBOX_ZOOM=5)),
    color=dataset_settings.magnitude_column,
    title_core='colored by magnitude',
).plot()
In [42]:
ScatterCoordPlotter(
    data=data_Nicaragua,
    plotter_settings=plotter_settings.copy(update=dict(MAPBOX_ZOOM=5)),
).plot()

Plots¶

In [43]:
# other heatmaps mostly have single points in each bin - following scatters are sufficient.
YearDepthHeatmapPlotter(data=data_Nicaragua, plotter_settings=plotter_heatmap_settings).plot()
In [44]:
ScatterYearMagDepthPlotter(
    data=data_Nicaragua,
    plotter_settings=plotter_settings,
).plot()

6 <= Magnitude¶

This section focuses on powerful events with magnitude 6 or higher.

In [45]:
data_mag_6p = SelectedData.select_from(
    data=data,
    selector=DataSelector(min_magnitude=6, dataset_settings=data.dataset_settings),
    title_comment_suffix='mag 6+',
)
Selected 493 rows into "deep - mag 6+ from ISC"

Heatmap trio¶

In [46]:
for_each(
    data=data_mag_6p,
    plotter_settings=plotter_heatmap_settings,
    plotter_factories=[YearMagHeatmapPlotter, YearDepthHeatmapPlotter, MagDepthHeatmapPlotter],
)

Geographic distribution¶

In [47]:
ScatterMapboxPlotter(
    data=data_mag_6p,
    plotter_settings=plotter_settings,
    color=dataset_settings.magnitude_column,
    title_core='colored by magnitude',
).plot()
In [48]:
ScatterMapboxPlotter(
    data=data_mag_6p,
    plotter_settings=plotter_settings.copy(update=dict(COLOR_CONTINUOUS_SCALE='viridis_r')),
    color=dataset_settings.depth_column,
    title_core='colored by depth',
).plot()
In [49]:
ScatterCoordPlotter(
    data=data_mag_6p,
    plotter_settings=plotter_settings,
).plot()

Scatters by Year and Depth¶

Scatters allow picking out single events to see more information about it.

In [50]:
for_each(
    data=data_mag_6p,
    plotter_settings=plotter_settings,
    plotter_factories=[ScatterYearDepthPlotter, ScatterYearMagDepthPlotter],
)

Clusters¶

Grouping events that are related by 1 degree and 2 days difference.

In [51]:
from arcsage.utils.earthquake_clusterization import EarthquakeClusterScanner

scanner = EarthquakeClusterScanner(
    distance=1,  # 1 degree difference for both latitude and longitude
    timediff=48,  # 48 hours == 2 days
    min_samples=10,
    default_column_names=(
        dataset_settings.timestamp_column,
        dataset_settings.latitude_column,
        dataset_settings.longitude_column,
    )
)

df = scanner.scan_clusters(df)

print("Unique clusters:", df.cluster_label.nunique() - 1)
Unique clusters: 62
In [52]:
clusters = SelectedData.select(
    data_df=df[df['cluster_label'] > -1],  # filter out unclustered events
    dataset_settings=dataset_settings,
    title_comment='clusters',
)
Selected 1639 rows into "clusters from ISC"

Geographical distribution of clustered events only¶

In [53]:
DensityMapboxPlotter(
    data=clusters,
    plotter_settings=density_mapbox_settings,
).plot()

Colored by cluster label¶

In [54]:
ScatterMapboxPlotter(
    data=clusters,
    plotter_settings=plotter_settings,
    color='cluster_label',
).plot()
In [55]:
fig = ScatterCoordPlotter(
    data=clusters,
    plotter_settings=plotter_settings,
    color='cluster_label',
).plot()

# update appearance
fig.update_traces(marker=dict(line=dict(width=0)))
# save updated into files
plot_writer.write(figure=fig)

fig
In [56]:
ScatterYearDepthPlotter(
    data=clusters,
    plotter_settings=plotter_settings,
    color='cluster_label',
).plot()
In [57]:
fig = ScatterYearMagDepthPlotter(
    data=clusters,
    plotter_settings=plotter_settings,
    color='cluster_label',
).plot()

# update appearance
fig.update_traces(marker=dict(line=dict(width=0)))
# save updated into files
plot_writer.write(figure=fig)

fig

Playground¶

In [57]: