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

Uploaded CPython 3.9+Windows x86-64

kalix-0.2.6-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.6-cp39-abi3-macosx_11_0_arm64.whl (511.8 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: kalix-0.2.6.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.6.tar.gz
Algorithm Hash digest
SHA256 78772425580d2366b87158a1437600c45186584e8f045f68ab07d57770309e74
MD5 8280128706ca4eebfe0e745a4c3c4850
BLAKE2b-256 ff69e7042ba20067b4f6c366b5d603efcdbe9d830d5cf538ef7b8eb2a42b3bb5

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: kalix-0.2.6-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 479.9 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.6-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 26ba31494cf6a6ae4b59925da8458dd3c9db8532d9f310700d232a277f24d46b
MD5 ba1f04f8d3449042fda8888f565d2013
BLAKE2b-256 63813584c443fe63a8230315115fec008fd76db3b2c42e67b1fd608bd32b6c6c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for kalix-0.2.6-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1068cd8ab12ccddeb6c87a8aded37684e8510a738656840e484c60a622d74ec3
MD5 3ab4cbbe7bbd4d17a1add3cb3b8e0980
BLAKE2b-256 4289d567fd33a93c48aadabcd59df49ffacf139fa67c498275e71fbb55e6644a

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: kalix-0.2.6-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 511.8 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.6-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 19113e1f9ec47fe42ccca09d2d2cffbe1d7d9767fd810cad1fc360a398b6dd88
MD5 3382181cc7eede3b5139a21fa08e4f63
BLAKE2b-256 d63e747a31f22874c843fbc2ed31ad8b2e46ad0bd5905701fdb2bb7b1f154370

See more details on using hashes here.

Provenance

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