Перейти до основного вмісту

raygeo.compressed_array

CompressedArray

A numpy-compatible array stored in compressed (zstd) form.

Created by raygeo's scene compiler and texture rasterizer to keep large numpy buffers compressed in memory until they are needed for GPU upload. Call to_numpy to decompress on demand.

Arrays smaller than 4 KB are stored uncompressed to avoid overhead.

compressed_size

compressed_size: int

Size of the compressed (or raw) payload in bytes.

ratio

ratio: float

Compression ratio (compressed / uncompressed).

uncompressed_size

uncompressed_size: int

Size of the original uncompressed data in bytes.

from_float32()

from_float32(data: numpy.NDArray[numpy.float32]) -> CompressedArray

Create a CompressedArray from a 1-D float32 numpy array.

ParameterTypeDescription
datanumpy.NDArray[numpy.float32]
ReturnsCompressedArray

from_int32()

from_int32(data: numpy.NDArray[numpy.int32]) -> CompressedArray

Create a CompressedArray from a 1-D int32 numpy array.

ParameterTypeDescription
datanumpy.NDArray[numpy.int32]
ReturnsCompressedArray

from_uint8_2d()

from_uint8_2d(data: numpy.NDArray[numpy.uint8]) -> CompressedArray

Create a CompressedArray from a 2-D uint8 numpy array.

ParameterTypeDescription
datanumpy.NDArray[numpy.uint8]
ReturnsCompressedArray

to_numpy()

to_numpy() -> Any

Decompress and return a numpy array with the original dtype and shape.

ParameterTypeDescription
ReturnsAny