Histogram and Statistics Table Examples#

In this notebook, we utilize concatenated data from the Pacific hake survey to generate histograms and statistics tables under both echogram-control mode and track-control mode. This data has been seamlessly integrated with geographical coordinates.

Significance of Histogram and Statistics Table Visualization#

Here’s why histograms and statistics tables are vital for fisheries scientists:

  • Fisheries scientists can use these tools to focus on specific portions of an echogram or sections of a track while scrolling through data. This allows them to examine the distribution of Sv (volume backscattering strength) and gain insights into the types of fish observed.

  • For a more comprehensive analysis, fisheries scientists can compare Sv distributions across multiple echosounder channels (frequencies). This comparison helps them determine the likely composition of fish aggregations, providing valuable insights into the ecosystem.

Import Packages and Data#

import panel
import xarray as xr

import echoshader
from urllib import request

# Calibratd data is stored in Google Drive
url = 'https://drive.google.com/uc?export=download&id=197D0MW-bHaF6mZLcQwyr4zqyEHIfwsep'

def urllib_download():
    request.urlretrieve(url, 'concatenated_MVBS.nc')

urllib_download() 

# Load sample data for testing
MVBS_ds = xr.open_mfdataset(
    paths="concatenated_MVBS.nc",
    data_vars="minimal",
    coords="minimal",
    combine="by_coords",
)

MVBS_ds
<xarray.Dataset>
Dimensions:            (channel: 4, echo_range: 150, ping_time: 875)
Coordinates:
  * channel            (channel) object 'GPT  18 kHz 009072058c8d 1-1 ES18-11...
  * echo_range         (echo_range) float64 0.0 5.0 10.0 ... 735.0 740.0 745.0
  * ping_time          (ping_time) datetime64[ns] 2017-07-24T19:30:00 ... 201...
    time1              (ping_time) datetime64[ns] dask.array<chunksize=(875,), meta=np.ndarray>
Data variables:
    Sv                 (channel, ping_time, echo_range) float64 dask.array<chunksize=(4, 875, 150), meta=np.ndarray>
    frequency_nominal  (channel) float64 dask.array<chunksize=(4,), meta=np.ndarray>
    longitude          (ping_time) float64 dask.array<chunksize=(875,), meta=np.ndarray>
    latitude           (ping_time) float64 dask.array<chunksize=(875,), meta=np.ndarray>
Attributes:
    processing_software_name:     echopype
    processing_software_version:  0.7.1
    processing_time:              2023-05-30T17:40:45Z
    processing_function:          commongrid.compute_MVBS

Histogram and Table Demonstration in Echogram-Control Mode#

Users have the flexibility to tailor the settings for histograms in the following ways:

  • bins: This parameter allows you to specify the number of bins for the histogram.

  • overlay: By default, this setting is True, enabling the overlay of multiple histograms. However, you can set it to False to arrange multiple histograms vertically.

In the example below, while in echogram-control mode, users can select a specific area on the echogram, and the corresponding histogram and table will be displayed accordingly.

eg = MVBS_ds.eshader.echogram(
        channel = ['GPT  18 kHz 009072058c8d 1-1 ES18-11',],
        cmap = "jet", 
)

hist = MVBS_ds.eshader.hist(
    bins = 20,
    overlay = True,
)

table = MVBS_ds.eshader.table()

panel.Column(eg, hist, table)

There are two control widgets associated with the histogram:

  • bin_size_input: This widget allows you to adjust the histogram bin size using an input field.

  • overlay_layout_toggle: This toggle widget provides an option for an overlay layout setting.

bin_size_input = MVBS_ds.eshader.bin_size_input

overlay_layout_toggle = MVBS_ds.eshader.overlay_layout_toggle

stats_panel = panel.Row(
    panel.Column(
        MVBS_ds.eshader.bin_size_input,
        MVBS_ds.eshader.overlay_layout_toggle,
    ),
    MVBS_ds.eshader.hist(),
)

stats_panel

Histogram and Table Demonstration in Track-Control Mode#

In the example below, while in track-control mode, users can select a specific area on the track map, and the corresponding histogram and table will be displayed accordingly.

control_mode_select = MVBS_ds.eshader.control_mode_select

track = MVBS_ds.eshader.track(
    tile = 'OSM',
    control = False,
)

panel.Column(
    control_mode_select,
    track,
    hist,
)

Applying Plot Customizations#

Similar to customizing echograms, users can input Holoviews options to apply personalized adjustments to the visualizations.

For detailed information about Holoviews options, please refer to this link.