dolfyn.Velocity¶
-
class
dolfyn.
Velocity
(*args, **kwargs)[source]¶ This is the base class for velocity data objects.
All ADP and ADV data objects inherit from this base class.
See also
dict
Notes
DOLfYN Velocity objects are based on Python dicts, but have fancy interactive printing properties and indexing properties.
First, the interactive printing:
>>> import dolfyn as dlfn >>> dat = dlfn.read_example('BenchFile01.ad2cp')
In an interactive interpreter, view the contents of the data object by:
>>> dat <ADP data object> . 9.11 minutes (started: Feb 24, 2017 10:01) . BEAM-frame . (38 bins, 1094 pings @ 2Hz) *------------ | mpltime : <time_array; (1094,); float64> | range : <array; (38,); float64> | range_b5 : <array; (38,); float64> | vel : <array; (4, 38, 1094); float32> | vel_b5 : <array; (1, 38, 1094); float32> + alt : + DATA GROUP + altraw : + DATA GROUP + config : + DATA GROUP + env : + DATA GROUP + orient : + DATA GROUP + props : + DATA GROUP + signal : + DATA GROUP + sys : + DATA GROUP
You can view the contents of a ‘DATA GROUP’ by:
>>> dat['env'] <class 'dolfyn.data.base.TimeData'>: Data Object with Keys: *------------ | c_sound : <array; (1094,); float32> | press : <array; (1094,); float32> | temp : <array; (1094,); float32>
Or you can also use attribute-style syntax:
>>> dat.signal <class 'dolfyn.data.base.TimeData'>: Data Object with Keys: *------------ | amp : <array; (4, 38, 1094); float16> | amp_b5 : <array; (1, 38, 1094); float16> | corr : <array; (4, 38, 1094); uint8> | corr_b5 : <array; (1, 38, 1094); uint8>
You can directly access an item in a subgroup by:
>>> dat['env.c_sound'] array([1520.9 , 1520.8501, 1520.8501, ..., 1522.3 , 1522.3 , 1522.3 ], dtype=float32)
# And you can test for the presence of a variable by:
>>> 'signal.amp' in dat True
-
__init__
(self, \*args, \*\*kwargs)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(self, \*args, \*\*kwargs)Initialize self.
append
(self, other)Join two data objects together.
clear
()copy
(self)Create a copy of the data object.
fromkeys
(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
get
(self, key[, default])Return the value for key if key is in the dictionary, else default.
items
()iter_data
(self[, include_hidden])Generate the keys for all data items in this data object, including walking through sub-data objects.
iter_subgroups
(self[, include_hidden])Generate the keys for all sub-groups in this data object, including walking through sub-groups.
keys
()pop
(self, indx[, d])If key is not found, d is returned if given, otherwise KeyError is raised
popitem
()2-tuple; but raise KeyError if D is empty.
rotate2
(self, out_frame[, inplace])Rotate the data object into a new coordinate system.
set_declination
(self, declination)Set the declination of the data object.
set_inst2head_rotmat
(self, rotmat)setdefault
(self, key[, default])Insert key with a value of default if key is not in the dictionary.
to_hdf5
(self, buf[, chunks, compression])Write the data in this object to an hdf5 file.
update
()If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
values
()Attributes
Horizontal velocity as a complex quantity.
Angle of horizontal velocity vector (radians clockwise from east/X/streamwise).
Horizontal velocity magnitude.
The number of timesteps in the data object.
The shape of ‘scalar’ data in this data object.
shortcuts
Subset is an indexer for creating subsets of the data object using Python slice syntax.
The first velocity component.
The second velocity component.
The third velocity component.