OSOceanAcoustics / echopype-checker

Compliance checker for the echopype adaptation of SONAR-netCDF v1
Apache License 2.0
0 stars 1 forks source link

echopype_checker: An echopype SONAR-netCDF4 version 1 convention checker

echopype_checker is a small package developed as a companion to theechopype package for ocean sonar data processing. Its goal is to assess the adherence of an echosounder dataset converted by echopype to the echopype adaptation of the SONAR-netCDF4 version 1 convention.

echopype_checker uses NetCDF "CDL" files as its representations of echopype's adaptation of SONAR-netCDF4 version 1. These CDL files are stored in the echopype_checker/cdls directory; a CDL file may contain one or more groups. Tests are carried out on one SONAR-netCDF4 group at a time. In addition to variable attributes found in datasets converted by echopype, the CDL's contain three special attributes:

echopype_checker checks variables (presence, name, data type, dimensions) and attributes (presence, attribute values).

This code snippet illustrates package usage:

from echopype_checker import ConventionCDL

# Instantatiate the ConventionCDL checker object
# for the Sonar/Beam_group1 group
conv_check = ConventionCDL("Sonar/Beam_group1")

# Attach the corresponding xarray dataset for
# the echopype EchoData object that will be assessed.
# Here, beamgroup1_ds may be based on a dataset
# previously converted using echopype.open_raw
conv_check.set_ed_group_ds(beamgroup1_ds)

# Perform checks only on mandatory ("M") variables
conv_check.set_obligation("M")

# Now run one of the tests: presence of expected variables
conv_check.test_vars_presence()

More complete examples are provided as Jupyter notebooks in the notebooks directory for three echosounder instrument types: AZFP, EK60 and EK80.

The notebooks directory also contains a notebook, checker-objects.ipynb, that illustrates the internal data structures found in the ConventionCDL object. The two data structures are available as object properties:

Installation

echopype_checker can be installed directly from its GitHub repository:

pip install git+https://github.com/OSOceanAcoustics/echopype-checker.git

While it does not require echopype, it will be most useful when installed together with echopype. See the echopype installation instruction.