Direct xarray views over the MeerKAT archive
This package present an xarray view over observations in the MeerKAT archive.
Required Reading
You’ll need some familiarity with xarray. In particular:
Opening a dataset
Use xarray.open_datatree with engine="xarray-kat" (or let xarray infer the engine automatically from the URL). The call returns a xarray.DataTree whose children are the individual scans of the observation.
import xarray_kat # registers the "xarray-kat" engine
import xarray
token = "eyFILLMEIN"
capture_block_id = 1234567890
url = (
f"https://archive-gw-1.kat.ac.za/{capture_block_id}"
f"/{capture_block_id}_sdp_l0.full.rdb?token={token}"
)
dt = xarray.open_datatree(url, engine="xarray-kat", chunked_array_type="xarray-kat", chunks={})
Each child node is keyed "<capture_block_id>_<stream_name>/<scan_index>" and exposes the MSv4-style data variables:
VISIBILITY — complex correlator data, shape (time, baseline_id, frequency, polarization)
WEIGHT — per-sample weights, same shape as VISIBILITY
FLAG — per-sample flags, same shape as VISIBILITY
UVW — baseline UVW coordinates, shape (time, baseline_id, uvw)
Parameters
All keyword arguments below are passed through xarray.open_datatree.
- applycalstr or list of str, default ""
Calibration products to apply. Use "all" to apply every available product, an explicit list such as ["l1.G", "l1.B"] to apply specific products, or "" to skip calibration entirely.
- scan_statesiterable of str, default ("scan", "track")
Only scans whose activity-sensor state appears in this collection are included in the tree. Pass e.g. ("track",) to keep only tracking scans.
- uvw_sign_convention"casa" or "fourier", default "casa"
Sign convention for UVW coordinates. "casa" follows the antenna2 - antenna1 convention used by CASA and most radio-astronomy software. "fourier" uses the opposite sign.
- van_vleck"off" or "autocorr", default "off"
Van Vleck correction for the MeerKAT F-engine quantisation distortion. "autocorr" corrects autocorrelation amplitudes using the built-in lookup table; "off" leaves the data unchanged.
- preferred_chunksdict, optional
Preferred chunk sizes along named dimensions, e.g. {"time": 4, "frequency": 512}. These are hints; the engine uses the natural archive chunking where possible.
- capture_block_idstr, optional
Override the capture-block ID inferred from the RDB file. Rarely needed in normal use; useful when the ID embedded in the file differs from the one in the URL.
- stream_namestr, optional
Override the data-stream name inferred from the RDB file (e.g. "sdp_l0"). Useful when an observation contains multiple streams and you want to open a specific one.
- max_in_flightint, optional
The most chunk reads that .load() keeps in flight at once. By default, three per HTTP request that TensorStore allows in flight: 96 at TensorStore’s default concurrency of 32. To read faster from a high-latency store, raise TENSORSTORE_HTTP_REQUEST_CONCURRENCY and this default follows; set max_in_flight only to bound the memory held by reads in flight.
Example Usage
Load a small observation entirely into memory:
import xarray_kat
import xarray
token = "eyFILLMEIN"
capture_block_id = 1234567890
url = (
f"https://archive-gw-1.kat.ac.za/{capture_block_id}"
f"/{capture_block_id}_sdp_l0.full.rdb?token={token}"
)
dt = xarray.open_datatree(url, chunked_array_type="xarray-kat", chunks={})
dt.load()
Select a subset of the data before loading:
ds = dt[f"{capture_block_id}_sdp_l0/0"].ds
ds = ds.isel(
time=slice(10, 20),
baseline_id=[1, 20, 30, 31, 32, 50],
frequency=slice(256, 768),
)
ds.load()
Apply calibration solutions and Van Vleck correction:
dt = xarray.open_datatree(
url,
chunked_array_type="xarray-kat",
chunks={},
applycal="all",
van_vleck="autocorr",
)
If dask is installed, request dask-backed chunks along specific dimensions:
# Natural (archive) chunking — most efficient
dt = xarray.open_datatree(url, chunks={})
dt = dt.compute()
# Custom chunking — may cause repeated archive requests for overlapping chunks;
# prefer rechunking on top of natural chunks, or use a cache pool
dt = xarray.open_datatree(
url, chunks={"time": 20, "baseline_id": 155, "frequency": 256}
)
dt = dt.compute()
Metadata
Release files for xarray-kat 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xarray_kat-0.0.9.tar.gz | 95.7 kB | With provenance | Details for xarray_kat-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xarray_kat-0.0.9-py3-none-any.whl | Python 3 | none | any | Details for xarray_kat-0.0.9-py3-none-any.whl |
Total release size: 208.2 kB
Release files / xarray_kat-0.0.9.tar.gz
| Download URL | xarray_kat-0.0.9.tar.gz |
|---|---|
| Size | 95.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b66c47dd64bdcf52d6e630bd16c2f0229881b75e01a2f31d50be3ea741a1f5fc
|
|
BLAKE2b-256 checksum How to use checksums |
3b7e376593ef5de81b311fd3b17d121e8388fa117968302b85148bbfa5891370
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / xarray_kat-0.0.9-py3-none-any.whl
| Download URL | xarray_kat-0.0.9-py3-none-any.whl |
|---|---|
| Size | 112.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f631477f759ae0d71e72b009c2d3c1635a54938e8e69d134709686cedadd77e2
|
|
BLAKE2b-256 checksum How to use checksums |
f590776b56a1f62c1f9283f31c9e065a05b4e926e2f8532ce81c7e958e1f729d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logSecurity for xarray-kat 0.0.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for xarray_kat-0.0.9.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.