EDP parser¶
C
pynasonde.digisonde.parsers.edp — EdpExtractor
Parses EDP format files.
pynasonde.digisonde.parsers.edp
¶
EdpExtractor
¶
Bases: object
Source code in pynasonde/digisonde/parsers/edp.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 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 | |
__init__(filename, extract_time_from_name=False, extract_stn_from_name=False)
¶
EDP (electron density profile) text-file parser for Digisonde outputs.
This module provides :class:EdpExtractor, a lightweight parser for
EDP files that contain F2-layer and profile information exported by
Digisonde software. It focuses on parsing small text files into plain
Python structures and pandas DataFrames suitable for documentation
examples and downstream analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename |
str
|
str Path to the EDP-format file to parse. |
required |
extract_time_from_name |
bool
|
bool, optional If True, attempt to parse a timestamp from the filename (default False). The extractor expects a trailing YYYYDDDHHMMSS-like token in the filename when this is used. |
False
|
extract_stn_from_name |
bool
|
bool, optional If True, attempt to extract a station code from the filename (default False). |
False
|
Source code in pynasonde/digisonde/parsers/edp.py
__update_tz__()
¶
Update station timezone information from parsed F2 metadata.
Source code in pynasonde/digisonde/parsers/edp.py
read_file()
¶
Update station timezone information from parsed F2 metadata.
This helper extracts latitude/longitude from the parsed F2
header (edp_struct['f2']), constructs a
:class:TimeZoneConversion and computes :attr:local_time.
Returns:
| Type | Description |
|---|---|
List[str]
|
Lines from the file including newline characters. |
Source code in pynasonde/digisonde/parsers/edp.py
__check_issues__(line1, n)
¶
Inspect header lines for problem flags or truncated files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line1 |
str
|
str The second header line from the file (used to detect flags). |
required |
n |
int
|
int Number of lines in the file (used to detect truncated output). |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the file appears to have an issue (bad flags or too few lines), False otherwise. |
Source code in pynasonde/digisonde/parsers/edp.py
__parse_F2_datasets__(lines)
¶
Parse the F2 header and value lines into edp_struct['f2'].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lines |
List[str]
|
list[str] Two-line sequence where the first is a whitespace-separated header and the second contains numeric values. |
required |
Source code in pynasonde/digisonde/parsers/edp.py
extract()
¶
Parse the EDP file and return a namespace-wrapped structure.
Behavior¶
- Loads the file lines via :meth:
read_file. - Parses the first two F2 lines with :meth:
__parse_F2_datasets__. - Updates timezone information with :meth:
__update_tz__. - Parses the remaining profile rows into
edp_struct['profile']unless problem flags are detected by :meth:__check_issues__.
Returns:
| Type | Description |
|---|---|
SimpleNamespace
|
A namespace wrapping the parsed dictionary. The raw dict is available as :attr: |
Source code in pynasonde/digisonde/parsers/edp.py
extract_EDP(file, extract_time_from_name=True, extract_stn_from_name=True, func_name='height_profile')
staticmethod
¶
Convenience function to extract a single EDP file into a DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file |
str
|
str Path to the EDP file. |
required |
extract_time_from_name |
bool
|
bool, optional
See :meth: |
True
|
extract_stn_from_name |
bool
|
bool, optional
See :meth: |
True
|
func_name |
str
|
str, optional
Which view to return. |
'height_profile'
|
Returns:
| Type | Description |
|---|---|
pd.DataFrame
|
DataFrame corresponding to the requested view (profile or scaled F2 header). If |
Source code in pynasonde/digisonde/parsers/edp.py
load_EDP_files(folders=[], ext='*.EDP', n_procs=8, extract_time_from_name=True, extract_stn_from_name=True, func_name='height_profile')
staticmethod
¶
Load EDP files from one or more folders into a single DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folders |
List[str]
|
list[str], optional
Folders to search for files (can be empty). Each folder will be
globbed using |
[]
|
ext |
str
|
str, optional
File glob pattern to match (default |
'*.EDP'
|
n_procs |
int
|
int, optional Number of worker processes to use for parallel extraction. |
8
|
extract_time_from_name |
bool
|
bool, optional
See :meth: |
True
|
extract_stn_from_name |
bool
|
bool, optional
See :meth: |
True
|
func_name |
str
|
str, optional
Passed to :meth: |
'height_profile'
|
Returns:
| Type | Description |
|---|---|
pd.DataFrame
|
Concatenated DataFrame containing extracted rows from all discovered files. |