Skip to main content

Python interface for Kalix: hydrological modelling and Pixie (Gorilla-compressed) timeseries I/O

Project description

kalix (Python)

Python interface for Kalix.

Current functionality:

  • run simulations from INI model files (in-process, no separate CLI binary)
  • read and write Pixie files (.pxt, .pxb)

Planned:

  • programmatic model manipulation and building (Model class)
  • optimisation

Install

pip install kalix

Usage

Run a simulation

import kalix

kalix.simulate("model.ini", output_file="results.pxb")
df = kalix.read_pixie("results.pxb")
print(df.head())

The Python equivalent of kalix sim model.ini -o results.pxb, but in-process — no separate CLI binary required. Output format is inferred from the extension (.pxb for the Pixie pair, .csv for CSV).

Both outputs are keyword-only, and at least one is required:

# Outputs + mass-balance report
kalix.simulate("model.ini", output_file="results.pxb", mass_balance="mb.txt")

# Mass-balance only
kalix.simulate("model.ini", mass_balance="mb.txt")

Read / write Pixie files

df = kalix.read_pixie("results.pxb")
print(df.head())

kalix.write_pixie("out.pxb", df)

The DataFrame index is a UTC DatetimeIndex; each column is one timeseries.

read_pixie accepts either extension (or no extension) and finds both files:

kalix.read_pixie("results.pxb")  # same as
kalix.read_pixie("results.pxt")  # same as
kalix.read_pixie("results")

write_pixie prefers a tz-aware DatetimeIndex, but will try to coerce other inputs (emitting a UserWarning when it does):

  • a naive DatetimeIndex is localised to UTC;
  • a default RangeIndex(0, n, 1) triggers promotion of the zeroth column to the index (and drops it from the body);
  • any other non-DatetimeIndex is passed through pd.to_datetime(..., utc=True).

Integer and float dtypes are never auto-interpreted as datetimes (this would silently misread values as epoch nanoseconds). Set a DatetimeIndex explicitly in those cases.

Building from source

Requires Rust (1.70+) and maturin.

# Editable install for development
cd python
maturin develop --release

# Build a wheel
maturin build --release

Tests

maturin develop
pytest python/tests

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

kalix-0.2.7.dev0.tar.gz (79.9 MB view details)

Uploaded Source

Built Distributions

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

kalix-0.2.7.dev0-cp39-abi3-win_amd64.whl (480.1 kB view details)

Uploaded CPython 3.9+Windows x86-64

kalix-0.2.7.dev0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (592.7 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

kalix-0.2.7.dev0-cp39-abi3-macosx_11_0_arm64.whl (511.7 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file kalix-0.2.7.dev0.tar.gz.

File metadata

  • Download URL: kalix-0.2.7.dev0.tar.gz
  • Upload date:
  • Size: 79.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kalix-0.2.7.dev0.tar.gz
Algorithm Hash digest
SHA256 076c771afc0004ae9b2bac186afe853b0824295ebc8490f1c6d497e71fa46d65
MD5 23459009744f5caa89f44d4eb39b6514
BLAKE2b-256 733b933b8db0053137dfcc4f0b13e1f59e5f64cdec97c7d96f96a75d604280fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for kalix-0.2.7.dev0.tar.gz:

Publisher: release.yml on chasegan/Kalix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kalix-0.2.7.dev0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: kalix-0.2.7.dev0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 480.1 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kalix-0.2.7.dev0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 138e7ba68c08b8175d1da3eaf68235f3fc8806dc632fe4a6864ee4c224047fac
MD5 438010deb3c6c2481bb86b5174261862
BLAKE2b-256 13ea6b2eea90c5f7829759d1633f2fc034523a6f7649f81d62e3f9bb2337fc14

See more details on using hashes here.

Provenance

The following attestation bundles were made for kalix-0.2.7.dev0-cp39-abi3-win_amd64.whl:

Publisher: release.yml on chasegan/Kalix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kalix-0.2.7.dev0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kalix-0.2.7.dev0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 843c0e14ab91e05d462e987dc076b71466595185c7f632a712b5d5292fbc8c28
MD5 45d70869b1504525928b3e8834053f0a
BLAKE2b-256 b2b43bf476996cc316712b8601154698df83a7bdef8eb3454e52115a1cc6a6a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for kalix-0.2.7.dev0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on chasegan/Kalix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kalix-0.2.7.dev0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kalix-0.2.7.dev0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f5173c971f39049a3b062a683e46d56778463e3f8e4e8c7ad0f098701be71859
MD5 4c10de2b5e5c8aa0d66c722017f87091
BLAKE2b-256 b63ac3d68ce3cdf51d3bd1142be975a1c975b2c0e3e1b8465978c8a235e45fc7

See more details on using hashes here.

Provenance

The following attestation bundles were made for kalix-0.2.7.dev0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on chasegan/Kalix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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