Skip to main content

Introduction

The Permafrost File Interoperability Toolkit (PFIT) is designed to promote interoperability and the adoption of standards for permafrost data files. This package currently supports the NTGS ground temperature standard. It includes tools to check and manipulate ground temperature data.

File Data Checker

The FileDataChecker checks column names and values for CSV, XLS, and XLSX files. It logs issues with the files being read in if they do not conform to the NTGS standard.

The File Data Checker can be run by passing arguments through the command line, but it can also be imported for use as a module.

The following functions are available from the class:

@static pathExists(path: str)

Checks for the existence of a path and raises an exception if it does not exist.

@static createPathIfExists(path: str)

Creates a path if it does not exist and returns the path initially passed in otherwise.

checkPath(pathLob: str, isVerbose: bool, logPath: str)

  • pathLoc - A string of a file path leading to the file to be checked. This can also be a zip file, which will be unzipped.

  • isVerbose - A boolean value that determines if true, verbose logging to the console will also occur.

  • logPath - A string of a file path that can either lead to a directory or a specific file for the log file to be created at.

    This parameter can be left as None or an empty string (although something must still be passed into the function).

Sets logging level, creates passed file paths if non-existent, unzips files if in ZIP format and calls checkFile.

checkFile(fileName: str)

Opens file with pandas and applies the error checks described below.

The following errors may be reported:

  • Invalid Time - Time does not follow a valid time in the format HH:MM:SS.
  • Invalid Date - Date values should be formatted as YYYY-MM-DD.
  • Unexpected Column - One of the first 6 column names is not from the expected list of column names (or is not in the correct order). If this warning occurs, the columns must be resolved in the correct name and order first, otherwise no other checking is done.
    • Expects data files to contain the first 6 columns with the exact following names: project_name, site_id, latitude, longitude, date_YYYY-MM-DD, time_HH:MM:SS
  • Unexpected Metre - All following metre columns after the first 6 column names should be formatted as "_m" only.
  • No Measurements - No measurement columns are detected in the file.
  • File Type - The file read in is not supported.
  • Coordinate - A latitude or longitude value contains something that is not valid.
  • Latitude - A latitude value is found that is not valid (Less than -90 or greater than 90).
  • Longitude - A longitude value is found that is not valid (Less than -180 or greater than 180).
  • Temperature - A temperature value is found that is not a valid temperature.

XLS and XLSX files are not recommended as they can be problematic when parsing date/time values. Please consider saving data in CSV format.

If you do decide to use XLS(X) files, ensure that the data is located in the first sheet as this is is the only sheet that is checked.

CSV Column Melter

The CSVColMelter accepts existing ground temperature data files that are in the wide format and converts it to the long CSV format through transposition of depth columns. Files must conform to the NTGS-style ground temperature file format. This can be verified with the FileDataChecker.

The CSV Column Melter can be run by passing arguments through the command line, but it can also be imported for use as a module.

The following functions are available from the class:

@static timezone_check(tz: str)

Converts the timezone value to a float and checks if it is within reasonable range. Function for the command line argument parsing.

@static pathExists(path: str)

Checks for the existence of a path and raises an exception if it does not exist.

getISOFormat(date: str or datetime.datetime, time: str or datetime.time)

Used in pandas value interpretation. Parses a date string as YYYY-MM-DD or datetime.datetime object and a time string as HH:MM:SS or a datetime.time object, returns a datetime.datetime object in ISO format.

meltFile(filename: str, outLoc: str)

Opens file for melting, outputs to specified output location (outLoc) when dataframe has been melted.

meltDataFrame(df: pandas.DataFrame)

Dataframe of read in file is manipulated from wide to long format.

Conversion to NetCDF

NTGS_to_NetCDF converts NTGS-style CSV files into NetCDF (.nc). Currently a work in progress.

Metadata

Release files for pfit 0.3.1

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

Source distribution (sdist)

Source distribution for pfit 0.3.1
File Size Uploaded Provenance Actions
pfit-0.3.1.tar.gz 470.4 kB Without provenance Details for pfit-0.3.1.tar.gz

Built distribution (wheel)

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

Total release size: 500.8 kB

Release files / pfit-0.3.1.tar.gz

Download URL pfit-0.3.1.tar.gz
Size 470.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a6c86b6a1cafda529cec903b40384ef80ab8b43451091f9e722f9c1554531ebb
BLAKE2b-256 checksum
How to use checksums
73d9176f4c08088f20d055fef1d7444839011b2079bd0a6d89d2e87c88595d22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / pfit-0.3.1-py3-none-any.whl

Download URL pfit-0.3.1-py3-none-any.whl
Size 30.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
348a96c3b10500bffcb9dade90bc081e0d92decb2c4b9cc397c0c900a958f534
BLAKE2b-256 checksum
How to use checksums
d6b5048372706ab9faf8bff7306a515fdeb899c13174f09dbdec2772effb3c1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for pfit 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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