RSF parser¶
C
pynasonde.digisonde.parsers.rsf — RsfExtractor
Parses RSF digisonde outputs.
pynasonde.digisonde.parsers.rsf
¶
RSF (range-spectral-format) binary parser utilities for Digisonde.
This module exposes:class:RsfExtractor, a low-level reader that
unpacks RSF-format binary blocks into dataclasses defined in
pynasonde.digisonde.datatypes.rsfdatatypes. The extractor focuses on
binary unpacking and construction of frequency-group objects and
provides helpers to convert parsed records into pandas.DataFrame for
analysis and plotting.
RsfExtractor
¶
Low-level reader for RSF-format files.
The extractor reads RSF binary blocks, decodes headers and
frequency-groups and constructs an:class:RsfDataFile object
composed of:class:RsfDataUnit entries. Use:meth:to_pandas
to obtain a flattened pandas.DataFrame suitable for plotting.
Source code in pynasonde/digisonde/parsers/rsf.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |
__init__(filename, extract_time_from_name=False, extract_stn_from_name=False, DATA_BLOCK_SIZE=4096)
¶
Create a RsfExtractor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename |
str
|
str Path to the RSF-format binary file. |
required |
extract_time_from_name |
bool
|
bool, optional If True, attempt to parse a timestamp from the filename. |
False
|
extract_stn_from_name |
bool
|
bool, optional If True, attempt to derive station metadata and local time. |
False
|
DATA_BLOCK_SIZE |
int
|
int, optional Block size in bytes (default 4096). |
4096
|
Source code in pynasonde/digisonde/parsers/rsf.py
extract()
¶
Read and parse the RSF binary file into dataclass containers.
The method iterates over all data blocks, constructs header and
frequency-group objects and appends them to the
:attr:rsf_data container. No value conversion to pandas occurs
here; use:meth:to_pandas for that.
Source code in pynasonde/digisonde/parsers/rsf.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
add_dicts_selected_keys(d0, du, keys=None)
¶
Merge two dictionaries, optionally selecting keys from the second.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d0 |
dict
|
dict Base dictionary. |
required |
du |
dict
|
dict Dictionary to merge from. |
required |
keys |
List[str]
|
list[str] or None, optional
If provided only these keys are copied from |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Merged dictionary (shallow merge). |
Source code in pynasonde/digisonde/parsers/rsf.py
to_pandas()
¶
Convert parsed RSF records into a pandas DataFrame.
The returned DataFrame contains one row per range bin per
frequency-group including amplitude, Doppler index and derived
height and azimuth metadata. The DataFrame is stored on
:attr:records for later reference.
Source code in pynasonde/digisonde/parsers/rsf.py
unpack_5_3(bcd_byte)
staticmethod
¶
Unpack a byte into 5-bit and 3-bit fields.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bcd_byte |
int
|
int Single byte value. |
required |
unpack_bcd(bcd_byte, format='int')
staticmethod
¶
Unpack a BCD-encoded byte.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bcd_byte |
int
|
int Byte encoded in BCD (two decimal digits: high nibble and low nibble). |
required |
format |
str
|
{'int', 'tuple'}, optional
If |
'int'
|
Returns:
| Type | Description |
|---|---|
int | tuple
|
Decoded integer or tuple of two nibbles. |