Skip to content
Snippets Groups Projects
Commit 3e8bfbf7 authored by tomrink's avatar tomrink
Browse files

updates for icing intensity

parent 576a1600
No related branches found
No related tags found
No related merge requests found
...@@ -17,15 +17,13 @@ ATYPE = '/TP' ...@@ -17,15 +17,13 @@ ATYPE = '/TP'
RMK = '/RM' RMK = '/RM'
# Returns icing/non-icing # Returns icing/neg-icing
def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]): def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]):
no_ice_reports = []
ice_reports = []
# HEADER: VALID,URGENT,AIRCRAFT,REPORT,LAT,LON # HEADER: VALID,URGENT,AIRCRAFT,REPORT,LAT,LON
ice_dict = {} ice_dict = {}
no_ice_dict = {} neg_ice_dict = {}
with open(filename) as file: with open(filename) as file:
for idx, line in enumerate(file): for idx, line in enumerate(file):
...@@ -76,17 +74,15 @@ def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]): ...@@ -76,17 +74,15 @@ def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]):
timestmp = dto.timestamp() timestmp = dto.timestamp()
if len(re.findall(NO_ICE, ice_str)) != 0: if len(re.findall(NO_ICE, ice_str)) != 0:
no_ice_reports.append(ice_str) rpts = neg_ice_dict.get(timestmp)
rpts = no_ice_dict.get(timestmp)
tup = (lat, lon, fl, ice_str) tup = (lat, lon, fl, ice_str)
if rpts is None: if rpts is None:
rpts = [] rpts = []
rpts.append(tup) rpts.append(tup)
no_ice_dict[timestmp] = rpts neg_ice_dict[timestmp] = rpts
else: else:
rpts.append(tup) rpts.append(tup)
else: else:
ice_reports.append(ice_str)
so = re.search(ICE_LVL, ice_str) so = re.search(ICE_LVL, ice_str)
if so is not None: if so is not None:
lvl_a, lvl_b = so.group().split('-') lvl_a, lvl_b = so.group().split('-')
...@@ -137,4 +133,4 @@ def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]): ...@@ -137,4 +133,4 @@ def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]):
else: else:
rpts.append(tup) rpts.append(tup)
return ice_dict, no_ice_dict return ice_dict, neg_ice_dict
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