diff --git a/modules/contrail/util.py b/modules/contrail/util.py index c7a0faff2a5b09d1f82b96bbff686720edd143f8..11d09bb190057725b706f59a21a99a13da4f2d4a 100644 --- a/modules/contrail/util.py +++ b/modules/contrail/util.py @@ -22,9 +22,12 @@ gfs_files = GFSfiles('/Users/tomrink/data/contrail/gfs/') # GEOSNavigation needs to be updated to support GOES-18 # geos_nav = GEOSNavigation() +num_lines = 5424 +num_elems = 5424 + def load_image(image_path): - # Extract date time string from image path + # Extract date time string from image filepath datetime_regex = '_\\d{8}_\\d{6}' datetime_string = re.search(datetime_regex, image_path) if datetime_string: @@ -38,7 +41,7 @@ def load_image(image_path): def get_contrail_mask_image(image, thresh=0.157): - image = np.where(image > thresh,1, 0) + image = np.where(image > thresh, 1, 0) return image @@ -134,9 +137,9 @@ def extract(mask_image, image_ts, clavrx_path): levels_dict_image = {} for k, v in levels_dict_cidx.items(): cidx_nda = np.array(v) - flat_image = np.zeros(5424*5424) + flat_image = np.zeros(num_lines*num_elems) flat_image[cidx_nda] = 1 - levels_dict_image[k] = flat_image.reshape(5424, 5424) + levels_dict_image[k] = flat_image.reshape(num_lines, num_elems) # Create a DataFrame for all tuples all_df = pd.DataFrame(all_list,