EchoData
EchoData¶
- class echopype.echodata.EchoData(converted_raw_path: Optional[PathHint] = None, storage_options: Dict[str, str] = None, source_file: Optional[PathHint] = None, xml_path: PathHint = None, sonar_model: SonarModelsHint = None, open_kwargs: Dict[str, str] = None)¶
Bases:
object
Echo data model class for handling raw converted data, including multiple files associated with the same data set.
- Attributes
- nc_path
- zarr_path
Methods
compute_range
([env_params, azfp_cal_type, ...])Computes the range of the data contained in this EchoData object, in meters.
to_netcdf
([save_path])Save content of EchoData to netCDF.
to_zarr
([save_path])Save content of EchoData to zarr.
update_platform
(extra_platform_data[, ...])Updates the EchoData.platform group with additional external platform data.
raw2nc
raw2zarr
Attributes Summary
Methods Summary
compute_range
([env_params, azfp_cal_type, ...])Computes the range of the data contained in this EchoData object, in meters.
raw2nc
([save_path, combine_opt, overwrite, ...])raw2zarr
([save_path, combine_opt, ...])to_netcdf
([save_path])Save content of EchoData to netCDF.
to_zarr
([save_path])Save content of EchoData to zarr.
update_platform
(extra_platform_data[, ...])Updates the EchoData.platform group with additional external platform data.
Attributes Documentation
- group_map = {'beam': {'description': 'contains backscatter data and other beam or channel-specific data.', 'ep_group': 'Beam', 'name': 'Beam'}, 'beam_power': {'description': 'contains backscatter data (power-only) and other beam or channel-specific data.', 'ep_group': 'Beam_power', 'name': 'Beam Power'}, 'environment': {'description': 'contains information relevant to acoustic propagation through water.', 'ep_group': 'Environment', 'name': 'Environment'}, 'nmea': {'description': 'contains information specific to the NMEA protocol.', 'ep_group': 'Platform/NMEA', 'name': 'Platform/NMEA'}, 'platform': {'description': 'contains information about the platform on which the sonar is installed.', 'ep_group': 'Platform', 'name': 'Platform'}, 'provenance': {'description': 'contains metadata about how the SONAR-netCDF4 version of the data were obtained.', 'ep_group': 'Provenance', 'name': 'Provenance'}, 'sonar': {'description': 'contains specific metadata for the sonar system.', 'ep_group': 'Sonar', 'name': 'Sonar'}, 'top': {'description': 'contains metadata about the SONAR-netCDF4 file format.', 'ep_group': None, 'name': 'Top-level'}, 'vendor': {'description': 'contains vendor-specific information about the sonar and the data.', 'ep_group': 'Vendor', 'name': 'Vendor specific'}}¶
- nc_path¶
- zarr_path¶
Methods Documentation
- compute_range(env_params=None, azfp_cal_type=None, ek_waveform_mode=None, ek_encode_mode='complex')¶
Computes the range of the data contained in this EchoData object, in meters.
Currently this operation is supported for the following
sonar_model
: EK60, AZFP, EK80 (see Notes below for detail).- Parameters
- env_paramsdict
Environmental parameters needed for computing sonar range. Users can supply “sound speed” directly, or specify other variables that can be used to compute them, including “temperature”, “salinity”, and “pressure”.
For EK60 and EK80 echosounders, by default echopype uses environmental variables stored in the data files. For AZFP echosounder, all environmental parameters need to be supplied. AZFP echosounders typically are equipped with an internal temperature sensor, and some are equipped with a pressure sensor, but automatically using these pressure data is not currently supported.
- azfp_cal_type{“Sv”, “Sp”}, optional
“Sv” for calculating volume backscattering strength
“Sp” for calculating point backscattering strength.
This parameter needs to be specified for data from the AZFP echosounder, due to a difference in computing range for Sv and Sp.
- ek_waveform_mode{“CW”, “BB”}, optional
Type of transmit waveform. Required only for data from the EK80 echosounder.
“CW” for narrowband transmission, returned echoes recorded either as complex or power/angle samples
“BB” for broadband transmission, returned echoes recorded as complex samples
- ek_encode_mode{“complex”, “power”}, optional
Type of encoded return echo data. Required only for data from the EK80 echosounder.
“complex” for complex samples
“power” for power/angle samples, only allowed when the echosounder is configured for narrowband transmission
- Returns
- xr.DataArray
The range of the data in meters.
- Raises
- ValueError
When sonar_model is “AZFP” but azfp_cal_type is not specified or is None.
When sonar_model is “EK80” but ek_waveform_mode is not specified or is None.
When sonar_model is “EK60” but waveform_mode is “BB”
When sonar_model is “AZFP” and env_params does not contain either “sound_speed” or all of “temperature”, “salinity”, and “pressure”.
When sonar_model is “EK60” or “EK80”, EchoData.environment.sound_speed_indicative does not exist, and env_params does not contain either “sound_speed” or all of “temperature”, “salinity”, and “pressure”.
When sonar_model is not “AZFP”, “EK60”, or “EK80”.
Notes
The EK80 echosounder can be configured to transmit either broadband (
waveform_mode="BB"
) or narrowband (waveform_mode="CW"
) signals. When transmitting in broadband mode, the returned echoes are encoded as complex samples (encode_mode="complex"
). When transmitting in narrowband mode, the returned echoes can be encoded either as complex samples (encode_mode="complex"
) or as power/angle combinations (encode_mode="power"
) in a format similar to those recorded by EK60 echosounders.For AZFP echosounder, the returned range is duplicated along ping_time to conform with outputs from other echosounders, even though within each data file the range is held constant.
- raw2nc(save_path: PathHint = None, combine_opt: bool = False, overwrite: bool = False, compress: bool = True)¶
- raw2zarr(save_path: PathHint = None, combine_opt: bool = False, overwrite: bool = False, compress: bool = True)¶
- to_netcdf(save_path: Optional[PathHint] = None, **kwargs)¶
Save content of EchoData to netCDF.
- Parameters
- save_pathstr
path that converted .nc file will be saved
- compressbool
whether or not to perform compression on data variables Defaults to
True
- overwritebool
whether or not to overwrite existing files Defaults to
False
- parallelbool
whether or not to use parallel processing. (Not yet implemented)
- output_storage_optionsdict
Additional keywords to pass to the filesystem class.
- to_zarr(save_path: Optional[PathHint] = None, **kwargs)¶
Save content of EchoData to zarr.
- Parameters
- save_pathstr
path that converted .nc file will be saved
- compressbool
whether or not to perform compression on data variables Defaults to
True
- overwritebool
whether or not to overwrite existing files Defaults to
False
- parallelbool
whether or not to use parallel processing. (Not yet implemented)
- output_storage_optionsdict
Additional keywords to pass to the filesystem class.
- update_platform(extra_platform_data: xarray.core.dataset.Dataset, time_dim='time', extra_platform_data_file_name=None)¶
Updates the EchoData.platform group with additional external platform data.
extra_platform_data must be an xarray Dataset. The name of the time dimension in extra_platform_data is specified by the time_dim parameter. Data is extracted from extra_platform_data by variable name; only the data in extra_platform_data with the following variable names will be used:
“pitch”
“roll”
“heave”
“latitude”
“longitude”
“water_level”
The data inserted into the Platform group will be indexed by a dimension named “location_time”.
- Parameters
- extra_platform_dataxr.Dataset
An xr.Dataset containing the additional platform data to be added to the EchoData.platform group.
- time_dim: str, default=”time”
The name of the time dimension in extra_platform_data; used for extracting data from extra_platform_data.
- extra_platform_data_file_name: str, default=None
File name for source of extra platform data, if read from a file
Examples
>>> ed = echopype.open_raw(raw_file, "EK60") >>> extra_platform_data = xr.open_dataset(extra_platform_data_file) >>> ed.update_platform(extra_platform_data, >>> extra_platform_data_file_name=extra_platform_data_file)