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

snapshot...

parent 563b761d
Branches
No related tags found
No related merge requests found
...@@ -545,69 +545,69 @@ def pirep_info(pirep_dct): ...@@ -545,69 +545,69 @@ def pirep_info(pirep_dct):
return flt_lvl_s, ice_intensity_s, lat_s, lon_s return flt_lvl_s, ice_intensity_s, lat_s, lon_s
# Keep for example
def analyze(ice_dct, no_ice_dct): # def analyze(ice_dct, no_ice_dct):
#
last_file = None # last_file = None
ice_files = [] # ice_files = []
ice_times = [] # ice_times = []
for ts in list(ice_dct.keys()): # for ts in list(ice_dct.keys()):
try: # try:
ds = get_goes_datasource(ts) # ds = get_goes_datasource(ts)
goes_file, t_0, _ = ds.get_file(ts) # goes_file, t_0, _ = ds.get_file(ts)
if goes_file is not None and goes_file != last_file: # if goes_file is not None and goes_file != last_file:
ice_files.append(goes_file) # ice_files.append(goes_file)
ice_times.append(t_0) # ice_times.append(t_0)
last_file = goes_file # last_file = goes_file
except Exception: # except Exception:
continue # continue
#
last_file = None # last_file = None
no_ice_files = [] # no_ice_files = []
no_ice_times = [] # no_ice_times = []
for ts in list(no_ice_dct.keys()): # for ts in list(no_ice_dct.keys()):
try: # try:
ds = get_goes_datasource(ts) # ds = get_goes_datasource(ts)
goes_file, t_0, _ = ds.get_file(ts) # goes_file, t_0, _ = ds.get_file(ts)
if goes_file is not None and goes_file != last_file: # if goes_file is not None and goes_file != last_file:
no_ice_files.append(goes_file) # no_ice_files.append(goes_file)
no_ice_times.append(t_0) # no_ice_times.append(t_0)
last_file = goes_file # last_file = goes_file
except Exception: # except Exception:
continue # continue
#
ice_times = np.array(ice_times) # ice_times = np.array(ice_times)
no_ice_times = np.array(no_ice_times) # no_ice_times = np.array(no_ice_times)
#
itrsct_vals, comm1, comm2 = np.intersect1d(no_ice_times, ice_times, return_indices=True) # itrsct_vals, comm1, comm2 = np.intersect1d(no_ice_times, ice_times, return_indices=True)
#
ice_indexes = np.arange(len(ice_times)) # ice_indexes = np.arange(len(ice_times))
#
ucomm2 = np.setxor1d(comm2, ice_indexes) # ucomm2 = np.setxor1d(comm2, ice_indexes)
np.random.seed(42) # np.random.seed(42)
np.random.shuffle(ucomm2) # np.random.shuffle(ucomm2)
ucomm2 = ucomm2[0:8000] # ucomm2 = ucomm2[0:8000]
#
files_comm = [] # files_comm = []
for i in comm2: # for i in comm2:
files_comm.append(ice_files[i]) # files_comm.append(ice_files[i])
#
files_extra = [] # files_extra = []
times_extra = [] # times_extra = []
for i in ucomm2: # for i in ucomm2:
files_extra.append(ice_files[i]) # files_extra.append(ice_files[i])
times_extra.append(ice_times[i]) # times_extra.append(ice_times[i])
#
files = files_comm + files_extra # files = files_comm + files_extra
times = itrsct_vals.tolist() + times_extra # times = itrsct_vals.tolist() + times_extra
times = np.array(times) # times = np.array(times)
#
sidxs = np.argsort(times) # sidxs = np.argsort(times)
for i in sidxs: # for i in sidxs:
filename = os.path.split(files[i])[1] # filename = os.path.split(files[i])[1]
so = re.search('_s\\d{11}', filename) # so = re.search('_s\\d{11}', filename)
dt_str = so.group() # dt_str = so.group()
print(dt_str[2:]) # print(dt_str[2:])
lon_space_hdeg = np.linspace(-180, 180, 721) lon_space_hdeg = np.linspace(-180, 180, 721)
...@@ -1079,7 +1079,9 @@ def apply_qc_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_opd ...@@ -1079,7 +1079,9 @@ def apply_qc_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_opd
opd_thin_threshold = 0.1 opd_thin_threshold = 0.1
closeness_top = 100.0 # meters closeness_top = 100.0 # meters
closeness_bot = 200.0 # meters closeness_bot = 100.0
max_depth = 3000.0
num_obs = len(icing_alt) num_obs = len(icing_alt)
cld_mask = cld_mask.reshape((num_obs, -1)) cld_mask = cld_mask.reshape((num_obs, -1))
cld_top_hgt = cld_top_hgt.reshape((num_obs, -1)) cld_top_hgt = cld_top_hgt.reshape((num_obs, -1))
...@@ -1112,7 +1114,8 @@ def apply_qc_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_opd ...@@ -1112,7 +1114,8 @@ def apply_qc_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_opd
# Test 1 # Test 1
keep = np.where(keep, (cld_top_hgt[i,] + closeness_top) > icing_alt[i], False) keep = np.where(keep, (cld_top_hgt[i,] + closeness_top) > icing_alt[i], False)
keep = np.where(keep, (cld_top_hgt[i,] - cld_geo_dz[i,] - closeness_bot) < icing_alt[i], False) # keep = np.where(keep, (cld_top_hgt[i,] - cld_geo_dz[i,] - closeness_bot) < icing_alt[i], False)
keep = np.where(keep, (cld_top_hgt[i,] - max_depth) < icing_alt[i], False)
# # Test2 # # Test2
# keep = np.where(keep, # keep = np.where(keep,
...@@ -1147,6 +1150,8 @@ def apply_qc_no_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_ ...@@ -1147,6 +1150,8 @@ def apply_qc_no_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_
closeness_top = 100.0 # meters closeness_top = 100.0 # meters
closeness_bot = 200.0 closeness_bot = 200.0
max_depth = 3000.0
num_obs = len(icing_alt) num_obs = len(icing_alt)
cld_mask = cld_mask.reshape((num_obs, -1)) cld_mask = cld_mask.reshape((num_obs, -1))
cld_top_hgt = cld_top_hgt.reshape((num_obs, -1)) cld_top_hgt = cld_top_hgt.reshape((num_obs, -1))
...@@ -1178,7 +1183,8 @@ def apply_qc_no_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_ ...@@ -1178,7 +1183,8 @@ def apply_qc_no_icing_pireps(icing_alt, cld_top_hgt, cld_geo_dz, cld_phase, cld_
continue continue
keep = np.where(keep, (cld_top_hgt[i,] + closeness_top) > icing_alt[i], False) keep = np.where(keep, (cld_top_hgt[i,] + closeness_top) > icing_alt[i], False)
keep = np.where(keep, (cld_top_hgt[i,] - cld_geo_dz[i,] - closeness_bot) < icing_alt[i], False) # keep = np.where(keep, (cld_top_hgt[i,] - cld_geo_dz[i,] - closeness_bot) < icing_alt[i], False)
keep = np.where(keep, (cld_top_hgt[i,] - max_depth) < icing_alt[i], False)
# keep = np.where(keep, np.logical_and(bt_11um[i,] > 228.0, bt_11um[i,] < 273.0), False) # keep = np.where(keep, np.logical_and(bt_11um[i,] > 228.0, bt_11um[i,] < 273.0), False)
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment