43 | | >>> main_data[0][0] |
---|
44 | | '10 99.99 999.9 -0.05 0.40 5.46E+03 0' |
---|
45 | | >>> main_data[0][-1] |
---|
46 | | '200 99.99 999.9 -0.07 99.99 9.99E+37 0' |
---|
| 43 | >>> main_data[0][0] == {'z':'10', 'speed':'99.99', 'dir':'999.9', |
---|
| 44 | ... 'W':'-0.05', 'sigW':'0.40', 'bck':'5.46E+03', |
---|
| 45 | ... 'error':'0'} |
---|
| 46 | True |
---|
| 47 | >>> main_data[0][-1] == {'z':'200', 'speed':'99.99', 'dir':'999.9', |
---|
| 48 | ... 'W':'-0.07', 'sigW':'99.99', 'bck':'9.99E+37', |
---|
| 49 | ... 'error':'0'} |
---|
| 50 | True |
---|
56 | | >>> main_data[-1][0] |
---|
57 | | '10 99.99 999.9 -0.32 99.99 9.99E+37 0' |
---|
58 | | >>> main_data[-1][-1] |
---|
59 | | '200 15.05 71.8 -0.19 0.53 9.99E+37 0' |
---|
| 60 | >>> main_data[-1][0] == {'z':'10', 'speed':'99.99', 'dir':'999.9', |
---|
| 61 | ... 'W':'-0.32', 'sigW':'99.99', 'bck':'9.99E+37', |
---|
| 62 | ... 'error':'0'} |
---|
| 63 | True |
---|
| 64 | >>> main_data[-1][-1] == {'z':'200', 'speed':'15.05', 'dir':'71.8', |
---|
| 65 | ... 'W':'-0.19', 'sigW':'0.53', 'bck':'9.99E+37', |
---|
| 66 | ... 'error':'0'} |
---|
| 67 | True |
---|
129 | | >>> profile[0] |
---|
130 | | '10 99.99 999.9 -0.05 0.40 5.46E+03 0' |
---|
131 | | >>> profile[-1] |
---|
132 | | '200 99.99 999.9 -0.07 99.99 9.99E+37 0' |
---|
| 137 | >>> profile[0] == {'z':'10', 'speed':'99.99', 'dir':'999.9', |
---|
| 138 | ... 'W':'-0.05', 'sigW':'0.40', 'bck':'5.46E+03', |
---|
| 139 | ... 'error':'0'} |
---|
| 140 | True |
---|
| 141 | >>> profile[-1] == {'z':'200', 'speed':'99.99', 'dir':'999.9', |
---|
| 142 | ... 'W':'-0.07', 'sigW':'99.99', 'bck':'9.99E+37', |
---|
| 143 | ... 'error':'0'} |
---|
| 144 | True |
---|
153 | | >>> profile[0] |
---|
154 | | '10 99.99 999.9 -0.05 0.40 5.46E+03 0' |
---|
155 | | >>> profile[-1] |
---|
156 | | '200 99.99 999.9 -0.07 99.99 9.99E+37 0' |
---|
| 165 | >>> profile[0] == {'z':'10', 'speed':'99.99', 'dir':'999.9', |
---|
| 166 | ... 'W':'-0.05', 'sigW':'0.40', 'bck':'5.46E+03', |
---|
| 167 | ... 'error':'0'} |
---|
| 168 | True |
---|
| 169 | >>> profile[-1] == {'z':'200', 'speed':'99.99', 'dir':'999.9', |
---|
| 170 | ... 'W':'-0.07', 'sigW':'99.99', 'bck':'9.99E+37', |
---|
| 171 | ... 'error':'0'} |
---|
| 172 | True |
---|
163 | | self.extend(profile_block[2:]) |
---|
| 179 | self.extend([Observation(observation.split(),self.variables) |
---|
| 180 | for observation in profile_block[2:]]) |
---|
| 181 | |
---|
| 182 | class Observation(dict): |
---|
| 183 | """ |
---|
| 184 | Contain data for single observation from a Scintec sodar .mnd files. |
---|
| 185 | |
---|
| 186 | Parse a known good observation: |
---|
| 187 | >>> observation = Observation(good_observation,good_variables) |
---|
| 188 | >>> observation == {'z':'10', 'speed':'99.99', 'dir':'999.9', |
---|
| 189 | ... 'W':'-0.05', 'sigW':'0.40', 'bck':'5.46E+03', |
---|
| 190 | ... 'error':'0'} |
---|
| 191 | True |
---|
| 192 | """ |
---|
| 193 | |
---|
| 194 | def __init__(self,data,variables): |
---|
| 195 | """ |
---|
| 196 | Parse an observation from a main daily Scintec sodar .mnd file. |
---|
| 197 | |
---|
| 198 | Observation(data,variables) -> <Observation object> |
---|
| 199 | |
---|
| 200 | Where: |
---|
| 201 | |
---|
| 202 | data is a list of str object representing variable values, |
---|
| 203 | |
---|
| 204 | variables is a list of str objects representing variable labels. |
---|
| 205 | |
---|
| 206 | Parse a known good observation: |
---|
| 207 | >>> observation = Observation(good_observation,good_variables) |
---|
| 208 | >>> observation == {'z':'10', 'speed':'99.99', 'dir':'999.9', |
---|
| 209 | ... 'W':'-0.05', 'sigW':'0.40', 'bck':'5.46E+03', |
---|
| 210 | ... 'error':'0'} |
---|
| 211 | True |
---|
| 212 | """ |
---|
| 213 | |
---|
| 214 | super(Observation, self).__init__() |
---|
| 215 | |
---|
| 216 | self.update(dict(zip(variables,data))) |
---|