Skip to main content

Convert Campbell Scientific TOB1/TOB2/TOB3 files to ASCII (TOA5).

Project description

Python program to convert Campbell Scientific TOB files to ASCII (TOA5) files.

This is a Python port of the same tool, originally written in C by Mathias Bavay: https://git.wsl.ch/bavay/camp2ascii

camp2ascii can be used as a command line tool or as a python module.

Example usage as a command line tool:

python camp2ascii.py ./64293_20Hz*.dat -o ./ascii_files -pbar

or, after installing with pip:

camp2ascii.py ./64293_20Hz*.dat -o ./ascii_files -pbar

Will attempt to convert all files matching the glob string ./64293_Metdata*.dat from TOB (binary) format to TOA5 (ASCII) format, outputting the resulting files to the ./ascii_files directory. A progress bar will be displayed.

Example usage as a python module:

import pandas as pd
import matplotlib.pyplot as plt
from camp2ascii import camp2ascii
from pathlib import Path
# convert to ascii as before
out_files = camp2ascii("./64293_20Hz*.dat", "./ascii_files", pbar=True)
# read in data using pandas, summarize to 30 minute averages, and plot sonic temperature
data = pd.concat([
    (
        pd.read_csv(path, na_values="NAN", parse_dates=["TIMESTAMP"], index_col="TIMESTAMP", skiprows=[0, 2, 3])
        .resample("5min")
        .mean()
    )
    for path in out_files
])
data = data.sort_index()
data.plot(y="sonic_temp", style='o')

plt.show()

Note that much of this port was done with the help of AI coding tools, and is currently in alpha. I have yet to implement rigorous testing or to fully clean up the AI-generated code.

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

camp2ascii-0.1.1.tar.gz (46.2 kB view details)

Uploaded Source

Built Distribution

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

camp2ascii-0.1.1-py3-none-any.whl (35.4 kB view details)

Uploaded Python 3

File details

Details for the file camp2ascii-0.1.1.tar.gz.

File metadata

  • Download URL: camp2ascii-0.1.1.tar.gz
  • Upload date:
  • Size: 46.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for camp2ascii-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4abe7a48cf27ec8f376d838f6e6d0e551ebe4624eac7f9c8848db781ced8a9c6
MD5 4ea2902760ca3391c9a3a18a3067bb1d
BLAKE2b-256 21d43d7e732137065b930d15cb7d657ca7b8b240eb498aa8a849442943d3d1fa

See more details on using hashes here.

File details

Details for the file camp2ascii-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: camp2ascii-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 35.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for camp2ascii-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 db042420379dab0277931e88e147198d7cdc6f29de919cae284b002f6f239b72
MD5 48e93468083df113b0957bc86195f199
BLAKE2b-256 9dccf45fe9e8507ce7a17ddbc0550982fa24ecfdef756936a438da08f0c66b03

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