diff --git a/modules/amv/intercompare.py b/modules/amv/intercompare.py index a013dd3a7ccd1efc0160444d6408d15df513424a..44fe4fffe78f18696c251d3828e99ccc4fcbf732 100644 --- a/modules/amv/intercompare.py +++ b/modules/amv/intercompare.py @@ -53,10 +53,8 @@ def pireps(filename): no_ice_reports = [] ice_reports = [] with open(filename) as file: - all = 0 cnt = 0 for idx, line in enumerate(file): - all += 1 toks = line.split(',') report = toks[3] @@ -91,9 +89,22 @@ def pireps(filename): continue if len(re.findall(NO_ICE, s)) != 0: - no_ice_reports.append(idx) + no_ice_reports.append(cnt) else: - ice_reports.append(idx) + ice_reports.append(cnt) + so = re.search(ICE_LVL, s) + if so is not None: + ia, ib = so.span() + lvl_a, lvl_b = so.group().split('-') + if lvl_a.find('FL') >= 0: + lvl_a = float(lvl_a[2:]) * 100 * 0.3048 + lvl_b = float(lvl_b[2:]) * 100 * 0.3048 + else: + lvl_a = float(lvl_a) * 100 * 0.3048 + lvl_b = float(lvl_b) * 100 * 0.3048 + + fl = max(lvl_a, lvl_b) + reports.append(s) lats.append(lat) @@ -104,8 +115,6 @@ def pireps(filename): lats = np.array(lats) lons = np.array(lons) - print(len(ice_reports), len(no_ice_reports)) - def get_amv_nd(filename): header = None