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.2.tar.gz (9.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.2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: trdi_adcp_readers-25.6.2.tar.gz
  • Upload date:
  • Size: 9.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.2.tar.gz
Algorithm Hash digest
SHA256 f99f2c816432e4e972909a3482c3f74db07c33e1a200e7e38049d14b2162e8f3
MD5 8278833d188c94a5a01cc0b9bc9f1a0e
BLAKE2b-256 f9ad23bb7390532e62ec8737f3249df04910bd0d4974afcd43f66fa1e23e4ffc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for trdi_adcp_readers-25.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 01697797700f7551cecbf17e56d2c271a4d7be33e551a7dbaf65c6487dbe6359
MD5 bc2206d15c864ff5313a19d41221b7a1
BLAKE2b-256 97160a4b6300f4c51b1cd9c7a42536224b4815b75d5521ce99ba42c43c0df893

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