Skip to main content

A library capable of reading various TRDI ADCP data formats including PD15 and PD0 into python native types.

Project description

TRDI ADCP Work Horse (wh) Reader

Overview

Reads data from TRDI ADCP work horse data loggers.

Contains methods to convert from PD15 to PD0. Once in PD0, the data can be parsed into a Python dictionary.

Sample Output

Installation

pip install trdi-adcp-readers

Command-line Tools

This package provides the following command-line tools after installation:

  • convert_trdi: Converts a binary PD15 or PD0 TRDI ADCP file to CSV files
  • convert_trdi_uhi: Converts a binary PD15 or PD0 TRDI ADCP file to University of Hawaii (UHI) format CSV files

Test

From the root directory run tests.py to test against a known PD0 and PD15 file

python tests/tests.py

Example

Parse PD0 Data File

from trdi_adcp_readers.pd0.pd0_parser import parse_pd0_bytearray
pd0 = ''
with open(<path to PD0 file>, 'rb') as f:
    pd0 = f.read()
pd0_bytes = bytearray(pd0)
data = parse_pd0_bytearray(pd0_bytes)

Parse PD15 Data File

from trdi_adcp_readers.pd15.pd0_converters import PD15_file_to_PD0
from trdi_adcp_readers.pd0.pd0_parser import parse_pd0_bytearray
pd0 = PD15_file_to_PD0('./140B97C6', header_lines=2)
data = parse_pd0_bytearray(pd0)

Note that this example uses the included file 140B97C6. This file is a test GOES file transmitted by an in-shore COMPS station. This station is located in a shallow area. Only data from the first few cells is valid. Transmissions from this station include a GOES header and an empty line before the PD15 data. The PD15 converter skips these first two lines using the argument header_lines=2.

Convert ADCP Data to UHI Format

The package includes a command-line utility for converting TRDI ADCP data (PD0 or PD15) to University of Hawaii's (UHI) format, which consists of three CSV files:

convert_trdi_uhi --format pd0 --headers 0 <input_file> <info_output> <velocity_output> <data_output>

Example:

convert_trdi_uhi --format pd0 --headers 0 tests/data/1407E0CA.PD0 1407E0CA_info.txt 1407E0CA_velocity.txt 1407E0CA_data.txt

You can also run it as a module:

python -m trdi_adcp_readers.scripts.convert_trdi_uhi --format pd0 --headers 0 <input_file> <info_output> <velocity_output> <data_output>

Command options:

  • --format pd0|pd15: Specifies the input file format (pd0 or pd15). If not provided, the script will attempt to determine format from file extension.
  • --headers N: Number of header lines to skip before parsing data (default: 0).
  • --mag-declination VALUE: Magnetic declination in degrees (default: 0.0).

Output files:

  • info_output: Contains header information about the ADCP deployment.
  • velocity_output: Contains water depth and velocity data for each bin.
  • data_output: Contains correlation and echo amplitude data for each bin.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trdi_adcp_readers-25.6.4.tar.gz (64.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trdi_adcp_readers-25.6.4-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file trdi_adcp_readers-25.6.4.tar.gz.

File metadata

  • Download URL: trdi_adcp_readers-25.6.4.tar.gz
  • Upload date:
  • Size: 64.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for trdi_adcp_readers-25.6.4.tar.gz
Algorithm Hash digest
SHA256 9fa94eb0d7c7a1e8e781fa30c6ee1c06c9855a5f203e4425ff5b8af55114e1f0
MD5 509000ad43c5343dded7649a4e679ea0
BLAKE2b-256 c37d08a8affb3e43b8004ea6392d80746f4c1058d721642cc56b283db07b19a6

See more details on using hashes here.

File details

Details for the file trdi_adcp_readers-25.6.4-py3-none-any.whl.

File metadata

File hashes

Hashes for trdi_adcp_readers-25.6.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fa600e57e9dd1a32042e362f71b67800c84438ab60c889675250448a0249d143
MD5 c070bdcdd7fcd23fe04d7a931e1a6e3f
BLAKE2b-256 388551fbe2f6b870a365bef61a8c30a7fac3312fc517873db2441b90e567617f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page