Skip to content
Snippets Groups Projects
Commit 3460dd72 authored by tomrink's avatar tomrink
Browse files

snapshot...

parent 7f9c1a30
Branches
No related tags found
No related merge requests found
......@@ -107,7 +107,7 @@ def match_calipso_clavrx_to_amvs(calipso_clavrx_path, calipso_clavrx_file, amv_f
match_dict[nom_time].append((cc, ll, lon_s[idx], lat_s[idx], f_idx, data_da, amvs_da))
return match_dict, calipso_clavrx_params, amv_files.get_out_parameters()
return match_dict, calipso_clavrx_params, amv_params
def create_file_new(match_dct, filename, caliop_clavrx_params, amv_params):
......@@ -157,8 +157,6 @@ def create_file_new(match_dct, filename, caliop_clavrx_params, amv_params):
# the top level group for the output file
rootgrp = Dataset(filename, 'w', format='NETCDF4')
#dim_aparams = rootgrp.createDimension('num_aeolus_params', size=num_aparams)
#dim_alevs = rootgrp.createDimension('max_num_aeolus_levels', size=max_num_alevels)
dim_amvs = rootgrp.createDimension('max_num_amvs', size=max_num_amvs)
dim_num_aeolus_prof = rootgrp.createDimension('num_caliop_profs', size=num_aprofs)
#dim_num_files = rootgrp.createDimension('num_amv_files', size=amv_file_s.shape[0])
......@@ -166,7 +164,7 @@ def create_file_new(match_dct, filename, caliop_clavrx_params, amv_params):
prf_time = rootgrp.createVariable('time', 'f4', ['num_caliop_profs'])
#amv_file_names = rootgrp.createVariable('amv_file_names', str, ['num_amv_files'])
# ---- Profile variables ---------------
# ---- CALIOP variables ---------------
prf_lon = rootgrp.createVariable('prof_longitude', 'f4', ['num_caliop_profs'])
prf_lon.units = 'degrees east'
prf_lat = rootgrp.createVariable('prof_latitude', 'f4', ['num_caliop_profs'])
......@@ -174,7 +172,7 @@ def create_file_new(match_dct, filename, caliop_clavrx_params, amv_params):
prf_time.units = 'seconds since 1970-01-1 00:00:00'
prf_elem = rootgrp.createVariable('FD_elem', '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'])
# ----- CALIOP+CLAVRx variables ------
nc4_vars_cc = []
......@@ -193,6 +191,14 @@ def create_file_new(match_dct, filename, caliop_clavrx_params, amv_params):
nc4_vars_cc.append(var)
# ----- AMV variables ----------------
amv_lon = rootgrp.createVariable('amv_longitude', 'f4', ['num_caliop_profs', 'max_num_amvs'])
amv_lon.units = 'degrees east'
amv_lat = rootgrp.createVariable('amv_latitude', 'f4', ['num_caliop_profs', 'max_num_amvs'])
amv_lat.units = 'degrees north'
amv_elem = rootgrp.createVariable('amv_elem', 'f4', ['num_caliop_profs', 'max_num_amvs'])
amv_line = rootgrp.createVariable('amv_line', 'f4', ['num_caliop_profs', 'max_num_amvs'])
#prf_fidx = rootgrp.createVariable('amv_file_index', 'i4', ['num_caliop_profs'])
nc4_vars = []
var_s = rg_exmpl.variables
for pidx, param in enumerate(amv_params):
......@@ -214,7 +220,7 @@ def create_file_new(match_dct, filename, caliop_clavrx_params, amv_params):
prf_elem[:] = elems
prf_line[:] = lines
prf_time[:] = atimes
prf_fidx[:] = fidxs
#prf_fidx[:] = fidxs
#amv_file_names[:] = amv_file_s
......@@ -229,6 +235,22 @@ def create_file_new(match_dct, filename, caliop_clavrx_params, amv_params):
nda = data_nd[pidx]
nc4_vars_cc[pidx][idx] = nda
nda = amvs_nd[0,]
cnt = nda.shape[0]
amv_lon[idx, 0:cnt] = nda
nda = amvs_nd[1,]
cnt = nda.shape[0]
amv_lat[idx, 0:cnt] = nda
nda = amvs_nd[2,]
cnt = nda.shape[0]
amv_elem[idx, 0:cnt] = nda
nda = amvs_nd[3,]
cnt = nda.shape[0]
amv_line[idx, 0:cnt] = nda
for pidx, param in enumerate(amv_params):
nda = amvs_nd[pidx+4,]
cnt = nda.shape[0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment