| 110 | def _normalize(self): |
---|
| 111 | """Clean up data for analysis.""" |
---|
| 112 | self._copy() |
---|
| 113 | # self._convert() |
---|
| 114 | # compute time interval |
---|
| 115 | # correct for missing times |
---|
| 116 | # compute minium altitude |
---|
| 117 | # compute maximum overall altitude |
---|
| 118 | # compute number of altitudes |
---|
| 119 | # compute altitude interval |
---|
| 120 | # correct for missing altitudes |
---|
| 121 | # mark maximum altitude with good values for each sample |
---|
| 122 | # mark minimum altitude with invalid values for each sample |
---|
| 123 | # convert direction to radians |
---|
| 124 | # compute u,v,c components |
---|
| 125 | # compute colorspecs |
---|
| 126 | # compute plotting parameters |
---|
| 127 | |
---|
| 128 | def _copy(self): |
---|
| 129 | """Create a deep copy of all the samples in this Data instance.""" |
---|
| 130 | self.samples = [(dict(sample.header), list(sample.body)) |
---|
| 131 | for sample in self] |
---|
| 132 | for sample in self.samples: |
---|
| 133 | for altitude in sample[1]: |
---|
| 134 | altitude = dict(altitude) |
---|
| 135 | |
---|
| 136 | def _convert(self): |
---|
| 137 | """Convert to numbers and correct for invalid values.""" |
---|
| 138 | INVALID = "-9999" |
---|
| 139 | # convert to numbers and correct for invalid values |
---|
| 140 | for sample in self.samples: |
---|
| 141 | for altitude in sample[1]: |
---|
| 142 | for key in altitude.keys(): |
---|
| 143 | try: |
---|
| 144 | if altitude[key] == INVALID: |
---|
| 145 | raise ValueError |
---|
| 146 | altitude[key] = float(altitude[key]) |
---|
| 147 | except (ValueError, TypeError, KeyError): |
---|
| 148 | altitude[key] = n.NaN |
---|
| 149 | |
---|