Skip to content
Snippets Groups Projects
Commit 4e3f795d authored by rink's avatar rink
Browse files

remove dead code

parent 2faf1cbf
No related branches found
No related tags found
No related merge requests found
...@@ -270,168 +270,6 @@ def get_cloud_layers_dict(filename, lon360=False): ...@@ -270,168 +270,6 @@ def get_cloud_layers_dict(filename, lon360=False):
return cld_lyr_dct return cld_lyr_dct
# def get_search_box(nav, lon, lat):
# cc, ll = nav.earth_to_lc(lon, lat)
#
# c_rng = [cc - half_width, cc + half_width]
# l_rng = [ll - half_width, ll + half_width]
#
# if c_rng[0] < 0:
# c_rng[0] = 0
#
# if l_rng[0] < 0:
# l_rng[0] = 0
#
# if c_rng[1] >= num_elems:
# c_rng[1] = num_elems - 1
#
# if l_rng[1] >= num_lines:
# l_rng[1] = num_lines - 1
#
# return c_rng, l_rng
#
#
# # aeolus_dict: time -> profiles
# # amv_files_path: directory containing AMVs, '/home/user/amvdir/'
# # return dict: aeolus time -> tuple (amv_lon, amv_lat, amv_pres, amv_spd, amv_dir)
# def match_amvs_to_aelous(aeolus_dict, amv_files_path):
# nav = GEOSNavigation()
# match_dict = {}
#
# keys = list(aeolus_dict.keys())
#
# last_f_idx = -1
# for key in keys:
# fname, ftime, f_idx = get_file_containing_time(key, amv_files_path, get_datetime_3, 60)
# if f_idx is None:
# continue
# profs = aeolus_dict.get(key)
# layers = profs[0]
# if layers is None:
# continue
#
# lat = layers[0, 0]
# lon = layers[0, 1]
# # check range
# if lat > G16_lat_range[1] or lat < G16_lat_range[0]:
# continue
# if lon > G16_lon_range[1] or lon < G16_lon_range[0]:
# continue
# # ------------------------------------------------
#
# if f_idx != last_f_idx:
# last_f_idx = f_idx
# ds = Dataset(fname)
# amv_lons = ds['Longitude'][:]
# amv_lats = ds['Latitude'][:]
# amv_spd = ds['Wind_Speed'][:]
# amv_dir = ds['Wind_Dir'][:]
# amv_pres = ds['MedianPress'][:]
# cc = ds['Element'][:]
# ll = ds['Line'][:]
# # cc, ll = nav.earth_to_lc_s(amv_lons, amv_lats)
# ds.close()
#
# c_rng, l_rng = get_search_box(nav, lon, lat)
#
# in_cc = np.logical_and(cc > c_rng[0], cc < c_rng[1])
# in_ll = np.logical_and(ll > l_rng[0], ll < l_rng[1])
# in_box = np.logical_and(in_cc, in_ll)
#
# num_amvs = np.sum(in_box)
# if num_amvs == 0:
# continue
# match_dict[key] = (amv_lons[in_box], amv_lats[in_box], amv_pres[in_box], amv_spd[in_box], amv_dir[in_box])
#
# return match_dict
#
#
# # full path as string filename to create, '/home/user/newfilename'
# # aeolus_to_amv_dct: output from match_amvs_to_aeolus
# # aeolus_dct: output from get_aeolus_time_dict
# def create_file(filename, aeolus_to_amv_dct, aeolus_dct):
# keys = list(aeolus_to_amv_dct.keys())
#
# num_amvs = []
# num_levs = []
# times = []
#
# namvs = 0
# nlevs = 0
# for key in keys:
# lons, lats, pres, spd, dir = aeolus_to_amv_dct.get(key)
# num_amvs.append(len(lons))
# namvs += len(lons)
#
# prof_s = aeolus_dct.get(key)
# prof = prof_s[0]
# num_levs.append(prof.shape[0])
# nlevs += prof.shape[0]
#
# times.append(key)
#
# amv_per_alus = len(aeolus_to_amv_dct)
# rootgrp = Dataset(filename, 'w', format='NETCDF4')
# dim_amvs = rootgrp.createDimension('amvs', size=namvs)
# dim_alus = rootgrp.createDimension('profs', size=nlevs)
# dim_num_aeolus_prof = rootgrp.createDimension('num_aeolus_profs', size=len(aeolus_to_amv_dct))
#
# amv_lon = rootgrp.createVariable('amv_longitude', 'f4', ['amvs'])
# amv_lon.units = 'degrees east'
# amv_lat = rootgrp.createVariable('amv_latitude', 'f4', ['amvs'])
# amv_lat.units = 'degrees north'
# amv_spd = rootgrp.createVariable('amv_spd', 'f4', ['amvs'])
# amv_spd.units = 'm s-1'
# amv_dir = rootgrp.createVariable('amv_dir', 'f4', ['amvs'])
# amv_dir.units = 'degree'
# amv_pres = rootgrp.createVariable('amv_pres', 'f4', ['amvs'])
# amv_pres.units = 'hPa'
#
# num_amvs_per_prof = rootgrp.createVariable('num_amvs_per_prof', 'i4', ['num_aeolus_profs'])
# num_levs_per_prof = rootgrp.createVariable('num_levs_per_prof', 'i4', ['num_aeolus_profs'])
# prof_time = rootgrp.createVariable('time', 'f4', ['num_aeolus_profs'])
# prof_time.units = 'seconds since 1970-01-1 00:00:00'
#
# prf_azm = rootgrp.createVariable('prof_azm', 'f4', ['profs'])
# prf_azm.units = 'degree'
# prf_spd = rootgrp.createVariable('prof_spd', 'f4', ['profs'])
# prf_spd.units = 'm s-1'
# prf_hht = rootgrp.createVariable('prof_hht', 'f4', ['profs'])
# prf_hht.units = 'meter'
# prf_hhb = rootgrp.createVariable('prof_hhb', 'f4', ['profs'])
# prf_hhb.units = 'meter'
#
# i_a = 0
# i_c = 0
# for idx, key in enumerate(keys):
# namvs = num_amvs[idx]
# nlevs = num_levs[idx]
# i_b = i_a + namvs
# i_d = i_c + nlevs
#
# lons, lats, pres, spd, dir = aeolus_to_amv_dct.get(key)
# amv_lon[i_a:i_b] = lons[:]
# amv_lat[i_a:i_b] = lats[:]
# amv_spd[i_a:i_b] = spd[:]
# amv_dir[i_a:i_b] = dir[:]
# amv_pres[i_a:i_b] = pres[:]
# i_a += namvs
#
# prof_s = aeolus_dct.get(key)
# prof = prof_s[0]
# prf_hht[i_c:i_d] = prof[:, 2]
# prf_hhb[i_c:i_d] = prof[:, 3]
# prf_azm[i_c:i_d] = prof[:, 5]
# prf_spd[i_c:i_d] = prof[:, 6]
# i_c += nlevs
#
# num_amvs_per_prof[:] = num_amvs
# num_levs_per_prof[:] = num_levs
# prof_time[:] = times
#
# rootgrp.close()
def compare_aeolus_max_height(aeolus_dict, files_path, grid_value_name='cld_height_acha', one_cld_layer_only=False, highest_layer=False): def compare_aeolus_max_height(aeolus_dict, files_path, grid_value_name='cld_height_acha', one_cld_layer_only=False, highest_layer=False):
if files_path is not None: if files_path is not None:
f_list = glob.glob(files_path + '*.nc') f_list = glob.glob(files_path + '*.nc')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment