From ec028648ae981bf069e4abd1a4fd2e7935f0809e Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Thu, 1 Apr 2021 12:58:28 -0500 Subject: [PATCH] snapshot... --- modules/icing/pirep_goes.py | 64 +++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py index 595c0953..98a488cb 100644 --- a/modules/icing/pirep_goes.py +++ b/modules/icing/pirep_goes.py @@ -39,6 +39,18 @@ ds_types = ['f4' for i in range(21)] + ['i4' for i in range(3)] #a_clvr_file = '/home/rink/data/clavrx/clavrx_OR_ABI-L1b-RadC-M3C01_G16_s20190020002186.level2.nc' a_clvr_file = '/Users/tomrink/data/clavrx/clavrx_OR_ABI-L1b-RadC-M3C01_G16_s20190020002186.level2.nc' +data_dir = '/Users/tomrink/data/icing/' +icing_files = ['icing_2018010600_2018033022_QC_DAY.h5', 'icing_2018040100_2018063021_QC_DAY.h5', 'icing_2018070101_2018093022_QC_DAY.h5', + 'icing_2018100115_2018123022_QC_DAY.h5', 'icing_2019010100_2019033023_QC_DAY.h5'] +icing_l1b_files = [] + +no_icing_files = ['no_icing_2018010600_2018033022_DAY.h5', 'no_icing_2018040100_2018063021_DAY.h5', 'no_icing_2018070101_2018093022_DAY.h5', + 'no_icing_2018100115_2018123022_DAY.h5', 'no_icing_2019010100_2019033023_DAY.h5'] +no_icing_l1b_files = [] + +train_params_day = ['cld_height_acha', 'cld_geo_thick', 'supercooled_cloud_fraction', 'cld_temp_acha', 'solar_zenith_angle', + 'cld_reff_dcomp', 'cld_opd_dcomp', 'iwc_dcomp', 'lwc_dcomp', 'cloud_phase'] + def setup(): ice_dict, no_ice_dict, neg_ice_dict = pirep_icing(pirep_file) @@ -783,3 +795,55 @@ def apply_qc_icing_pireps(icing_alt, cld_top_hgt, cld_phase, cld_opd, cld_mask, idxs.append(i) return mask, idxs + + +def fov_extract(): + + ice_times = [] + ice_int_s = [] + + for fidx in range(len(icing_files)): + fname = icing_files[fidx] + f = h5py.File(data_dir+fname, 'r') + + times = f['time'][:] + num_obs = len(times) + + icing_int = f['icing_intensity'][:] + + cld_mask = f['cloud_mask'][:, 10:30, 10:30] + cld_mask = cld_mask.reshape((num_obs, -1)) + + cld_top_temp = f['cld_temp_acha'][:, 10:30, 10:30] + cld_top_temp = cld_top_temp.reshape((num_obs, -1)) + + ice_mask = [] + for i in range(num_obs): + keep_0 = np.logical_or(cld_mask[i,] == 2, cld_mask[i,] == 3) # cloudy + keep_1 = np.invert(np.isnan(cld_top_temp[i,])) + keep = keep_0 & keep_1 + keep = np.where(keep, cld_top_temp[i,] < 273.0, False) + + ice_mask.append(keep) + + for fidx in range(len(no_icing_files)): + fname = no_icing_files[fidx] + f = h5py.File(data_dir+fname, 'r') + + times = f['time'] + num_obs = len(times) + + cld_mask = f['cloud_mask'][:, 10:30, 10:30] + cld_mask = cld_mask.reshape((num_obs, -1)) + + cld_top_temp = f['cld_temp_acha'][:, 10:30, 10:30] + cld_top_temp = cld_top_temp.reshape((num_obs, -1)) + + no_ice_mask = [] + for i in range(num_obs): + keep_0 = np.logical_or(cld_mask[i,] == 2, cld_mask[i,] == 3) # cloudy + # keep_1 = np.invert(np.isnan(cld_top_temp[i,])) + # keep = keep_0 & keep_1 + # keep = np.where(keep, cld_top_temp[i,] > 273.0, False) + + no_ice_mask.append(keep_0) \ No newline at end of file -- GitLab