Skip to content
Snippets Groups Projects
Commit 6862b3da authored by tomrink's avatar tomrink
Browse files

snapshot...

parent 7d2f324d
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,7 @@ def get_search_box(cc, ll): ...@@ -29,7 +29,7 @@ def get_search_box(cc, ll):
return c_rng, l_rng return c_rng, l_rng
def match_calipso_clavrx_to_amvs(calipso_clavrx_ds, calipso_clavrx_file, amv_files, amv_source='OPS', band='14'): def match_calipso_clavrx_to_amvs(calipso_clavrx_ds, calipso_clavrx_file, amv_files):
nav = amv_files.get_navigation() nav = amv_files.get_navigation()
amv_params = amv_files.get_parameters() amv_params = amv_files.get_parameters()
all_params = [amv_files.lon_name, amv_files.lat_name, amv_files.elem_name, amv_files.line_name] + amv_params all_params = [amv_files.lon_name, amv_files.lat_name, amv_files.elem_name, amv_files.line_name] + amv_params
...@@ -37,8 +37,6 @@ def match_calipso_clavrx_to_amvs(calipso_clavrx_ds, calipso_clavrx_file, amv_fil ...@@ -37,8 +37,6 @@ def match_calipso_clavrx_to_amvs(calipso_clavrx_ds, calipso_clavrx_file, amv_fil
coords = {'num_params': all_params} coords = {'num_params': all_params}
dims = ['num_params', 'num_amvs'] dims = ['num_params', 'num_amvs']
#calipso_clavrx_ds = CLAVRx_CALIPSO(calipso_clavrx_path)
nom_time = calipso_clavrx_ds.get_datetime(calipso_clavrx_file).timestamp() nom_time = calipso_clavrx_ds.get_datetime(calipso_clavrx_file).timestamp()
calipso_clavrx_nc4 = Dataset(calipso_clavrx_file) calipso_clavrx_nc4 = Dataset(calipso_clavrx_file)
...@@ -118,6 +116,7 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params): ...@@ -118,6 +116,7 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params):
elems = [] elems = []
lines = [] lines = []
fidxs = [] fidxs = []
amvs_cnt = []
#amv_file_s = np.array(amv_file_s, dtype='object') #amv_file_s = np.array(amv_file_s, dtype='object')
...@@ -136,6 +135,7 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params): ...@@ -136,6 +135,7 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params):
amvs = tup[6] amvs = tup[6]
num_amvs = amvs.shape[1] num_amvs = amvs.shape[1]
amvs_cnt.append(num_amvs)
if num_amvs > max_num_amvs: if num_amvs > max_num_amvs:
max_num_amvs = num_amvs max_num_amvs = num_amvs
...@@ -145,6 +145,7 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params): ...@@ -145,6 +145,7 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params):
elems = np.array(elems) elems = np.array(elems)
lines = np.array(lines) lines = np.array(lines)
fidxs = np.array(fidxs) fidxs = np.array(fidxs)
amvs_cnt = np.array(amvs_cnt)
# Sample file to retrieve and copy variable attributes # Sample file to retrieve and copy variable attributes
# rg_exmpl = Dataset('/ships19/cloud/scratch/4TH_AMV_INTERCOMPARISON/FMWK2_AMV/GOES16_ABI_2KM_FD_2019293_0020_34_WINDS_AMV_EN-14CT.nc', 'r') # rg_exmpl = Dataset('/ships19/cloud/scratch/4TH_AMV_INTERCOMPARISON/FMWK2_AMV/GOES16_ABI_2KM_FD_2019293_0020_34_WINDS_AMV_EN-14CT.nc', 'r')
...@@ -172,6 +173,8 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params): ...@@ -172,6 +173,8 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params):
prf_line = rootgrp.createVariable('FD_line', 'f4', ['num_caliop_profs']) prf_line = rootgrp.createVariable('FD_line', 'f4', ['num_caliop_profs'])
#prf_fidx = rootgrp.createVariable('amv_file_index', 'i4', ['num_caliop_profs']) #prf_fidx = rootgrp.createVariable('amv_file_index', 'i4', ['num_caliop_profs'])
amvs_cnt_var = rootgrp.createVariable('num_amvs_per_match', 'i4', ['num_caliop_profs'])
# ----- CALIOP+CLAVRx variables ------ # ----- CALIOP+CLAVRx variables ------
nc4_vars_cc = [] nc4_vars_cc = []
var_s = caliop_clavrx_exmpl.variables var_s = caliop_clavrx_exmpl.variables
...@@ -218,6 +221,7 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params): ...@@ -218,6 +221,7 @@ def create_file(match_dct, filename, caliop_clavrx_params, amv_params):
prf_elem[:] = elems prf_elem[:] = elems
prf_line[:] = lines prf_line[:] = lines
prf_time[:] = atimes prf_time[:] = atimes
amvs_cnt_var[:] = amvs_cnt
#prf_fidx[:] = fidxs #prf_fidx[:] = fidxs
#amv_file_names[:] = amv_file_s #amv_file_names[:] = amv_file_s
...@@ -272,36 +276,3 @@ def run_caliop_clavrx_amv_match(output_file, path_to_caliop_clavrx, path_to_amvs ...@@ -272,36 +276,3 @@ def run_caliop_clavrx_amv_match(output_file, path_to_caliop_clavrx, path_to_amvs
create_file(match_dict, output_file, caliop_clavrx_params, amv_params) create_file(match_dict, output_file, caliop_clavrx_params, amv_params)
# def run_clavrx_to_aeolus_match(aeolus_files_dir, clvrx_files_dir, outfile, chan='mie'):
# if os.path.isdir(aeolus_files_dir):
# a_dct = get_aeolus_time_dict_s(aeolus_files_dir, chan=chan)
# else:
# a_dct = get_aeolus_time_dict(aeolus_files_dir)
#
# a_dct = time_dict_to_nd(a_dct)
# clvrx_files = CLAVRx(clvrx_files_dir)
# m_d = match_aeolus_to_clavrx(a_dct, clvrx_files)
# create_aeolus_clavrx_match_file(m_d, outfile, clvrx_files.get_parameters(), clvrx_files.flist)
#
#
# # aeolus_files_dir: S4 NOAA txt output files
# # amv_files_dir: G16/17 AMV product files
# # outfile: pathname for the Netcdf match file
# def create_amv_to_aeolus_match_file(aeolus_files_dir, amv_files_dir, outfile, amv_source='OPS', band='14', chan='mie'):
#
# if os.path.isdir(aeolus_files_dir):
# a_d = get_aeolus_time_dict_s(aeolus_files_dir, chan=chan)
# else:
# a_d = get_aeolus_time_dict(aeolus_files_dir)
# a_d = time_dict_to_nd(a_d)
#
# amv_files = None
# if amv_source == 'CARR':
# amv_files = get_datasource(amv_files_dir, 'CARR', file_time_span=60, band=band)
# else:
# amv_files = get_datasource(amv_files_dir, amv_source, band=band)
#
# m_d = match_amvs_to_aeolus_fast(a_d, amv_files_dir, amv_source, band, amv_files)
#
# create_file_new(m_d, outfile, amv_files.get_parameters(), amv_files.flist)
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