hydrac.instruments.instruments

Instrument (hydrac.instruments.instruments)

class hydrac.instruments.instruments.Instrument[source]

Bases: object

Instrument class for raw data interfacing.

This class is made to handle hydroacoustic (defined in the hydrac.instruments.acoustique.Acoustic) or multiparameters (defined in the hydrac.instruments.physicalparam.PhysicalParam) instruments. The data are contained in the param attribute which is a Modified dictionnary (created with the class hydrac.util.parameters.AttrDict). The hydroacoustic and physical data structures in param are harmonized to facilitate data manipulation.

All the methods of the class are common to all instruments and enable data display through the hydrac.util.display.Display class. It is also possible to export (nc_save_param()) /import back (nc_load()) processed acoustic data in netCDF format.

display_data(self, key, k, **kwargs)[source]

Method returning a default display based on the data dimensions. The figure parameters are saved inside param. A deployment strategy has to be attached to the instrument to avoid ambiguities for diplaying the data

Typical usage with an hydroacoustic object A (hydrac.instruments.acoustique):

# Display the Intensity varaible of the first profile in param and
# save the figure in A.param.P0.d_0
>>>A.display('Intensity',0)
# Adjust the colorbar
>>>A.param.P0.d_0.c_lim(0,1)
Parameters:
key : str, {‘Intensity’, ‘asv’, ‘conc’, …}

Attribute to be displayed.

k : int

Profile number

look_up_keys(self, x, k, ini=None)[source]

Looks throughout the param dictionnary of profile k to find the key x and returns the value h

find_all(self, a_str, sub)[source]

Finds all occurences of str sub in str a_str

nc_save_param(self, file)[source]

Saves HAC data in a netCDF file keeping the param structure. Note that the data have to be inverted before saving them.

Typical usage with an hydroacoustic object A (hydrac.instruments.acoustique):

# Save the current object content in 'file_netcdf.nc'
>>>A.nc_save_param('file_netcdf.nc')
nc_load(self, file)[source]

Load HAC data from a netCDF file generated with nc_save_param() and reshaping the param allowing to the common data structure of hydrac

Typical usage for an hydroacoustic object A (hydrac.instruments.acoustique):

# Create an empty Acoustic object
>>>A=hydrac.instruments.acoustique.Acoustique()
# Load the content of 'file_netcdf.nc' in A
>>>A.nc_load('file_netcdf.nc')

Classes

Instrument() Instrument class for raw data interfacing.