Skip to main content

Ensemble of tools for CISL data

Project description

cisl

This project is managed with uv.

Setup

Install the project and development dependencies:

uv sync --dev

uv will create a local virtual environment in .venv and use the Python version declared in .python-version (3.12).

Test Data

Some tests depend on sample datasets under tests/samples/, and those files are tracked with Git LFS rather than regular git blobs.

After cloning the repository, fetch them with:

git lfs install
git lfs pull

If files under tests/samples/ look like small pointer text files instead of real binary data, Git LFS content has not been downloaded yet.

Common commands

Run the CLI:

uv run repack <path-to-dataset>

Run a module or script with the project environment:

uv run python -m cisl.scripts.repack --help

Install a Jupyter kernel for the synced environment:

uv run python -m ipykernel install --user --name cisl-py

ENVI I/O

The ENVI reader supports both eager and lazy access.

from cisl.io import envi

eager = envi.open("dataset.hdr")
lazy = envi.open("dataset.hdr", lazy=True)
chunked = envi.open(
    "dataset.hdr",
    chunks={"wavenumber": 16, "y": 512, "x": 512},
)

Implementation detail:

  • spectral is still used for ENVI header parsing and file creation.
  • The data path uses a direct numpy.memmap backend.
  • Lazy reads wrap that memmap with dask.array, so slices and reductions can stay out-of-core until you call .compute().

Writes are also chunk-friendly:

envi.save("out.hdr", chunked)

If the input is dask-backed, envi.save writes one chunk at a time into an ENVI memmap instead of materializing the full cube first.

Dask Memory Notes

Dask delays work, but it does not make large arrays free. The common ways to still run out of memory are:

  • calling .values, .to_numpy(), or .compute() on the full cube
  • using chunks that are too large for the operation
  • triggering implicit rechunking or other operations that need big temporary arrays

Practical guidance:

  • choose chunks when opening the file
  • slice or reduce before computing
  • avoid converting the whole array to NumPy unless you really need it
  • keep chunk sizes moderate and aligned with how you plan to process the data

Notebook Demo

See notebooks/demos/Read core_2x2 ENVI.ipynb for a small example that opens the sample core_2x2.hdr dataset lazily and reads a spectrum plus a single-band image.

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

cisl-0.2.3.tar.gz (259.0 kB view details)

Uploaded Source

Built Distribution

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

cisl-0.2.3-py3-none-any.whl (177.9 kB view details)

Uploaded Python 3

File details

Details for the file cisl-0.2.3.tar.gz.

File metadata

  • Download URL: cisl-0.2.3.tar.gz
  • Upload date:
  • Size: 259.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for cisl-0.2.3.tar.gz
Algorithm Hash digest
SHA256 2ca1ea8deca201fbc175fc4b35adf21a704a1ea1efbd04d287b8fe43045d67fc
MD5 29fb01399324f9485c3a592a9e2373bb
BLAKE2b-256 465be9a9046976128d860fe1e4c8034973dbe1ee3d2d6ce4863a3bdb676e6674

See more details on using hashes here.

File details

Details for the file cisl-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: cisl-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 177.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for cisl-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7341a98e0ada5c1f2734b7e88e20c5b7c9ef55c56d96d863cfa106f41651d5f5
MD5 c025f1136819623c9c76da0fd61debe6
BLAKE2b-256 a792293d6ff9aff5a4ad01ed76d17cb160a30a59029b7e36f61951150b6afa98

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