Skip to main content

Transformation functions for Tyche market data pipelines

Project description

Tyche Transforms

This package provides the transformation functions defined in MARKETS_INFO.md for Tyche market data pipelines, operating on xarray DataArray inputs. The intent is to keep the same implementations between local development and the Chainlink adapter.

Install

uv pip install tyche-transforms

For development:

uv pip install -e ".[test]"

Usage

import pandas as pd
import xarray as xr
from tyche_transforms.transforms import daily_average, hdd, runlen_lt

times = pd.date_range("2024-01-01", periods=3)
data = xr.DataArray([15.0, 10.0, 8.0], dims="time", coords={"time": times})
print(daily_average(data))
print(hdd(data))
print(runlen_lt(data, threshold=9.0))

GitHub Actions

This repo includes a workflow that runs tests on every push/PR and publishes to PyPI when you push a tag matching v* (for example v0.2.0). To enable publishing:

  1. Add a repository secret named PYPI_API_TOKEN containing your PyPI token.
  2. Push a version tag:
git tag v0.2.0
git push origin v0.2.0

Transform list

  • CONVERT_M_TO_MM: convert meters to millimeters.
  • KELVIN_TO_CELSIUS: convert Kelvin to Celsius.
  • CUMULATIVE_TO_INCREMENT: convert cumulative totals to daily increments.
  • DAILY_AVERAGE, DAILY_SUM, DAILY_MAX, DAILY_MIN: daily resampling functions.
  • HDD, CDD: heating/cooling degree days (base 18 C).
  • SUM, AVG, MAX, MIN: aggregations to scalars.
  • DATE_MAX, DATE_FIRST: timestamp utilities.
  • RUNLEN_LT, RUNLEN_GTE: longest run length below or at/above a threshold.
  • ABS, SUBTRACT_V, SUBTRACT: scalar transforms.

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

tyche_transforms-0.1.3.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

tyche_transforms-0.1.3-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file tyche_transforms-0.1.3.tar.gz.

File metadata

  • Download URL: tyche_transforms-0.1.3.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tyche_transforms-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c623dc2eaa8b4d14b8a04dacba613a5f2173515a3851bb768252883ddbe654df
MD5 d55426562d00855ab979054f1307a3f7
BLAKE2b-256 dd425ec22d2ca07038c0d5be29c5f3ad24fefb1732b1f21644b42f08d09be76c

See more details on using hashes here.

File details

Details for the file tyche_transforms-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for tyche_transforms-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ddb41590309e6839c35fc24ef952a14a9953b99f26f6b22e36c7a1fc4e16f8a4
MD5 25569dd068713e0be19bf0cfb0783655
BLAKE2b-256 f46e6ac8c7597ebeb54e09717bf3fadde24a9aec2daf83e0e64ecf4e7dad9f61

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