From c3b773f00488676223e196e5616d423fc30e2dcd Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Mon, 10 May 2021 08:32:43 -0500 Subject: [PATCH] fix problem adding ice reports to no_ice dictionary --- modules/icing/pireps.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/icing/pireps.py b/modules/icing/pireps.py index a869c557..48fad09c 100644 --- a/modules/icing/pireps.py +++ b/modules/icing/pireps.py @@ -60,6 +60,9 @@ def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]): else: continue + dto = datetime.datetime.strptime(toks[0], '%Y%m%d%H%M').replace(tzinfo=timezone.utc) + timestmp = dto.timestamp() + # Icing ii = report.find('/IC') if ii >= 0: @@ -76,9 +79,6 @@ def pirep_icing(filename, lon_range=[-180, 180], lat_range=[-55, 55]): 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, ice_str)) != 0: rpts = neg_ice_dict.get(timestmp) 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]): ice_dict[timestmp] = rpts 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) + 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 -- GitLab