Skip to main content

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

This tool is inspired by the identically-named camp2ascii written by Mathias Bavay: https://git.wsl.ch/bavay/camp2ascii

Installation

You can install camp2ascii using pip:

pip install "camp2ascii[extras]"

or, to install without the progress bar dependency:

pip install camp2ascii

Usage

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

The following command calls the CLI:

camp2ascii ./64293_20Hz*.dat -odir ./ascii_files -pbar

This 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.

To use the python API:

import pandas as pd
import matplotlib.pyplot as plt
# if you installed without pip
# import sys
# sys.path.append("/path/to/working/directory/")
from camp2ascii import camp2ascii, toa5_to_pandas
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([
    (
        toa5_to_pandas(path)
        .resample("5min")
        .mean()
    )
    for path in out_files
])
data = data.sort_index()
data.plot(y="sonic_temp", style='o')

plt.show()

The above code snippet uses toa5_to_pandas, but you can also do pd.read_csv(path, skiprows=[0, 2, 3], na_values=["NAN"], parse_dates=["TIMESTAMP"], index_col="TIMESTAMP"). However, since integers in python cannot be NAN (but can in TOA5 files) and due to how NANs are stored in TOA5 files (as "NAN", in quotes), pandas has trouble correctly identifying certain datatypes. toa5_to_pandas will generally work better for this purpose.

Metadata

Release files for camp2ascii 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for camp2ascii 1.1.1
File Size Uploaded Provenance Actions
camp2ascii-1.1.1.tar.gz 40.6 kB Without provenance Details for camp2ascii-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for camp2ascii 1.1.1
File Interpreter ABI Platform Actions
camp2ascii-1.1.1-py3-none-any.whl Python 3 none any Details for camp2ascii-1.1.1-py3-none-any.whl

Total release size: 84.7 kB

Release files / camp2ascii-1.1.1.tar.gz

Download URL camp2ascii-1.1.1.tar.gz
Size 40.6 kB
Tags Source
SHA-256 checksum
How to use checksums
21a890dc319d6c1e578fdfbec21bf566eeeb27b614207126c237862f88f5b95f
BLAKE2b-256 checksum
How to use checksums
be3db8b56f8abc0f68863578e07050bef06f1059268fc29399522f042f6e9226
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / camp2ascii-1.1.1-py3-none-any.whl

Download URL camp2ascii-1.1.1-py3-none-any.whl
Size 44.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b72cac9ea6d951881f307e22a70dfbb07daceb795c3af5a19f46a8d3c9364a2
BLAKE2b-256 checksum
How to use checksums
924ebda5aa869bc527e5d4978f0b0a9a987c50a121df268c8252eede47048825
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for camp2ascii 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page