API reference
Contents
API reference¶
API components that most users will interact with.
Attention
In echopype versions prior to 0.5.0, the API in this page focused
on the convert
and process
subpackages. See the
0.4.1 API page
if you’re using a previous release. That workflow is being deprecated.
Content
EchoData class¶
EchoData is an object that handles interfacing raw converted data. It is used for calibration and other processing.
Open raw and converted files¶
- echopype.open_raw(raw_file: Optional[PathHint] = None, sonar_model: Optional[SonarModelsHint] = None, xml_path: Optional[PathHint] = None, convert_params: Optional[Dict[str, str]] = None, storage_options: Optional[Dict[str, str]] = None) Optional[echopype.echodata.echodata.EchoData] ¶
Create an EchoData object containing parsed data from a single raw data file.
The EchoData object can be used for adding metadata and ancillary data as well as to serialize the parsed data to zarr or netcdf.
- Parameters
- raw_filestr
path to raw data file
- sonar_modelstr
model of the sonar instrument
EK60
: Kongsberg Simrad EK60 echosounderES70
: Kongsberg Simrad ES70 echosounderEK80
: Kongsberg Simrad EK80 echosounderEA640
: Kongsberg EA640 echosounderAZFP
: ASL Environmental Sciences AZFP echosounderAD2CP
: Nortek Signature series ADCP (tested with Signature 500 and Signature 1000)
- xml_pathstr
path to XML config file used by AZFP
- convert_paramsdict
parameters (metadata) that may not exist in the raw file and need to be added to the converted file
- storage_optionsdict
options for cloud storage
- Returns
- EchoData object
- echopype.open_converted(converted_raw_path: PathHint, storage_options: Dict[str, str] = None, **kwargs)¶
Create an EchoData object from a single converted netcdf or zarr file.
- Parameters
- converted_raw_pathstr
path to converted data file
- storage_optionsdict
options for cloud storage
- kwargsdict
optional keyword arguments to be passed into xr.open_dataset
- Returns
- EchoData object
Combine EchoData objects¶
- echopype.combine_echodata(echodatas: List[echopype.echodata.echodata.EchoData], combine_attrs='override') echopype.echodata.echodata.EchoData ¶
Combines multiple EchoData objects into a single EchoData object.
- Parameters
- echodatas: List[EchoData]
The list of EchoData objects to be combined.
- combine_attrs: { “override”, “drop”, “identical”, “no_conflicts”, “overwrite_conflicts” }
String indicating how to combine attrs of the EchoData objects being merged. This parameter matches the identically named xarray parameter (see https://xarray.pydata.org/en/latest/generated/xarray.combine_nested.html) with the exception of the “overwrite_conflicts” value.
“override”: Default. skip comparing and copy attrs from the first EchoData object to the result.
“drop”: empty attrs on returned EchoData object.
“identical”: all attrs must be the same on every object.
“no_conflicts”: attrs from all objects are combined, any that have the same name must also have the same value.
“overwrite_conflicts”: attrs from all EchoData objects are combined, attrs with conflicting keys will be overwritten by later EchoData objects.
- Returns
- EchoData
An EchoData object with all of the data from the input EchoData objects combined.
- Raises
- ValueError
If echodatas contains EchoData objects with different or None sonar_model values (i.e., all EchoData objects must have the same non-None sonar_model value).
- ValueError
If EchoData objects have conflicting source file names.
- Warns
- UserWarning
If the sonar_model of the input EchoData objects is “EK60” and any EchoData objects have non-monotonically increasing ping_time, location_time or mru_time values, the corresponding values in the output EchoData object will be increased starting at the timestamp where the reversal occurs such that all values in the output are monotonically increasing. Additionally, the original ping_time, location_time or mru_time values will be stored in the Provenance group, although this behavior may change in future versions.
Warning
Changes in parameters between EchoData objects are not currently checked; however, they may raise an error in future versions.
Notes
EchoData objects are combined by combining their groups individually.
Attributes from all groups before the combination will be stored in the provenance group, although this behavior may change in future versions.
The source_file and converted_raw_path attributes will be copied from the first EchoData object in the given list, but this may change in future versions.
Examples
>>> ed1 = echopype.open_converted("file1.nc") >>> ed2 = echopype.open_converted("file2.zarr") >>> combined = echopype.combine_echodata([ed1, ed2])
Data processing subpackages¶
calibrate¶
Functions¶
|
Compute volume backscattering strength (Sv) from raw data. |
|
Compute point backscattering strength (Sp) from raw data. |
preprocess¶
Functions¶
|
Compute Mean Volume Backscattering Strength (MVBS) based on intervals of range and ping_time specified in physical units. |
|
Compute Mean Volume Backscattering Strength (MVBS) based on intervals of range_bin and ping number specified in index number. |
|
Remove noise by using estimates of background noise from mean calibrated power of a collection of pings. |
qc¶
Functions¶
|
Coerce a time coordinate to always flow forward. |
|
Test for occurrence of time reversal in specified datetime coordinate variable. |
Utilities¶
Utilities for calculating seawater acoustic properties.
Functions¶
|
Calculate sea water absorption in units [dB/m]. |
|
Calculate sound speed in [m/s]. |