I/O Module
The pyadps.io module reads RDI ADCP binary files (PD0 format) and converts
them into xarray.Dataset
objects ready for analysis and processing.
Architecture
The module is organised in three layers:
Layer |
Module |
Purpose |
|---|---|---|
1 |
|
Low-level binary parsing — bytes to NumPy arrays |
2 |
|
High-level reader — NumPy arrays to xarray.Dataset |
3 |
|
Domain-specific methods attached to the Dataset |
Most users only need the binary_reader layer via pyadps.read(). The
pd0_parser layer is for advanced users who need direct binary access.
Reading a File
import pyadps
# Load the complete dataset
ds = pyadps.read('deployment.000')
print(ds)
The returned object is a standard xarray.Dataset containing velocity,
correlation, echo intensity, percent good, fixed leader, and variable leader
data. All xarray operations (indexing, plotting, NetCDF export) work directly.
Loading Specific Components
Use data_types to load only the variables you need — useful for large files:
ds = pyadps.read('deployment.000', data_types=['Velocity', 'Correlation'])
Available options: 'FixedLeader', 'VariableLeader', 'Velocity',
'Correlation', 'Echo', 'PercentGood', 'Status'.
Key Defaults
Parameter |
Default |
Effect |
|---|---|---|
|
|
RDI missing value (−32768) replaced with |
|
|
A 3D QC mask variable is created from missing values |
|
|
Time is the first dimension |
|
|
Cell index used instead of physical depth |
Available Functions
Function |
Description |
|---|---|
|
Load complete dataset — primary entry point |
|
Read file header and structure metadata |
|
Read static instrument configuration |
|
Read per-ensemble sensor data |
|
Read velocity array (beam × cell × time) in mm/s |
|
Read correlation array (0–255) |
|
Read echo intensity array (0–255, ×0.45 for dB) |
|
Read percent good array (0–100) |
|
Read status diagnostic bit flags |
Accessor Methods
Accessor methods are automatically registered when you import pyadps — no
additional import is needed. They are available on any Dataset returned by the
read functions.
Header (ds.header.*)
Note
Header data is not loaded by default. Pass include_header=True to
pyadps.read() before using any ds.header.* method, or they will
silently report failure (e.g. check_file() returning
File Size Match: False) rather than raising an error.
Method |
Description |
|---|---|
|
Verify file integrity (size, byte uniformity) |
|
List data types present in the file |
|
Metadata for a specific ensemble |
|
Full validation report |
|
Print formatted header summary |
Fixed Leader (ds.fixed_leader.*)
Method |
Description |
|---|---|
|
Frequency, beam pattern, orientation |
|
Coordinate system and transformation settings |
|
Available and active sensors |
|
Check if configuration is consistent across ensembles |
|
Full validation report |
|
Print formatted configuration summary |
Variable Leader (ds.variable_leader.*)
Method |
Description |
|---|---|
|
Check time coordinate validity |
|
Most common ensemble interval |
|
Check if time axis is uniform |
|
Frequency distribution of time components |
|
Detect gaps in ensemble numbering |
|
Decode Built-In Test result bits |
|
Decode all four Error Status Words |
|
Print formatted variable leader summary |
Low-Level Access
For direct binary access without the xarray layer:
from pyadps.io import pd0_parser
# Parse file structure
dt, byte, byteskip, offset, idarray, n_ens, err = pd0_parser.fileheader('deployment.000')
# Read velocity as NumPy array
data, n_ens, cell_array, beam_array, err = pd0_parser.datatype('deployment.000', 'velocity')
See pd0_parser for full details.
Contents
See Also
Processing Module — Quality control and processing pipeline