diff --git a/modules/aeolus/aeolus_amv.py b/modules/aeolus/aeolus_amv.py index 9a7709239a72182fb71e81b8decfb530e88ebe2b..311e149a13fc1070681ae86c2216e60ee40b994c 100644 --- a/modules/aeolus/aeolus_amv.py +++ b/modules/aeolus/aeolus_amv.py @@ -419,6 +419,9 @@ def create_file(filename, aeolus_to_amv_dct, aeolus_dct, amv_files): var.units = u nc4_vars.append(var) + dist = rootgrp.createVariable('dist_to_prof', 'f4', ['amvs']) + dist.units = 'km' + 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']) @@ -447,11 +450,6 @@ def create_file(filename, aeolus_to_amv_dct, aeolus_dct, amv_files): i_b = i_a + namvs i_d = i_c + nlevs - param_nd = aeolus_to_amv_dct.get(key) - for pidx, param in enumerate(out_params): - nc4_vars[pidx][i_a:i_b] = param_nd[pidx, :] - i_a += namvs - prof_s = aeolus_dct.get(key) prof = prof_s[0] prf_hht[i_c:i_d] = prof[:, 3] @@ -460,8 +458,27 @@ def create_file(filename, aeolus_to_amv_dct, aeolus_dct, amv_files): prf_spd[i_c:i_d] = prof[:, 6] i_c += nlevs - prf_lat[idx::] = prof[0, 0] - prf_lon[idx::] = prof[0, 1] + plat = prof[0, 0] + plon = prof[0, 1] + prf_lat[idx::] = plat + prf_lon[idx::] = plon + + param_nd = aeolus_to_amv_dct.get(key) + for pidx, param in enumerate(out_params): + nc4_vars[pidx][i_a:i_b] = param_nd[pidx, :] + dist[i_a:i_b] = haversine_np(plon, plat, param_nd[0, :], param_nd[1, :]) + i_a += namvs + + # prof_s = aeolus_dct.get(key) + # prof = prof_s[0] + # prf_hht[i_c:i_d] = prof[:, 3] + # prf_hhb[i_c:i_d] = prof[:, 4] + # prf_azm[i_c:i_d] = prof[:, 5] + # prf_spd[i_c:i_d] = prof[:, 6] + # i_c += nlevs + # + # prf_lat[idx::] = prof[0, 0] + # prf_lon[idx::] = prof[0, 1] num_amvs_per_prof[:] = num_amvs num_levs_per_prof[:] = num_levs