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 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: longest run length below 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.2.tar.gz (5.8 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.2-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tyche_transforms-0.1.2.tar.gz
  • Upload date:
  • Size: 5.8 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.2.tar.gz
Algorithm Hash digest
SHA256 a2a0054cc145d32642a680126777ec7bd0007745db7d70a4fccc96fab06a409d
MD5 e1979af7995f7e32621c2f3297426879
BLAKE2b-256 3da624b6d2ca4ca904606c775f2cc7865757d37224690aae1c51d42ce3d18c97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tyche_transforms-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bbee8166530ee296ec5de4ec5c47cff961fc45136215f8be680242d9d2c1c323
MD5 ede6f48d1de54bc1c90202191e08255c
BLAKE2b-256 f0eeadceafff09f2e1d93bad7194d3e443b9b9e82f566fa0e98e3782e2337798

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