Fix height/pressure calculation
This commit is contained in:
parent
98a900f249
commit
9dcebc58b8
1 changed files with 23 additions and 10 deletions
|
@ -38,13 +38,6 @@ class RawinsObs():
|
||||||
def read(self, value: str):
|
def read(self, value: str):
|
||||||
self.values.append(value)
|
self.values.append(value)
|
||||||
|
|
||||||
TTAA_HEIGHTS = {
|
|
||||||
'00': 1000, '92': 925, '85': 850,
|
|
||||||
'70': 700, '50': 500, '40': 400,
|
|
||||||
'30': 300, '25': 250, '20': 200,
|
|
||||||
'15': 150, '10': 100,
|
|
||||||
}
|
|
||||||
|
|
||||||
def parse_timestamp(self, value: str):
|
def parse_timestamp(self, value: str):
|
||||||
if value[0:2] == '//':
|
if value[0:2] == '//':
|
||||||
return None
|
return None
|
||||||
|
@ -124,16 +117,36 @@ class RawinsObs():
|
||||||
'speed': wind_speed
|
'speed': wind_speed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TTAA_HEIGHTS = {
|
||||||
|
'00': 1000, '92': 925, '85': 850,
|
||||||
|
'70': 700, '50': 500, '40': 400,
|
||||||
|
'30': 300, '25': 250, '20': 200,
|
||||||
|
'15': 150, '10': 100,
|
||||||
|
}
|
||||||
|
|
||||||
|
def calc_1000mb_height(self, num: float):
|
||||||
|
if num >= 500:
|
||||||
|
return 0 - (num - 500)
|
||||||
|
|
||||||
|
return num
|
||||||
|
|
||||||
def parse_height_pressure(self, value: str):
|
def parse_height_pressure(self, value: str):
|
||||||
token = value[0:2]
|
token = value[0:2]
|
||||||
|
num = value[2:5]
|
||||||
|
|
||||||
if value[2:5] == '///':
|
if num == '///':
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
if token == '00':
|
||||||
|
return {
|
||||||
|
'height': self.calc_1000mb_height(float(num)),
|
||||||
|
'pressure': 1000
|
||||||
|
}
|
||||||
|
|
||||||
if token in self.TTAA_HEIGHTS:
|
if token in self.TTAA_HEIGHTS:
|
||||||
return {
|
return {
|
||||||
'height': self.TTAA_HEIGHTS[token],
|
'height': float(num),
|
||||||
'pressure': float(value[2:5])
|
'pressure': self.TTAA_HEIGHTS[token]
|
||||||
}
|
}
|
||||||
|
|
||||||
PRESSURE_SIG = {
|
PRESSURE_SIG = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue