Try to implement parsing for all samples in TTAA observation
This commit is contained in:
parent
221142a08e
commit
78b1c0e5b6
1 changed files with 28 additions and 8 deletions
|
@ -53,15 +53,19 @@ class RawinsObs():
|
|||
|
||||
now = datetime.datetime.now(datetime.UTC)
|
||||
|
||||
self.timestamp = datetime.datetime(
|
||||
return {
|
||||
'timestamp': datetime.datetime(
|
||||
year = now.year,
|
||||
month = now.month,
|
||||
day = day
|
||||
)
|
||||
}
|
||||
|
||||
def parse_surface(self, value: str):
|
||||
def parse_surface_pressure(self, value: str):
|
||||
if value[0:2] == '99':
|
||||
self.surface = float(value[2:5])
|
||||
return {
|
||||
'surface': float(value[2:5])
|
||||
}
|
||||
|
||||
def parse_temp_dewpoint(self, value: str):
|
||||
tenths = int(value[2])
|
||||
|
@ -116,7 +120,23 @@ class RawinsObs():
|
|||
}
|
||||
|
||||
def parse_ttaa(self):
|
||||
pass
|
||||
samples = list()
|
||||
|
||||
for i in range(2, len(self.values), 3):
|
||||
if len(self.values) <= i+2:
|
||||
break
|
||||
|
||||
samples.append({
|
||||
'pressure': self.parse_surface_pressure(self.values[i]),
|
||||
'temp_dewp': self.parse_temp_dewpoint(self.values[i+1]),
|
||||
'wind': self.parse_wind(self.values[i+2])
|
||||
})
|
||||
|
||||
return {
|
||||
'timestamp': self.parse_timestamp(self.values[0]),
|
||||
'station': int(self.values[1]),
|
||||
'samples': samples
|
||||
}
|
||||
|
||||
class RawinsChunk():
|
||||
def __init__(self,
|
||||
|
|
Loading…
Add table
Reference in a new issue