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
Installation
You can install camp2ascii using pip:
pip install "camp2ascii[progress]"
or, to install without the progress bar dependency:
pip install camp2ascii
Alternatively, you can clone the repository (or just the camp2ascii.py file) into your working directory.
Usage
camp2ascii can be used as a command line tool or as a python module.
If you installed camp2ascii using pip, the following command calls the CLI:
camp2ascii ./64293_20Hz*.dat -o ./ascii_files -pbar
Without, pip, you can call
python /path/to/camp2ascii.py ./64293_20Hz*.dat -o ./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
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()
N.B. 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file camp2ascii-0.2.0.tar.gz.
File metadata
- Download URL: camp2ascii-0.2.0.tar.gz
- Upload date:
- Size: 49.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e5b992e3e2d69d673b428e5579b4787ce18fac8c06654068694fd070641e359
|
|
| MD5 |
7b4c0d38b2aa19a42bc3c70aef25f054
|
|
| BLAKE2b-256 |
ff011edba683db98627c42b6c75849d2c3954b04da86dac929a2a62a86c59bd1
|
File details
Details for the file camp2ascii-0.2.0-py3-none-any.whl.
File metadata
- Download URL: camp2ascii-0.2.0-py3-none-any.whl
- Upload date:
- Size: 38.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
093d65ee37dff50c5345051c1e089745f72712e8f95a416ef8d838f4b4fdda9e
|
|
| MD5 |
74028149001ee236518ecb9c8213133a
|
|
| BLAKE2b-256 |
95918128093e4371256a83f3a418ba257ee013ea30f7c4045ff271dc465e3671
|