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.1.tar.gz (19.4 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.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for piscal_processor-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b95814784bd25f93a44b82ae89e06d294538f9167deddd389c7a629ccc733f6b
MD5 2dd3bde0341c377e98fe290b498f5bca
BLAKE2b-256 b9105fdae92a9a4d81d76905274c13891fdd3e774acbcc01a6bd41449e2ada93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for piscal_processor-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82de5f8763de29c81845f3814cf4852e44a308d9a01a9d3bbc70a44429c011ad
MD5 cab5900c435390a5d8b353d08110aa46
BLAKE2b-256 556f7c3dfcf64a0107b56e097f9c0b51de1deaa692c487e4ff5d2fceaa47ea98

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