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