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

fix problem adding ice reports to no_ice dictionary

parent 63b15479
No related branches found
No related tags found
No related merge requests found
...@@ -60,6 +60,9 @@ def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]): ...@@ -60,6 +60,9 @@ def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]):
else: else:
continue continue
dto = datetime.datetime.strptime(toks[0], '%Y%m%d%H%M').replace(tzinfo=timezone.utc)
timestmp = dto.timestamp()
# Icing # Icing
ii = report.find('/IC') ii = report.find('/IC')
if ii >= 0: if ii >= 0:
...@@ -76,9 +79,6 @@ def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]): ...@@ -76,9 +79,6 @@ def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]):
if ice_str.find('N/A') >= 0: if ice_str.find('N/A') >= 0:
continue 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, ice_str)) != 0: if len(re.findall(NO_ICE, ice_str)) != 0:
rpts = neg_ice_dict.get(timestmp) rpts = neg_ice_dict.get(timestmp)
tup = (lat, lon, fl, -1, cnt_neg_ice, ice_str) tup = (lat, lon, fl, -1, cnt_neg_ice, ice_str)
...@@ -140,15 +140,15 @@ def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]): ...@@ -140,15 +140,15 @@ def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]):
ice_dict[timestmp] = rpts ice_dict[timestmp] = rpts
else: else:
rpts.append(tup) rpts.append(tup)
rpts = no_ice_dict.get(timestmp)
tup = (lat, lon, fl, -1, cnt_no_ice, 'no observed icing')
cnt_no_ice += 1
if rpts is None:
rpts = []
rpts.append(tup)
no_ice_dict[timestmp] = rpts
else: else:
rpts.append(tup) rpts = no_ice_dict.get(timestmp)
tup = (lat, lon, fl, -1, cnt_no_ice, 'no observed icing')
cnt_no_ice += 1
if rpts is None:
rpts = []
rpts.append(tup)
no_ice_dict[timestmp] = rpts
else:
rpts.append(tup)
return ice_dict, no_ice_dict, neg_ice_dict return ice_dict, no_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