adcpreader package
Submodules
adcpreader.coroutine module
- class adcpreader.coroutine.Coroutine
Bases:
object- close_coroutine()
- disable()
- send(x)
- send_to(*targets)
- adcpreader.coroutine.coroutine(func)
adcpreader.rdi_backscatter module
- class adcpreader.rdi_backscatter.AcousticAbsorption
Bases:
objectacousctic absorption according to http://resource.npl.co.uk/acoustics/techguides/seaabsorption/physics.html
- alpha(f, T, S, z, pH=7)
- class adcpreader.rdi_backscatter.AcousticCrossSection(S=None, k_t=1e-08, N_t=45, db_per_count=[0.61, 0.61, 0.61, 0.61])
Bases:
CoroutineA class which adds the acoustic cross section area to the ensemble.
A new section ‘sigma’ is created with the variabels Sigma1..4, and Sigma_AVG.
db_per_count: about 0.61 for DVL Explorer (see manual)
- add_acoustic_cross_section(ens, config)
- compute_sigma(echo_intensity, T, S, db_per_count, config)
- coro_add_acoustic_cross_section(**kwargs)
- get_config(ens)
adcpreader.rdi_corrections module
- class adcpreader.rdi_corrections.AdvanceExternalDataInput(n_samples_to_advance)
Bases:
CoroutineClass to advance external data (attitude and depth readings) by a given number of ensembles
- advance_ensembles(**kwargs)
- class adcpreader.rdi_corrections.Aggregator(aggregate_size)
Bases:
CoroutineEnsemble aggregator
Aggregates a number of ensembles into one.
- Parameters:
aggregate_size (int) – number of ensembles to aggregate.
The aggregated ensemble contains the average of the following variables:
Roll Pitch Heading Soundspeed Salin Temp Press Time Timestamp
Velocity1 Velocity2 Velocity3 Velocity4
Echo1 Echo2 Echo3 Echo4
BTVel1 BTVel2 BTVel3 BTVel4
- AVG_PARAMETERS = ['Roll', 'Pitch', 'Heading', 'Soundspeed', 'Salin', 'Temp', 'Press', 'Time', 'Timestamp', 'Velocity1', 'Velocity2', 'Velocity3', 'Velocity4', 'Echo1', 'Echo2', 'Echo3', 'Echo4', 'BTVel1', 'BTVel2', 'BTVel3', 'BTVel4']
- aggregate(collection)
- coro_aggregate(**kwargs)
- class adcpreader.rdi_corrections.AttitudeCorrection
Bases:
Coroutine- attitude_correction(heading, pitch, roll)
- coro_attitude_correction(**kwargs)
- class adcpreader.rdi_corrections.AttitudeCorrectionLinear(a, b)
Bases:
AttitudeCorrection- attitude_correction(heading, pitch, roll)
- class adcpreader.rdi_corrections.AttitudeCorrectionTiltCorrection(tilt_correction_factor, pitch_offset=0, roll_offset=0, method='rotation')
Bases:
AttitudeCorrectionCorrects the attitude, given a scaling factor and a offset.
- Parameters:
tilt_correction_factor (float) – factor to multiply pitch and roll with
pitch_offset (float) – offset in pitch (rad)
method (string) – which method to use to correct
- Two methods are available:
- method == ‘simple’:
simply scale pitch and roll and correct for offset heading: unaltered
- method == ‘rotation’:
using rotation matrices to compute the heading when applying the corrections in pitch and roll.
- attitude_correction(heading, pitch, roll)
- class adcpreader.rdi_corrections.BinMapping(pitch_mount_angle=0, roll_mount_angle=0)
Bases:
CoroutineClass to apply bin mapping
- Parameters:
pitch_mounting_angle (float) – mounting angle for pitch
roll_mounting_angle (float) – mounting angle for roll
- coro_map_bins(**kwargs)
- get_configuration(ens, pitch_offset, roll_offset)
- map_bins(ens, config)
Map bins
- Parameters:
ens (dictionary) – ensemble dictionary
config (tuple) – configuration and one-off calculations done from the info in the first ens.
Modifies the velocity section only, and remaps velocity readings when necessary.
- class adcpreader.rdi_corrections.CorrectDepthRange(pitch_mount_angle, XdcrDepth_scale_factor=10, qH=1e-08, rH=0.04000000000000001)
Bases:
CoroutineCorrect Range measurements for pitch and roll
- coro_correct_range(**kwargs)
- correct_ensemble(ens)
check ensemble for passing/nonpassing of velocity profile data
- Parameters:
ens (dictionary) – ensemble dictionary
- Return type:
True
The strategy followed here in is the following. The DVL records the distance to the seabed as seen by each of its four beams. Sometimes velotity readings are registered that seem to come from within the seabed due to reflections I suppose. We compute the distance from the transducer for the beam that has observed the smallest range, as this one, and all the others will contaminate the velocity reading. This cell and all further cells are masked.
It may be that when this applies the current ensemble has no informtion on bottom range. To fill in these data, a Kalman filter is used. I am not entirely sure whether this is really necessary. The upshot is that we get an estiamte of the water depth, which is written to the bottom_track section, as variable ‘WaterDepth’.
- get_fixed_leader_data(ens)
- class adcpreader.rdi_corrections.CurrentCorrectionFromSalinity(SA, RTC_year_base=2000)
Bases:
SpeedOfSoundCorrection- coro_current_correction(**kwargs)
- class adcpreader.rdi_corrections.CurrentCorrectionFromSalinityPressure(t, SA, P, RTC_year_base=2000)
Bases:
SpeedOfSoundCorrection- coro_current_correction(**kwargs)
- class adcpreader.rdi_corrections.DepthCorrection(t, depth, RTC_year_base=2000)
Bases:
Coroutine- coro_add_depth(**kwargs)
- class adcpreader.rdi_corrections.HorizontalCurrentCorrectionFromSalinityPressure(t, SA, P, RTC_year_base=2000)
Bases:
SpeedOfSoundCorrection- coro_current_correction(**kwargs)
- class adcpreader.rdi_corrections.KalmanFilter(qH, rH)
Bases:
objectA Kalman filter implementation to estimate the water depth.
The measurement: waterdepth = depth of DVL/ADCP + range till bottom
- initial_step(Hp)
- update(t, Hp)
Updates Kalman filter
- Parameters:
t (float) – time in seconds
H (float) – measured water_depth (from ADCP to the sea bed + depth reading)
- Returns:
x_post (array of floats) – posterior estimate of the state vector (water_depth, water_depth_rate)
P_post (2x2 array of floats) – posterior covariance matrix
- class adcpreader.rdi_corrections.ScaleEchoIntensities(factor_beam1=1.0, factor_beam2=1.0, factor_beam3=1.0, factor_beam4=1.0)
Bases:
CoroutineClass to scale the echo intensities.
- Parameters:
factor_beam1 (float) – factor to correct the EI for beam1
factor_beam2 (float) – factor to correct the EI for beam2
factor_beam3 (float) – factor to correct the EI for beam3
factor_beam4 (float) – factor to correct the EI for beam4
- coro_scale_echos(**kwargs)
- class adcpreader.rdi_corrections.SpeedOfSoundCorrection(RTC_year_base=2000)
Bases:
Coroutine- V3D = {'bottom_track': ['BTVel1', 'BTVel2', 'BTVel3'], 'velocity': ['Velocity1', 'Velocity2', 'Velocity3']}
- Vhor = {'bottom_track': ['BTVel1', 'BTVel2'], 'velocity': ['Velocity1', 'Velocity2']}
- get_ensemble_timestamp(ens)
returns timestamp in UTC in unix time (s)
adcpreader.rdi_datafuse module
- class adcpreader.rdi_datafuse.DataFuser(*channels)
Bases:
CoroutineData fuser class
- Parameters:
Channels (positional parameters containing the section name into which the dictionaries pertaining to)
written. (each input channel should be)
It makes only sense to use this class if two or more components of the data pipeline structure push data into this object. The data from the first source is assumed to be the ensemble dictionary, which is to be fused with data from other sources.
____________ | | | pd0 reader | | | ------------ | | | +---------------------+ | | +---------+ _____V______ | | | | | NDF reader | | | | ensemble dict| ------------ | | | | | +----------+ glider flight dictionary _____V__V___ | | | data fuser | | | ------------ | | V ensemble dict with added glider flight dictIn this schematic, ensembles are pushed into the system by pd0 reader, and fed into datafuser and NDF reader. NDF reader uses its time stamp to find the correct data points from the ndf file, and sends this information as a dictionary to data fuser.
Data fuser receives from two streams, first the original ensemble, and then added data. Data fuser then outputs the ensemble dictionary with the other data dictionary inserted.
If the name of the channel exists, the data are added to the already existing section dictionary, otherwise a new section is created. For example, the glider flight data can be inserted as a new section “glider_flight”, or the data could be added to an existing section, such as “variable_leader”.
- coro_read_data(**kwargs)
- merge(ens, data, channel)
Merges data per channel into ens
- Parameters:
ens (dictionary) – ensemble dictionary
data (a dictionary from a channel)
channel (string) – name of section where the data should be inserted into
key (If ensemble already has the channel name as)
the (the dictionary is added to)
section (exisiting)
created. (otherwise a new section is)
adcpreader.rdi_qc module
- class adcpreader.rdi_qc.AcousticAmplitudeLimit(amplitude_limit=75)
Bases:
QualityControlAcoustic Amplitude Limit
Masks bins where the amplitude less than a given threshold.
- Parameters:
amplitude_limit (float) – minimum required amplitude. (default 75)
note:: (..) – This limiter never drops an ensemble.
- check_ensemble(ens)
- class adcpreader.rdi_qc.Counter(verbose=False)
Bases:
CoroutineAn ensemble counter class.
This class merely counts the number of ensembles that pass through the pipeline at this stage. This implies that no ensemble is modified.
- Parameters:
verbose (bool) – Sets whether the sequential number of the processed ensemble is to be printed. (default False)
The number of ensembles counted are stored in the property counts.
An instance of this class can be placed at more than one position within the pipeline. The counts property is a list that reflects the positions where the counter is placed.
- coro_counter(**kwargs)
- class adcpreader.rdi_qc.MaskBins(masked_bins=[])
Bases:
QualityControlMask bins
This operation masks all specified bins.
- Parameters:
masked_bins (list of integers) – list of bin numbers that are to be masked. Starts with 0 for the first bin. (default [])
- check_ensemble(ens)
- class adcpreader.rdi_qc.QualityControl(drop_masked_ensembles=None)
Bases:
CoroutineQuality Control base class
Implements conditions to make arrays masked arrays,
scalars that don’t pass the condition are set to nan.
- apply_condition(condition, v)
- check_ensemble(ens)
check an ensemble. Should be subclassed.
- coro_check_ensembles(**kwargs)
- discard_abs_greater(v, value)
discard values v that are absolute greater than value
- discard_abs_greater_equal(v, value)
discard values v that are absolute greater or equal than value
- discard_abs_less(v, value)
discard values v that are absolute less than value
- discard_abs_less_equal(v, value)
discard values v that are absolute less or equal than value
- discard_greater(v, value)
discard values v that are greater than value
- discard_greater_equal(v, value)
discard values v that are greater or equal than value
- discard_less(v, value)
discard values v that are less than value
- discard_less_equal(v, value)
discard values v that are less or equal than value
- class adcpreader.rdi_qc.SNRLimit(SNR_limit=10, noise_floor_db=26.1, use_AVG=False)
Bases:
QualityControlSignal to Noise Ratio limit
Masks or drops ensembles for which the SNR fails to exceed the threshold
- Parameters:
SNR_limit (float) – SNR threshold (default 10)
noise_floor_db (float) – noise floor in dB (default 26.1)
The SNR is calculated according to
\[SNR = 10^{(E-E0)/10}\]where \(E\) is the echo intensity in dB, and \(E0\) the noise floor.
Adds the following entries to the ensemble
ens[“echo”][“SNR{1,2,3,4}” containing a vector of the SNR.
- SNR(echointensity)
- check_ensemble(ens)
- class adcpreader.rdi_qc.ValueLimit(drop_masked_ensembles=None)
Bases:
QualityControlQualtiy Control class to mask values that are exceeding some limit.
- SCALARS = ['bottom_track']
- VECTORS = ['velocity', 'correlation', 'echo', 'percent_good']
- check_ensemble(ens)
check an ensemble. Should be subclassed.
- mask_parameter(section, parameter, operator, value, dependent_parameters={})
Set a condition to discard readings.
- Parameters:
section (string) – section name of the data block. Example: velocity
parameter (string) – name of parameter in this section. Example Velocity1
operator (string) – comparison operator. Example: “>” or “||>”
value (float) – the value to compare with.
dependent_parameters (dict) – If not empty, the mask condition is also applied to the “dependent parameters”.
Example
- mask_parameter(“velocity”, “Velocity1”, “||>”, 0.1,
dependent_parameters=dict(bottom_track=[“BTVel1”, “BTVel2”]))
Table of implemented operators:
>
greater than
>=
greater equal than
<
smaller than
<=
smaller equal than
||>
absolute greater than
||>=
absolute greater equal than
||<
absolute smaller than
||<=
absolute smaller equal than
- mask_parameter_regex(section, parameter_regex, operator, value, boolean='OR')
adcpreader.rdi_reader module
- class adcpreader.rdi_reader.Ensemble(bin_data, data_offsets=())
Bases:
objectclass to hold and decode a binary data block containing a single ping.
typical use:
ens = Ensemble(bin_data) ens.decode()
The constructor can take the data_offsets dictionary. If given, the offsets are not read from the binary data block, but assumed to be known.
- property current_position
returns current position of read pointer
- decode()
Method to decode a byte string.
returns a dictionary with all the data decoded.
- decode_bottom_track(n_beams)
- decode_correlation(n_cells, n_beams)
Decodes correlations block. Returns a dictionary with values.
- decode_echo(n_cells, n_beams)
Decodes echo block. Returns a dictionary with values.
- decode_environmental_command_parameters()
- decode_fixed_leader()
Decodes fixed leader good block. Returns a dictionary with values.
- decode_percent_good(n_cells, n_beams)
Decodes percent good block. Returns a dictionary with values.
- decode_variable_leader()
decodes variable leader. Returns dictionary with values.
- decode_velocity(n_cells, n_beams)
Decodes velocity block. Returns a dictionary with values.
- get(dtype, idx=None, n=1)
helper function, not to be called directly.
- get_byte(idx=None, n=1)
helper function to read a byte. if idx is given, it will be read from this position else the field following the last read is used. if n is given, then this number of words will be read.
- get_data_offsets()
Returns a list of data offsets.
- get_or_strings_from_byte(b, s)
method to convert a bit field value into human readbable information, as stored in the global constant dictionary HRI where each bit adds a valid option (as in x = V1 | V2 | V3 etc).
- get_short(idx=None, n=1)
helper function to read a short (2 bytes). if idx is given, it will be read from this position else the field following the last read is used. if n is given, then this number of words will be read.
- get_string_from_byte(b, s)
method to convert a bit field value into human readbable information, as stored in the global constant dictionary HRI
- get_uint(idx=None, n=1)
helper function to read a unsigned integer (4 bytes). if idx is given, it will be read from this position else the field following the last read is used. if n is given, then this number of words will be read.
- get_word(idx=None, n=1)
helper function to read a word (2 bytes). if idx is given, it will be read from this position else the field following the last read is used. if n is given, then this number of words will be read.
- class adcpreader.rdi_reader.PD0(add_unix_timestamp=True, add_filename=True, baseyear=2000)
Bases:
Coroutine- BUFFER_SIZE = 524288
Class to process one or multiple PD0 files.
- Parameters:
add_unix_timestamp (bool) – if True, adds Timestamp field to variable_leader containing time as unix time.
- crc_check(data, idx, checksum_offset, checksum)
- ensemble_generator(f)
Generator returning ensembles for a filename or list of filenames.
- Parameters:
f (filename or list) – filename or list of file names
- Return type:
decoded ensemble generator
- ensemble_generator_per_file(filename, fd_offset=None)
Generator returning ensembles for a single filename.
- Parameters:
filename (string) – string representing filename
fd_offset (byte) –
offset from where the first data should be read from. Positive values: so many bytes from the beginning of the file Negative values: so many bytes from the end of the file.
Default: None (no offset applied)
- Return type:
decoded ensemble
- get_word(data, idx)
- process(f, close_coroutines_at_exit=True)
Process filename or list of filenames, driving the pipeline
- Parameters:
f (filename or list) – filename or list of file names
close_coroutines_at_exit (boolean) – if True, the coroutines will be sent a close command, causeing the coroutines to finish. They cannot be reused after this command.
- read_data_as_needed(fd, data, requested_size, buffer_size)
read as much data from file descriptor as needed.
This method is a helper method and should not be called directly.
- Parameters:
fd (file descriptor) – file descriptor of opened file
data (byte string) – data already read
requested_size (int) – number representing how long data must be
buffer_size (int) – how many bytes should be read at once.
- Returns:
data (byte string of data read (equal to input data, or extened if necessary))
is_fd_consumed (bool flagging if the file has been read totally)
- adcpreader.rdi_reader.RTC_to_unixtime(rtc_tuple, baseyear=2000)
- adcpreader.rdi_reader.get_ensemble_time(ensemble, baseyear=2000)
Convenience function to get the time of this ping in seconds.
- Parameters:
ensemble (dictionary) – decoded ensemble (dictionary)
baseyear (int) – (2000) the rtc field only contains the year in xx format, so that 1900 or 2000 needs to be added to know in what century the data were collected.
- adcpreader.rdi_reader.get_info(filename)
Get start/end end size information of a PD0 file
- Parameters:
filename (string) – filename or path pointing to PD0 file
- Returns:
time_start (float) – time of first ensemble
time_end (float) – time of last ensemble
number_of_ensembles (int) – number of ensembles present in this file.
- adcpreader.rdi_reader.make_pipeline(*processes)
- adcpreader.rdi_reader.unixtime_to_RTC(timestamp, baseyear=2000)
adcpreader.rdi_transforms module
A module to perform rotation transformations on
velocity vectors 1-4
bottom_track values
per ensemble
Typical use is to set up an ensemble generator and a pipeline of transformations
Examples
>>> bindata = pd0.PD0()
>>> ensembles = bindata.ensemble_generator(filenames)
>>> t1 = TransformENU_SFU()
>>> t2 = TransformSFU_XYZ(hdg=0, pitch=0.1919, roll=0)
>>> t3 = TransformXYZ_SFU(hdg=0, pitch=0.2239, roll=0.05)
>>> t4 = t3*t2*t1
>>> ensembles = t4(ensembles)
>>> for ens in ensembles :
>>> print(ens)
- class adcpreader.rdi_transforms.Altitude
Bases:
CoroutineA class to convert range measurements to distance to the sea bed (altitude).
- Parameters:
mount_hdg (float (0.0)) – angle at which the instrument is mounted, as offset for heading angle (rad)
mount_pitch (float (0.0)) – angle at which this instrument is mounted, as offset for the pitch angle (rad)
roll (mount) – angle at which the instrument is mounted, as offset for the roll angle (rad)
radians. (The angles are given in)
Notes
For the glider, the mount angle for heading is 0, for pitch 11 degrees, and for the roll it depends on how the glider is assembled. This offset angle can be found if i) bottom track is available ii) the sea bed can be assumed reasonably flat
Then, for the correct roll offset, the four ranges should collapse onto one curve.
- CACHE = {}
- PARAMS = {'bottom_track': ['Range']}
- coro_transform_ensembles(**kwargs)
- get_beam_configuration(ens)
Gets the configuration of the beam settings.
- Parameters:
ens (
rdi_reader.Ensemble) – Ensemble dictionary- Returns:
floatbeam angle theta (rad), beam_pattern (convex/concave), facing (up/down), number of beams
- Return type:
tuple of (float, str, str, int)
- get_beam_vectors(ens)
Get the measured ranges as vectors
- Parameters:
ens (
rdi_reader.Ensemble) – Ensemble dictionary- Returns:
the range measurements as vectors represented in the device’s coordinate system (xyz)
- Return type:
np.array (4,4)
Notes
It seems that the range measurements are expressed as their projected values onto the system’s z coordinate. In order to obtain the correct ranges along the acoustic beams, the scaling has to be reversed (by the division of cos(theta)).
- transform_range_in_ensemble(ens)
Transforms the bottom_track_range fields in each ensemble.
- Parameters:
ens (
rdi_reader.Ensemble) – Ensemble dictionary
- class adcpreader.rdi_transforms.Attitude(hdg, pitch, roll)
Bases:
tuple- hdg
Alias for field number 0
- pitch
Alias for field number 1
- roll
Alias for field number 2
- class adcpreader.rdi_transforms.Beamconfig(a, b, c, d, facing)
Bases:
tuple- a
Alias for field number 0
- b
Alias for field number 1
- c
Alias for field number 2
- d
Alias for field number 3
- facing
Alias for field number 4
- class adcpreader.rdi_transforms.RotationMatrix
Bases:
objectA rotation matrix class as defined in the RDI manual
- create_matrix(heading, pitch, roll)
- class adcpreader.rdi_transforms.Transform(inverse=False)
Bases:
CoroutineBase transform class.
Implements the transformations and multiplication, but not the definition of the rotation matrix.
This class should be subclassed.
- CACHE = {}
- PARAMS = {'bottom_track': ['BTVel'], 'velocity': ['Velocity']}
- coro_transform_ensembles(**kwargs)
- get_beam_configuration(ens)
- get_params(ens)
- post_modify_ensemble(ens)
- set_coordinate_systems(old_coordinate_system, new_coordinate_system, inverse=False)
- transform_velocities_in_ensemble(ens)
Transforms the velocities in given ensemble.
- update_coordinate_frame_setting(ens)
Writes the new coordinate frame setting and records the original setting.
- class adcpreader.rdi_transforms.TransformBEAM_XYZ(inverse=False, use_beam_solution=0)
Bases:
Transform- create_transformation_matrix(attitude, beamconfig)
- post_modify_ensemble(ens)
- class adcpreader.rdi_transforms.TransformENU_SFU(inverse=False)
Bases:
TransformSFU_ENUTransformation of ENU to SFU using the angles set to transform from SFU to ENU
- class adcpreader.rdi_transforms.TransformENU_XYZ(inverse=False)
Bases:
TransformXYZ_ENUTransformation of ENU to XYZ using the angles set to transform from XYZ to ENU
- class adcpreader.rdi_transforms.TransformMatrix(use_beam_solution=0)
Bases:
object- create_matrix(a, b, c, d)
- class adcpreader.rdi_transforms.TransformRotation(hdg, pitch, roll, new_coordinate_system=None)
Bases:
Transform- create_transformation_matrix(*p)
- class adcpreader.rdi_transforms.TransformSFU_ENU(inverse=False)
Bases:
Transform- create_transformation_matrix(attitude, beamconfig)
- class adcpreader.rdi_transforms.TransformSFU_XYZ(hdg, pitch, roll, inverse=False)
Bases:
TransformXYZ_SFUTransformation of SFU to XYZ using the angles set to transform from XYZ to SFU
- class adcpreader.rdi_transforms.TransformXYZ_BEAM(inverse=False)
Bases:
TransformBEAM_XYZTransformation of XYZ to BEAM using the values set to transform from BEAM to XYZ
adcpreader.rdi_writer module
- class adcpreader.rdi_writer.AddFixedLeaderParameter(parameter, value)
Bases:
Coroutine- coro_add(**kwargs)
- class adcpreader.rdi_writer.AsciiWriter(output_file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, adcp_offset=0, has_bottom_track=True)
Bases:
Writer- DESCRIPTIONS = {'Beam': ['Beam 1', 'Beam 2', 'Beam 3', 'Beam 4'], 'Earth': ['Eastward current', 'Northward current', 'Upward current', 'Error velocity'], 'Instrument': ['Current in x direction', 'Current in y direction', 'Current in z direction', 'error velocity'], 'Ship': ['Starboard current', 'Forward current', 'Upward current', 'Error velocity']}
- write_array(config, data1d, data2d, fd=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)
- write_configuration(config, fd=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)
- write_header(config, fd=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)
- class adcpreader.rdi_writer.DataStructure(has_bottom_track=True)
Bases:
WriterSimple in memory data structure
- keys()
- write_array(config, scalar_data, vector_data, fd)
- write_configuration(config, fd)
- write_header(config, fd)
- class adcpreader.rdi_writer.NetCDFWriter(output_file=None, ensemble_size_limit=None, has_bottom_track=True)
Bases:
Writer- VARIABLES = {'bottom_track': {'BTVel1': ('f4', 'onedim', 'm/s'), 'BTVel2': ('f4', 'onedim', 'm/s'), 'BTVel3': ('f4', 'onedim', 'm/s'), 'BTVel4': ('f4', 'onedim', 'm/s'), 'Range1': ('f4', 'onedim', 'm'), 'Range2': ('f4', 'onedim', 'm'), 'Range3': ('f4', 'onedim', 'm'), 'Range4': ('f4', 'onedim', 'm')}, 'correlation': {'Corr1': ('f4', 'twodim', 'counts'), 'Corr2': ('f4', 'twodim', 'counts'), 'Corr3': ('f4', 'twodim', 'counts'), 'Corr4': ('f4', 'twodim', 'counts'), 'Corr_AVG': ('f4', 'twodim', 'counts')}, 'echo': {'Echo1': ('f4', 'twodim', 'dB'), 'Echo2': ('f4', 'twodim', 'dB'), 'Echo3': ('f4', 'twodim', 'dB'), 'Echo4': ('f4', 'twodim', 'dB'), 'Echo_AVG': ('f4', 'twodim', 'dB')}, 'fixed_leader': {'Blank': ('f4', 'scalar', 'm'), 'FirstBin': ('f4', 'scalar', 'm'), 'N_Cells': ('u1', 'scalar', '-'), 'N_PingsPerENS': ('u1', 'scalar', '-')}, 'variable_leader': {'Ensnum': ('i8', 'onedim', '-'), 'Heading': ('f4', 'onedim', 'deg'), 'Pitch': ('f4', 'onedim', 'deg'), 'Press': ('f4', 'onedim', 'bar'), 'Roll': ('f4', 'onedim', 'deg'), 'Salin': ('f4', 'onedim', 'SA'), 'Soundspeed': ('f4', 'onedim', 'm/s'), 'Temp': ('f4', 'onedim', 'Celcius'), 'Time': ('f8', 'onedim', 's')}, 'velocity': {'Velocity1': ('f4', 'twodim', 'm/s'), 'Velocity2': ('f4', 'twodim', 'm/s'), 'Velocity3': ('f4', 'twodim', 'm/s'), 'Velocity4': ('f4', 'twodim', 'm/s')}}
- add_custom_parameter(name, fmt='f4', dtype='scalar', unit='')
Add parameter to the list of parameters to be written to file.
Overloaded method.
- Parameters:
name (str) – name of parameter
fmt (str {'f4', 'f8', 'u1'}, default 'f4') – numeric format of parameter, (float, double, int)
dtype (str {'scalar', 'onedim', 'twodim'}, default 'scalar') – data type
unit (str default '') – unit of parameter
- add_ensemble(ens, variables)
- close()
Close current open file
- coro_write_ensembles(**kwargs)
- create_dimensions(n_bins)
- create_variables(ens)
- enter()
- exit(type, value, tb)
- initialise(ens)
- open()
- class adcpreader.rdi_writer.Writer(has_bottom_track=True)
Bases:
Coroutine- YEAR = 2000
- add_custom_parameter(section, *name, dtype=None)
Mark a non-standard parameter as one that should be written to file.
- Parameters:
section (string) – name of the section the parameter lives in (key of ensemble dictionary)
*name (variable list of arguments of parameters within this section)
dtype (string) – specifies the data type (scalar or vector)
- add_parameter_list(section, *p)
Add parameters from a section to the parameter list
- Parameters:
section (string) – name of section. The section “fixed_leader” has datatype “config”, the sections “variable_leader” and “bottom_track” are of dataype scalar, and all others are vectors.
- array1d_from_list(v)
return list v as an array or masked_array, depening on whether v has any nan’s
- array2d_from_list(v)
return list v as an array or masked_array, depening on wheterh v is masked or not
- clear_parameter_list(dtype=None)
Clear a parameter list
- Parameters:
dtype (string) – datatype (config, scalar or vector)
parameters (Clears all)
vectors (or only scalar or)
- coro_write_ensembles(**kwargs)
- is_masked_array(v)
Checks whether v is a masked array
- Parameters:
v (array-like)
- Returns:
ma – True is v is masked_array. False otherwise
- Return type:
boolean
- read_scalar_data(data, ens)
Reads scalar data from ensemble ens and stores it in data
- Parameters:
data (dictionary) – data dictionary
ens (dictionary) – ensemble dictionary
- read_vector_data(data, ens)
Reads vector data from ensemble ens and stores it in data
- Parameters:
data (dictionary) – data dictionary
ens (dictionary) – ensemble dictionary
- write_array(config, scalar_data, vector_data, fd)
- write_configuration(config, fd)
- write_header(config, fd)
- adcpreader.rdi_writer.rad(x)