pyFile
pyFile is a Python command-line application for working with data files from
dataloggers. It can:
- Split or merge data files
- Identify gaps in timestamped measurements
- Upload data from supported TOA5 files to the project's database
Requirements
- Python 3.12 or newer
- To upload file data to the database, you must run
pyFileon the tower's Raspberry Pi
Installation
pyFile is available on PyPI. Install
it with:
pip install pyfile-prod
Commands
Use --help with pyfile or any command to display usage information and
available options:
pyfile --help
pyfile arrange --help
pyfile report --help
pyfile uploaddb --help
Arrange files
Arrange and split file data by day, month, or year, or merge the data into one file. All files must belong to the same dataset and have the same table columns. Supported file formats are TOA5, SWD, and CSV.
pyfile arrange --mode d <directory or file paths separated by spaces>
pyfile arrange --mode m <directory or file paths separated by spaces>
pyfile arrange --mode y <directory or file paths separated by spaces>
pyfile arrange --mode a <directory or file paths separated by spaces>
Report missing data
Find gaps between consecutive timestamps. For example:
pyfile report --expected-gap 30 --time-unit minutes <directory or file paths separated by spaces>
Supported time units are milliseconds, seconds, minutes, and hours.
The report can be printed in the terminal, saved as CSV, or both.
Compare two previously saved reports to list the gaps found in only one file:
pyfile report compare <first report.csv> <second report.csv>
The comparison is printed in the terminal and can optionally be saved as CSV.
Upload TOA5 data to the database
Upload one or more supported, uncompressed TOA5 .dat files data to the database. Run this on the production Raspberry Pi:
pyfile uploaddb <file paths or directory>
Currently supported filenames are:
FERLD01_dendroTable.datthroughFERLD06_dendroTable.datFERLD01_sapflowTable.datthroughFERLD06_sapflowTable.datFERLD07_dendroTable.datFERLD07_soilTable.datFERLD08_dendroTable.datFERLD08_soilTable.datfluxcsformat.datfluxnotesabridged.datfluxstorage.datintavg.datparticules.dat
The idea is to take a valid TOA5 file with the data that you want to upload and give it the corresponding name from the ones above. When you upload a file to the database, duplicate records are ignored, and only new records are inserted.
Project layout
src/pyfile_prod/
├── commands/ # Typer command definitions
├── utils/
│ ├── database/ # PostgreSQL queries and connection pool
│ ├── files.py # Input detection, parsing, and collections
│ ├── processors.py # Database upload transformations
│ ├── reporter.py # Missing-data detection
│ ├── divider.py # Period-based output splitting
│ └── merger.py # File merging
├── enums.py
└── main.py
Metadata
Release files for pyfile-prod 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyfile_prod-0.2.4.tar.gz | 17.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyfile_prod-0.2.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.1 kB
Release files / pyfile_prod-0.2.4.tar.gz
| Download URL | pyfile_prod-0.2.4.tar.gz |
|---|---|
| Size | 17.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9149b764cf8e100870d059af9421ca5d60c84ebec927779b43a2e2ebd699b706
|
|
BLAKE2b-256 checksum How to use checksums |
5872d57d4824546a799e7d5137ae1275634f2a945a5f64fdb14444dfba2daecd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pyfile_prod-0.2.4-py3-none-any.whl
| Download URL | pyfile_prod-0.2.4-py3-none-any.whl |
|---|---|
| Size | 26.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
667f3d328f55b87cdfdafa32ae31af9358833cd52b3ba8db29a5fca528dfeec7
|
|
BLAKE2b-256 checksum How to use checksums |
a02255d0a988391a1df3654da5d139f9a11c35c4b1698cd03f89c88c3ec9bb3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|