Skip to main content

About

A library of file readers for permafrost-related dataloggers. Instead of trying to make a single csv-reader that can handle any format, this treats each datalogger separately. Currently the following data types are supported:

  • GeoPrecision (GP5W)
  • GeoPrecision (FG2)
  • HOBO (HOBOware)

Installation

To install LoggerReader, follow these instructions:

git clone https://github.com/nicholas512/LoggerRead
cd LoggerRead
python setup.py develop

Consider using a virtual environment, because some dependencies are installed.

Using LoggerReader

The object that is used to read the logger data will differ depending on what kind of instrument the data comes from. However, each reader follows the same behaviour. They all have the .read() method that takes the file name as an argument. You can create the reader object first and then call the .read() method, or just run everything on one line.

Reader().read(file)

OR

reader = Reader()
data = reader.read(file)

Some datalogger types may accept or require other information in order to read the file correctly.

GeoPrecision

Geoprecision logger format differs between the FG2 and GP5W variants. To read a GeoPrecision file, use either the FG2 or GP5W object

FG2

FG2 is the newer software for GeoPrecision instruments:

from LoggerReader.readers import FG2
from pkg_resources import resource_filename
fg2_file = resource_filename("LoggerReader", "sample_files/FG2_399.csv")

# Read an FG2 file
FG2().read(fg2_file)

GP5W

GP5W is the older software for GeoPrecision instruments:

from LoggerReader.readers import GP5W
from pkg_resources import resource_filename
gp5w_file = resource_filename("LoggerReader", "sample_files/GP5W_260.csv")

# To read a file, you might first create a reader object 
reader = GP5W()
reader.read(gp5w_file)

# Or instead, read the data in one line
data = GP5W().read(gp5w_file)

HOBO

Because of the variability of HOBOWare CSV exports, the HOBO reader relies on on a HOBOProperties configuration object. This can be configured manually (most reliable) or autodetected from a file.

The HOBOProperties configuration object

from LoggerReader.readers import HOBOProperties
from pkg_resources import resource_filename
from pathlib import Path

# Autodetect file structure
hobo_file = resource_filename("LoggerReader", "sample_files/hobo_1_AB_classic.csv")
P = HOBOProperties.autodetect(hobo_file)
print(P)

# HOBOWare 'default' format
print(HOBOProperties.defaults())

# HOBOWare 'classic' format
print(HOBOProperties.classic())

# Custom format (unspecified properties are defaults)
P = HOBOProperties(date_separator=",",
                   date_format="YMD",
                   include_line_number=True,
                   include_plot_details=False,
                   no_quotes_or_commas=False,
                   separate_date_time=False)
print(P)
savepath = Path(Path.home(), "custom_hobo_properties.json")
P.write(savepath)  # Save to file

# Read from a saved file
Q = HOBOProperties.from_file(savepath)  # Read from a file
print(Q)

Reading HOBO files with the HOBO object

from LoggerReader.readers import HOBO, HOBOProperties
from pathlib import Path
from pkg_resources import resource_filename

classic_file = resource_filename("LoggerReader", "sample_files/hobo_1_AB_classic.csv")
defaults_file = resource_filename("LoggerReader", "sample_files/hobo_1_AB_defaults.csv")

# To autodetect HOBOWare Properties:
data = HOBO().read(defaults_file)

# To manually specify a the HOBOWare configuration, initialize the HOBO reader with a HOBOProperties object
classic_file = resource_filename("LoggerReader", "sample_files/hobo_1_AB_classic.csv")
classic_properties = HOBOProperties.classic()
hobo = HOBO(classic_properties)
data = hobo.read(classic_file)

Format

Reader objects save csv data in a pandas dataframe stored as the DATA attribute. Column titles are left unchanged with the exception of the datetime column which is renamed to TIME. It is always the first column in the dataframe.

Where possible, any metadata that is found in the file is stored in a META attribute.

Metadata

Release files for LoggerRead 0.1.0

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

Source distribution (sdist)

Source distribution for LoggerRead 0.1.0
File Size Uploaded
LoggerRead-0.1.0.tar.gz 3.2 kB Details

Built distribution (wheel)

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

Total release size: 18.2 kB

Release files / LoggerRead-0.1.0.tar.gz

Download URL LoggerRead-0.1.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
08a2c8a7bc622492bbbc5545028f9476500b2705b5361e9d14aa5f462c4a69d2
BLAKE2b-256 checksum
How to use checksums
502d689cc54a98513a2ec5080a1c80a2a3f8d35e8f5272da1e51e3ae2fa7d1d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

Release files / LoggerRead-0.1.0-py3-none-any.whl

Download URL LoggerRead-0.1.0-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7273b43e1dc9708e54e53c428d330f74d05a1effd5e2cad25fc8bba00b3446dd
BLAKE2b-256 checksum
How to use checksums
02617ef93c20456fb9a9ce19c6e99c35821c69896a80fa42eda95762f03ce1f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.1.0 This release

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