Satellite-agnostic CCSDS/CADU/VCDU frame handling in Python.
Reads raw downlink files containing CADU (Channel Access Data Unit) blocks, reassembles VCDU payloads, and yields fixed-length instrument frames delimited by a caller-supplied sync pattern. Works with any CCSDS-compliant downlink: VIIRS, MERSI, MODIS, etc.
Installation
pip install pycadu
Quick start
from pycadu import iter_vcdu_frames
MERSI_SYNC = bytes([0xAA, 0x55] * 6)
MERSI_FRAME_SIZE = 0x38E4F4
MERSI_VCID = 3
for frame in iter_vcdu_frames(
"FY3D_20240101.dat",
pattern=MERSI_SYNC,
frame_size=MERSI_FRAME_SIZE,
vcid=MERSI_VCID,
stride=1024, # or 896 / 1072 depending on ground station
):
process(frame)
API
pycadu
iter_vcdu_frames(path, pattern, frame_size, vcid, stride) — top-level convenience.
pycadu.cadu
detect_cadu_stride(data) — infer stride (896 / 1024 / 1072) from a sample.
extract_cadu_data(block, stride) — strip RS parity / annotation bytes.
extract_vcdu_payload(cadu) — strip CCSDS primary header.
extract_vcid(block) — read the 6-bit virtual channel identifier.
CADU_STRIDE_1072 — 1072-byte stride (1024-byte CADU + 48 annotation bytes).
pycadu.sync
find_sync_pattern(data, pattern, start) — search at all 8 bit offsets.
_build_shifted(data, shift) — build a bit-shifted copy of data.
pycadu.reader
cadu_blocks(path, stride) — stream physical blocks from a file.
vcdu_payloads(blocks, stride, target_vcid) — filter by VCID, strip headers.
vcdu_frames(payloads, pattern, frame_size) — reassemble variable-length chunks into fixed-length frames, handling 0-7 bit shifts automatically.
read_frames_batch(path, stride, vcid, pattern, frame_size) — memory-mapped bulk reader, ~20x faster than the streaming path on large files.
pycadu.constants
CCSDS_SYNC_MARKER, CADU_STRIDE_896, CADU_STRIDE_1024, RS_PARITY_LENGTH, CADU_DATA_LENGTH, CCSDS_HEADER_LENGTH, VCDU_PAYLOAD_LENGTH.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pycadu-0.1.1.tar.gz.
File metadata
- Download URL: pycadu-0.1.1.tar.gz
- Upload date:
- Size: 3.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ee50c4da4a0a7a6db55f58073776055be324d00e6fac0e03fec98dc5173820c
|
|
| MD5 |
5ac1a17e2d3fbc2f2d5f3cc02ebea1d6
|
|
| BLAKE2b-256 |
31be16404de9d290f095df333f54828d82eca4689de39e75b1e07e165d45978f
|