Version:

salvus.project.tools.io.seisio.compression

salvus.project.tools.io.seisio.compression salvus project tools io seisio compression
SeisIO format decompression.

Classes

TraceCompression

Trace compression object.
The compression algorithm is intended for 32-bit floating point numbers and works by converting each 32-bit number to a 32-bit factor and a lower precision integer number. Thus it effectively compresses by reducing the dynamic range for each packet/block of samples.
The compression algorithm packages X samples up in a packet (self.packet is the number of samples per packet).
Layout per packet: For bytes_per_sample == 4: No compression - raw IEEE float 32 data
For `bytes_per_sample == 2` = 16 bit dynamic range per packet:
    `| float32 factor | | int16 value | | int16 value| ...`

For `bytes_per_sample == 1` = 8 bit dynamic range per packet:
    `| float32 factor | | int8 value | | int8 value| ...`
SIGNATURE
class TraceCompression(builtins.object):
    def __init__(
        self,
        samples_per_trace: int,
        samples_per_packet: int,
        bytes_per_sample: int,
    ): ...
ARGUMENTS
Required
samples_per_trace
Type:int
Description:
The number of samples per trace.
Required
samples_per_packet
Type:int
Description:
The number of samples per packet.
Required
bytes_per_sample
Type:int
Description:
The number of bytes per sample.

Methods

TraceCompression.decompress_trace()
Decompress a single trace.
SIGNATURE
def decompress_trace(self, data: np.ndarray) -> np.ndarray: ...
ARGUMENTS
Required
data
Type:np.ndarray
Description:
The compressed data as a np.int8 byte array.
TraceCompression.decompress_trace_dynamic_range()
Decompress the 2 byte version of SeisIO's compression.
The compression algorithm packages X samples up in a packet (self.packet is the number of samples per packet).
Packet layout: | float32 factor | | int16 value | | int16 value| ...
The factor is then just multiplied with all values to yield the final value.
SIGNATURE
def decompress_trace_dynamic_range(
    self,
    data: np.ndarray,
    bytes_per_sample: int,
    buf: np.ndarray | None = None,
) -> np.ndarray: ...
ARGUMENTS
Required
data
Type:np.ndarray
Description:
The compressed data.
Required
bytes_per_sample
Type:int
Description:
The number of bytes per compressed sample.
Optional
buf
Type:np.ndarray | None
Default value:None
Description:
Buffer (np.float32) to store the decompressed data. Will be created if it does not exist.
PAGE CONTENTS