Skip to main content

PISCAL CSV/Parquet processing: convert, export, and schema utilities for curves and measurements.

Project description

piscal-processor

PISCAL CSV/Parquet processing: convert curves to Parquet, export to CSV/TSV, and use standard schemas. PISCAL is used at LeafWeb.org.

Install from PyPI, a local clone, or a Git URL (see below).

Install

From PyPI (when published):

pip install piscal-processor

Optional S3 support (e.g. for s3a:// paths):

pip install piscal-processor[s3]

From a local clone (development):

pip install -e /path/to/piscal-processor

From a Git URL (CI or private install): use a personal access token or SSH:

pip install "piscal-processor @ git+https://github.com/kolpacksoftware/piscal-processor.git@main"
# or
pip install "piscal-processor @ git+ssh://git@github.com/kolpacksoftware/piscal-processor.git@main"

You can pin a branch (@main), tag (@v0.1.0), or commit (@abc1234).

CLI

Convert PISCAL CSV files to Parquet (metadata + measurements):

piscal-processor /path/to/csv_dir --output-dir parquet_output

Options: --no-discover-pathway-subdirs, --source-pathway, --metadata-name, --measurements-name. Input can be a local path or s3a:// URI.

Export measurement Parquet to CSV or TSV:

piscal-processor-export curve_measurements.parquet -o out.tsv --format tsv --columns curve_id,AnetCO2,PARi

Validate that one or more CSV files are in PISCAL format:

piscal-processor-check-format tests/fixtures/sampleinput.csv

Library

from piscal_processor import (
    convert_curves,
    export_curves,
    get_backend,
    is_piscal_csv,
)

# Convert CSVs to DataFrames (or write Parquet via converter.normalize_and_write_parquet)
backend = get_backend("/path/to/csv_dir")
meta_df, meas_df = convert_curves("/path/to/csv_dir", backend, source_pathway="C3")

# Export measurements to CSV/TSV
export_curves(meas_df, "out.tsv", columns=["curve_id", "AnetCO2", "PARi"], format="tsv")

# Quickly validate that a single CSV file looks like a PISCAL/Leafweb curve file
ok = is_piscal_csv("/path/to/file.csv")
print(ok)

Schema constants and parser helpers are also available:

from piscal_processor import STANDARD_MEASUREMENT_COLUMNS, STANDARD_METADATA_COLUMNS
from piscal_processor.parser import parse_csv_line, parse_key_value_section

Tests

pip install -e ".[dev]"
pytest

Documentation

  • docs/csv_structure.md: CSV file structure (header, site/parameter blocks, measurement table).
  • docs/inputformat.txt: PISCAL input file specification (official format description).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

piscal_processor-0.1.2.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

piscal_processor-0.1.2-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file piscal_processor-0.1.2.tar.gz.

File metadata

  • Download URL: piscal_processor-0.1.2.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for piscal_processor-0.1.2.tar.gz
Algorithm Hash digest
SHA256 61d9c2cc24d608d95c08bf0d47ca6d6db6b985c6fc3dfa2e34bea527cf103392
MD5 5979e50f156791531e485a84b1809f0c
BLAKE2b-256 de0cbf3b11e8a25690b843b5f3798fe6fa0f6e200d1e0ef3c7800e58c8269da8

See more details on using hashes here.

File details

Details for the file piscal_processor-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for piscal_processor-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a92bb731d561658bc3c831949e9a2300296ab5a8406ef1cec580d4b47a1b2fe4
MD5 cbe0d997ffac91c13e726fd2d1383f7f
BLAKE2b-256 947c00cfacaec782500bee1bc8c1be50e94f1c8397a2a7a08ed30685ad339c10

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page