Skip to content
Snippets Groups Projects
Commit 9f0805ac authored by tomrink's avatar tomrink
Browse files

snapshot...

parent e141723b
No related branches found
No related tags found
No related merge requests found
......@@ -79,13 +79,12 @@ def pireps(filename, lon_range=[-180, 180], lat_range=[-55, 55]):
continue
# Flight level
f_i = report.find('/FL')
if f_i >= 0:
fl = report[f_i+3:]
ti = fl.find('/TP')
fl = fl[:ti]
fl = fl.rstrip()
fl = fl.lstrip()
so = re.search(FLT_LVL, report)
if so is None:
continue
else:
fl = so.group()
fl = (fl[3:].rstrip()).lstrip()
if fl.isnumeric():
fl = float(fl) * 100 * 0.3048 # conv flight level to meters
else:
......@@ -94,27 +93,27 @@ def pireps(filename, lon_range=[-180, 180], lat_range=[-55, 55]):
# Icing
ii = report.find('/IC')
if ii >= 0:
s = report[ii+3:]
ri = s.find('/RM')
ice_str = report[ii+3:]
ri = ice_str.find('/RM')
if ri >= 0:
s = s[:ri]
ice_str = ice_str[:ri]
else:
ri = s.find(',')
ri = ice_str.find(',')
if ri >= 0:
s = s[:ri]
s = s.lstrip()
if s.find('N/A') >= 0:
ice_str = ice_str[:ri]
ice_str = ice_str.lstrip()
if ice_str.find('N/A') >= 0:
continue
dto = datetime.datetime.strptime(toks[0], '%Y%m%d%H%M').replace(tzinfo=timezone.utc)
timestmp = dto.timestamp()
if len(re.findall(NO_ICE, s)) != 0:
if len(re.findall(NO_ICE, ice_str)) != 0:
no_ice_reports.append(cnt)
else:
ice_reports.append(cnt)
so = re.search(ICE_LVL, s)
so = re.search(ICE_LVL, ice_str)
if so is not None:
lvl_a, lvl_b = so.group().split('-')
if lvl_a.find('FL') >= 0:
......@@ -126,7 +125,7 @@ def pireps(filename, lon_range=[-180, 180], lat_range=[-55, 55]):
fl = max(lvl_a, lvl_b)
reports.append(s)
reports.append(ice_str)
lats.append(lat)
lons.append(lon)
alts.append(fl)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment