Compare commits
3 commits
f902201702
...
131b01640c
Author | SHA1 | Date | |
---|---|---|---|
131b01640c | |||
e5cbb9675a | |||
bfc3d87d73 |
2 changed files with 35 additions and 21 deletions
|
@ -33,13 +33,13 @@ for path in getattr(args, 'raob-sounding-file'):
|
|||
if station is not None:
|
||||
sounding.station = station.code
|
||||
|
||||
if args.dry_run:
|
||||
continue
|
||||
|
||||
if not args.dry_run:
|
||||
db.add(sounding)
|
||||
|
||||
for sample in sounding.samples:
|
||||
sample.sounding_id = sounding.id
|
||||
|
||||
if not args.dry_run:
|
||||
db.add(sample)
|
||||
|
||||
if not args.dry_run:
|
||||
|
|
|
@ -111,26 +111,32 @@ class RAOBObs():
|
|||
|
||||
return None
|
||||
|
||||
def calc_1000mb_height(self, height: float) -> float:
|
||||
if height >= 500:
|
||||
return 0 - (height - 500)
|
||||
def calc_1000mb_height(self, value: float) -> float:
|
||||
if value >= 500:
|
||||
return 0 - (value - 500)
|
||||
|
||||
return height
|
||||
return value
|
||||
|
||||
def calc_850mb_height(self, height: float) -> float:
|
||||
return 1000.0 + height
|
||||
def calc_850mb_height(self, value: float) -> float:
|
||||
return 1000.0 + value
|
||||
|
||||
def calc_500mb_height(self, height: float) -> float:
|
||||
return 10.0 * height
|
||||
|
||||
def calc_250mb_height(self, height: float) -> float:
|
||||
if height >= 500:
|
||||
return height * 10
|
||||
def calc_700mb_height(self, value: float) -> float:
|
||||
if value >= 500:
|
||||
return 2000.0 + value
|
||||
else:
|
||||
return 10.0 * (1000.0 + height)
|
||||
return 3000.0 + value
|
||||
|
||||
def calc_100mb_height(self, height: float) -> float:
|
||||
return 10.0 * (1000.0 + height)
|
||||
def calc_500mb_height(self, value: float) -> float:
|
||||
return 10.0 * value
|
||||
|
||||
def calc_250mb_height(self, value: float) -> float:
|
||||
if value >= 500:
|
||||
return value * 10
|
||||
else:
|
||||
return 10.0 * (1000.0 + value)
|
||||
|
||||
def calc_100mb_height(self, value: float) -> float:
|
||||
return 10.0 * (1000.0 + value)
|
||||
|
||||
def parse_height_pressure(self, token: str):
|
||||
code = token[0:2]
|
||||
|
@ -154,8 +160,10 @@ class RAOBObs():
|
|||
return None
|
||||
elif pressure == 1000:
|
||||
height = self.calc_1000mb_height(float(num))
|
||||
elif pressure <= 850 and pressure > 500:
|
||||
elif pressure <= 850 and pressure > 700:
|
||||
height = self.calc_850mb_height(float(num))
|
||||
elif pressure <= 700 and pressure > 500:
|
||||
height = self.calc_700mb_height(float(num))
|
||||
elif pressure <= 500 and pressure > 250:
|
||||
height = self.calc_500mb_height(float(num))
|
||||
elif pressure <= 250 and pressure > 100:
|
||||
|
@ -254,6 +262,12 @@ class RAOBObs():
|
|||
if len(self.tokens) < i+3 or self.tokens[i][-1] == '=':
|
||||
break
|
||||
|
||||
#
|
||||
# Stop parsing tokens at the tropopause.
|
||||
#
|
||||
if self.tokens[i][0:2] == '88':
|
||||
break
|
||||
|
||||
sample = self.parse_sample_tokens(self.tokens[i:i+3])
|
||||
|
||||
if sample is None:
|
||||
|
|
Loading…
Add table
Reference in a new issue