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.8.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.8-cp39-abi3-win_amd64.whl (479.7 kB view details)

Uploaded CPython 3.9+Windows x86-64

kalix-0.2.8-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (592.6 kB view details)

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

kalix-0.2.8-cp39-abi3-macosx_11_0_arm64.whl (511.9 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file kalix-0.2.8.tar.gz.

File metadata

  • Download URL: kalix-0.2.8.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.8.tar.gz
Algorithm Hash digest
SHA256 b45ce8f2c626669cac81fc4a8ce810c36af4570cd7ecb9e7fd92eb45173a4b37
MD5 8209dd8203e86f56d52e8ea7561a9545
BLAKE2b-256 21db22b37e37a78b01837b14624180c142d095c6c9312313dcbb3818e770a4a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for kalix-0.2.8.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.8-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: kalix-0.2.8-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 479.7 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.8-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f70f0915fc0ff998c749c7212b7624117935f540b713ebd75a218bae21a15f96
MD5 71490e7325af73c9a1f10dd88c041e84
BLAKE2b-256 81c73f9eb36abaf003b9f1ac11b67e0d469760266b5b05df01490997b881c602

See more details on using hashes here.

Provenance

The following attestation bundles were made for kalix-0.2.8-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.8-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kalix-0.2.8-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 92ec142877eaa30d31ecab33cf7094861cbe8cfcfb4e9d476f4f4b248b44c50b
MD5 5f44f87abae46d00b62abc41602d25de
BLAKE2b-256 e70d6b45565ae776617d57778ab8e93795668a3cece88957275c18293a6c0a24

See more details on using hashes here.

Provenance

The following attestation bundles were made for kalix-0.2.8-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.8-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: kalix-0.2.8-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 511.9 kB
  • Tags: CPython 3.9+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kalix-0.2.8-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 18a6527403382179a8922558b940b75c6bd213de3d253e1dd6df505eb520ed9f
MD5 3e795689cb8003de5b14ae09f95f2484
BLAKE2b-256 cf54e7c2def5a71944fef41b0247c17ed80036ba839c54321f5553ed0f24f139

See more details on using hashes here.

Provenance

The following attestation bundles were made for kalix-0.2.8-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