radarx.level1.iq.read_iq#
- radarx.level1.iq.read_iq(path, *, shape=None, dtype='int16', layout='interleaved', offset=0, variables=('I', 'Q'), **kwargs)[source]#
Read an IQ time series file.
Three kinds of file are read:
a NumPy file (
.npy) with a complex array, or a real array whose last axis has length 2 (I, Q);a NetCDF file (
.nc) or Zarr store (.zarr) with the variablesvariables(defaultIandQ) or one complex variableIQ; the dimension names of the file are kept and the data stay lazy for Zarr;any other file is raw binary:
shapesamples of realdtypevalues afteroffsetbytes, either interleaved (I0 Q0 I1 Q1 ...) or planar (all I, then all Q), the samples in C order ofshape.
- Parameters:
path (
stroros.PathLike) – File or Zarr directory.shape (
tupleofint, optional) – Shape of the complex array of a raw file, for example(n_rays, n_pulses, n_gates). Required for raw files.dtype (
strornumpy.dtype, optional) – Sample type of a raw file, such as"int16",">i2"or"float32". Default"int16".layout (
{"interleaved", "planar"}, optional) – Order of the I and Q samples in a raw file. Default"interleaved".offset (
int, optional) – Bytes to skip at the start of a raw file (a header). Default 0.variables (
tupleofstr, optional) – Names of the in-phase and quadrature variables of a NetCDF or Zarr file.**kwargs –
dims,scale,wavelength,prt,range_start,gate_spacingandnameas foras_iq().
- Returns:
xarray.DataArray– The complex samples, seeas_iq().- Raises:
FileNotFoundError – If the file does not exist.
ValueError – If a raw file is read without
shape, is shorter thanshapeneeds, orlayoutis unknown; or a NetCDF/Zarr file lacks the variables.