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

Uploaded CPython 3.9+Windows x86-64

kalix-0.2.7-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.7-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.7.tar.gz.

File metadata

  • Download URL: kalix-0.2.7.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.tar.gz
Algorithm Hash digest
SHA256 a331c859b8cfbf7fb81944901477e084e7e915ff9442827373afd0614e4f87d0
MD5 5a0e9ce064faf8bd15f6dbfb41aab1cc
BLAKE2b-256 a986d84d60d9ad56c7efb1f317144b31f1e24c23077ffbf492c23e37c5837abe

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: kalix-0.2.7-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 479.8 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-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 cd84e1dd39d69d61145ae08ae3cf7ee4ac3a4bc5a1a8f4defee67603da07f05b
MD5 d7cb434846dd736a54a535a923715eaf
BLAKE2b-256 6b08df02f669dc46a09bcdf4b420e204fb8bf3a5cc0200b6596395808202b90c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for kalix-0.2.7-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2a02290fa13dbacd69e5c545953cb5e1ba11b79e019bd8a7259bbab9aa8be699
MD5 09bc000bfc66abcd809e5597218aca28
BLAKE2b-256 c7fd559ef9376fdd041c443300b0dec2b306e27be93edf5d15d447f4c42980ca

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: kalix-0.2.7-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.7-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 900aff71c60994fafdd1027b69a7f0305d83047937c6e3cd78c53f56427fcfb8
MD5 71493cc724d3042ca17527a1c2c5d87a
BLAKE2b-256 0ffb4a7b2d5df5b199b0b342cdc3eb85cd1947b4196293bc7ba55689fa20b2fe

See more details on using hashes here.

Provenance

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