Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Access NOAA’s SONAR data hosted on AWS via OSDF protocol

Overview

Import package, define parameters and functions

Use OSDF protocol to access data

Set up osdf url to use with PelicanFS

  • We should one of the two pelicanFS FSSpec protocols (‘osdf’ or ‘pelican’) instead of the https protocol.

  • So, the urls will look like: osdf_discovery_url + namespace prefix/aws_region/bucket_name/path to file or object

  • osdf_discovery_url = osdf:///, namespace_prefix = aws-opendata

  • aws_region = us-east-1, bucket_name = ‘noaa-wcsd-zarr-pds’

  • zarr_store = ‘level_2/Bell_M._Shimada/SH1507/EK60/SH1507.zarr’

  • An example url:

  • osdf:///us-east-1/aws-opendata/noaa-wcsd-zarr-pds/evel_2/Bell_M._Shimada/SH1507/EK60/SH1507.zarr

CPU times: user 1.45 ms, sys: 0 ns, total: 1.45 ms
Wall time: 1.48 ms
noaa-wcsd-zarr-pds/level_2/Bell_M._Shimada/SH1507/EK60/SH1507.zarr
CPU times: user 54 μs, sys: 0 ns, total: 54 μs
Wall time: 56 μs
/aws-opendata/us-east-1/noaa-wcsd-zarr-pds/level_2/Bell_M._Shimada/SH1507/EK60/SH1507.zarr
Opening a Zarr store with Xarray

We will open the S3 Zarr store using Xarray (the “consolidated” parameter just defines whether we are interested in reading the metadata in a consolidated manner, “None” is the desired value).

CPU times: user 352 ms, sys: 80.7 ms, total: 433 ms
Wall time: 667 ms
Loading...

Load data and plot echogram

Subsetting on one hour worth of data near an area of interest. We’ll define select_times from 19:00 to 20:00 on July 19th 2015.

We can then use this slice of select_times to select the Sv values for the specific subset of time. Additional subsetting can also be added to the query, for example we can additionally subset by defining a selected frequency. The example below selects 18 kHz for the time interval of interest and store this in Sv_18 (drop=True means that the coordinate labels that do not meet the condition are not just masked but also dropped from the result)

<xarray.DataArray 'Sv' (depth: 2800, time: 2959)> Size: 33MB
dask.array<where, shape=(2800, 2959), dtype=float32, chunksize=(512, 512), chunktype=numpy.ndarray>
Coordinates:
  * depth      (depth) float64 22kB nan 0.25 0.5 0.75 ... 699.5 699.8 700.0
    frequency  float32 4B 3.8e+04
  * time       (time) datetime64[ns] 24kB 2015-07-19T19:08:39.063712768 ... 2...
Attributes:
    long_name:  Volume backscattering strength (Sv re 1 m-1)
    units:      dB
CPU times: user 838 ms, sys: 146 ms, total: 984 ms
Wall time: 1.4 s
<Figure size 640x480 with 2 Axes>

The data in the plot above shows a detected bottom as a ship crosses above a smooth ridge. Beneath the seabed are two harmonics we would like to omit from the plot. We can begin to do that by just plotting data between 0 and 500 meters of depth.

Now when we plot the data it is subsetted to less than 500 meters of depth.

CPU times: user 607 ms, sys: 48.9 ms, total: 656 ms
Wall time: 816 ms
<Figure size 640x480 with 2 Axes>

We can also select the corresponding data for 120 and 200 kHz and store them in seperate variables

For comparison, let’s see the 120 kHz echogram with the same depth bounds.

CPU times: user 587 ms, sys: 68.2 ms, total: 656 ms
Wall time: 775 ms
<Figure size 640x480 with 2 Axes>