Skip to content

Tools to process and transform bin files from Thies Clima

License

Notifications You must be signed in to change notification settings

raxlab/thies-bin-processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

☀️☔ THIES Binary Processor

This repository processes binary data from the THIES Data Logger DL16. It provides functions to read binary files and export them in CSV format.

Data Directory

The binary data export from THIES DL16 should follow this structure (the dates and DIRNAME are just examples):

./DIRNAME/
    ├── ARCH_AV1/
    |   ├── 20240425.BIN
    |   ├── ...
    |   ├── 20240603.BIN
    |   └── DESCFILE.INI
    └── ARCH_EX1/
        ├── 20240425.BIN
        ├── ...
        ├── 20240603.BIN
        └── DESCFILE.INI

ARCH_AV1 contains average values for each parameter. ARCH_EX1 contains min/max values.

Usage

Check the UserGuideNB.ipynb notebook for usage examples and for step-by-step instructions on setting up and using the THIES Binary Processor with Google Colab with Google Drive.

For local use, make sure all dependencies are installed. This code was developed using Conda. It mainly uses:

  • Python 3.8.8
  • Pandas 1.2.4
  • Numpy 1.20.1
  • Bitarray 1.9.2

Dependencies are listed in requirements.txt file. If you're using Conda, you can run the following command:

conda install --file requirements.txt

THIESDayData

This class is made to handle a single .BIN file that represents one day's data. To load a .BIN file, for example:

data = THIESDayData(datatype='AV')
data.read_binfile("ARCH_AV1/20240425.BIN", "ARCH_AV1/DESCFILE.INI")

To export the data:

data.write_csv('output_filename')

THIESData

This class is made to handle multiple .BIN files and export them as a single CSV file.

First we create a THIESData instance. In this example we will read average (AV) values:

data = THIESData(datatype='AV', dirpath='ARCH_AV1')

We can export the data in 2 different ways: using the read_write() method or the load-and-write method.

1. read_write(): After creating data, we simply run

data.read_write(outpath='output_filename')

This will create a new output_filename.csv file with all the binary data stored in the /ARCH_AV1 directory.

2. Load and write: We first load the data from the directory into the THIESData instance.

data.load_df()

This will load the data as a Pandas DataFrame that can be accessed as:

data.dataDF

To create the CSV output file:

data.df2csv(outpath='output_filename')

Contributions

For bug reports, requests, or other problems, please feel free to submit an issue.

Contact info

If you have any questions, issues, or comments, you can contact me at:

Acknowledgement

This work was supported by the UC Centers and Field Stations Network (RCER UC), the UC Data Science Initiative, and the School of Engineering at Universidad Católica.

About

Tools to process and transform bin files from Thies Clima

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published