pyphoon.eda_jma

Get to know the stats behind your best track data. This module focuses on the, JMA provided data. Therefore we encourage your to read on the details of the data format at JMA RSMC Tokyo-Typhoon Center.

pyphoon.eda_jma.update_feature_names(names)

You can pdate the default feature names. Feature names refer to each column in JMA provided TSV files.

Parameters:names – List with feature names. Length of the list must coincide with length of TSV files.
pyphoon.eda_jma.plot_hist(data, feature_index, bins=100, centre=False, normed=False, show_fig=False, title='', xlabel='', save_fig=False, fig_name='untitled')

Generates a histogram of a certain feature from the samples in data. This image may be stored or just displayed.

Parameters:
  • data (numpy.array) – Array with best track data. Details on all features can be found at the JMA RSMC Tokyo-Typhoon Center website.
  • feature_index (int) – Index of the feature to be analyze.
  • bins (int or list, default 100) – It can be the number of bins to use to plot the histogram or an array defining the bin intervals. You may set it to -1 if you want as many bins as different values has the data.
  • centre (bool, default False) – Set to True if xticks should be centred.
  • normed (bool, default False) – Set to true if histogram values should add up to one.
  • show_fig (bool, default False figure) – Set to True to show the histogram plot.
  • title (str, default "") – Title of the plot.
  • xlabel (str, default "") – Label for x-axis.
  • save_fig (bool, default False) – Set to True if you want to save the plot figure. See argument fig_name.
  • fig_name (str, default "untitled") – Filename for the stored plot figure.
pyphoon.eda_jma.plot_2feature_heatmap(data, index1, index2=4, annotation=True, linewidths=0.5, show_fig=False, title='untitled', save_fig=False, fig_name='untitled')

Plots heatmap of the data based on the values they take on two given features.

Parameters:
  • data (pandas.DataFrame) – Data samples as a numpy.array.
  • index1 (int) – Index of the feature 1 in the heatmap
  • index2 (int) – Index of the feature 2 in the heatmap
  • annotation (boold, default True) – Set to true if heatmap cell value is to be displayed.
  • linewidths (float) – Width of the separation line between of the cells in the heatmap
  • show_fig (bool, default False) – Flag to plot the histogram.
  • title (str) – Title of the plot
  • save_fig (bool, default False) – Set to true if image should be saved.
  • fig_name (bool, default "untitled") – Filename of stored imaged.

Example:

In the following example we load the best track data. Note that we only consider data starting from 1978. We take the eighth and forth features, which represent the wind speed and the class identifier, respectively. Hence, we aim to visualize the distribution of the pressure values depending on the class they belong to.

>>> from pyphoon.io.tsv import read_tsvs
>>> from pyphoon.eda_jma import plot_2feature_heatmap
>>> import numpy as np
>>> # Load data and convert to np.array
>>> data = np.array(read_tsvs())
>>> # Only consider data since 1978
>>> data = data[data[:, 0] > 1977]
>>> plot_2feature_heatmap(data, index1=7, index2=4, linewidths=0, title="Wind (class)", annot=False)
map to buried treasure