dmap/formats/
iqdat.rs

1//! The [IQDat file format](https://radar-software-toolkit-rst.readthedocs.io/en/latest/references/general/iqdat/).
2
3use crate::record::create_record_type;
4use crate::types::{Fields, Type};
5use lazy_static::lazy_static;
6
7static SCALAR_FIELDS: [(&str, Type); 50] = [
8    ("radar.revision.major", Type::Char),
9    ("radar.revision.minor", Type::Char),
10    ("origin.code", Type::Char),
11    ("origin.time", Type::String),
12    ("origin.command", Type::String),
13    ("cp", Type::Short),
14    ("stid", Type::Short),
15    ("time.yr", Type::Short),
16    ("time.mo", Type::Short),
17    ("time.dy", Type::Short),
18    ("time.hr", Type::Short),
19    ("time.mt", Type::Short),
20    ("time.sc", Type::Short),
21    ("time.us", Type::Int),
22    ("txpow", Type::Short),
23    ("nave", Type::Short),
24    ("atten", Type::Short),
25    ("lagfr", Type::Short),
26    ("smsep", Type::Short),
27    ("ercod", Type::Short),
28    ("stat.agc", Type::Short),
29    ("stat.lopwr", Type::Short),
30    ("noise.search", Type::Float),
31    ("noise.mean", Type::Float),
32    ("channel", Type::Short),
33    ("bmnum", Type::Short),
34    ("bmazm", Type::Float),
35    ("scan", Type::Short),
36    ("offset", Type::Short),
37    ("rxrise", Type::Short),
38    ("intt.sc", Type::Short),
39    ("intt.us", Type::Int),
40    ("txpl", Type::Short),
41    ("mpinc", Type::Short),
42    ("mppul", Type::Short),
43    ("mplgs", Type::Short),
44    ("nrang", Type::Short),
45    ("frang", Type::Short),
46    ("rsep", Type::Short),
47    ("xcf", Type::Short),
48    ("tfreq", Type::Short),
49    ("mxpwr", Type::Int),
50    ("lvmax", Type::Int),
51    ("combf", Type::String),
52    ("iqdata.revision.major", Type::Int),
53    ("iqdata.revision.minor", Type::Int),
54    ("seqnum", Type::Int),
55    ("chnnum", Type::Int),
56    ("smpnum", Type::Int),
57    ("skpnum", Type::Int),
58];
59
60static SCALAR_FIELDS_OPT: [(&str, Type); 2] = [("mplgexs", Type::Short), ("ifmode", Type::Short)];
61
62static VECTOR_FIELDS: [(&str, Type); 9] = [
63    ("ptab", Type::Short),
64    ("ltab", Type::Short),
65    ("tsc", Type::Int),
66    ("tus", Type::Int),
67    ("tatten", Type::Short),
68    ("tnoise", Type::Float),
69    ("toff", Type::Int),
70    ("tsze", Type::Int),
71    ("data", Type::Short),
72];
73
74/// This defines the groups of vector fields that must have the same dimensionality.
75static MATCHED_VECS: [[&str; 6]; 1] = [["tsc", "tus", "tatten", "tnoise", "toff", "tsze"]];
76
77static VECTOR_FIELDS_OPT: [(&str, Type); 0] = [];
78
79static DATA_FIELDS: [&str; 1] = ["data"];
80
81lazy_static! {
82    static ref IQDAT_FIELDS: Fields<'static> = Fields {
83        all_fields: {
84            let mut fields: Vec<&str> = vec![];
85            fields.extend(SCALAR_FIELDS.clone().into_iter().map(|x| x.0));
86            fields.extend(SCALAR_FIELDS_OPT.clone().into_iter().map(|x| x.0));
87            fields.extend(VECTOR_FIELDS.clone().into_iter().map(|x| x.0));
88            fields.extend(VECTOR_FIELDS_OPT.clone().into_iter().map(|x| x.0));
89            fields
90        },
91        scalars_required: SCALAR_FIELDS.to_vec(),
92        scalars_optional: SCALAR_FIELDS_OPT.to_vec(),
93        vectors_required: VECTOR_FIELDS.to_vec(),
94        vectors_optional: VECTOR_FIELDS_OPT.to_vec(),
95        vector_dim_groups: MATCHED_VECS.to_vec().iter().map(|x| x.to_vec()).collect(),
96        data_fields: DATA_FIELDS.to_vec(),
97    };
98}
99
100create_record_type!(iqdat, IQDAT_FIELDS);