Skip to main content

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 pyFile on 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.dat through FERLD06_dendroTable.dat
  • FERLD01_sapflowTable.dat through FERLD06_sapflowTable.dat
  • FERLD07_dendroTable.dat
  • FERLD07_soilTable.dat
  • FERLD08_dendroTable.dat
  • FERLD08_soilTable.dat
  • fluxcsformat.dat
  • fluxnotesabridged.dat
  • fluxstorage.dat
  • intavg.dat
  • particules.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.3

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

Source distribution (sdist)

Source distribution for pyfile-prod 0.2.3
File Size Uploaded
pyfile_prod-0.2.3.tar.gz 17.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyfile-prod 0.2.3
File Interpreter ABI Platform
pyfile_prod-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 44.1 kB

Release files / pyfile_prod-0.2.3.tar.gz

Download URL pyfile_prod-0.2.3.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f111383ba39f285ac151e4c5ed430e5b196721ac9dcc3e58e2cdae1709062f7a
BLAKE2b-256 checksum
How to use checksums
143c0c22edc2a27fc6a8fbdbd0592082ce8a126d96d166c3d43a16609beb0ec8
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.3-py3-none-any.whl

Download URL pyfile_prod-0.2.3-py3-none-any.whl
Size 26.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4fd52748c7b08a61e451a256b41303d4e12f76ac7a2c437f1bcdfa0f1b68998
BLAKE2b-256 checksum
How to use checksums
8cb25d93bf4ed8c0975dca43e01dc17d69e46057747e2d5ba2ba05d282dd94e9
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 history Release notifications | RSS feed

0.2.4

2 release files

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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