Skip to content
Snippets Groups Projects
Commit 08e862ff authored by rink's avatar rink
Browse files

add on/off for checking wind error estimate

parent 97212be8
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ print(files)
nfile = len(files)
allobs = 0
wind_err_thresh = 50
check_wind_err = True
f66=open('./ray1day.out', 'w+')
f60=open('./mie1day.out', 'w+')
......@@ -117,41 +118,41 @@ for n, filename in enumerate(files):
mie_azimuth = zeros(rid.shape)
mie_err = zeros(rid.shape)
mie_hhh = zeros(rid.shape)
mie_hht = zeros(rid.shape)
mie_hhb = zeros(rid.shape)
mie_wind = zeros(rid.shape)
mie_hhh = zeros(rid.shape)
mie_hht = zeros(rid.shape)
mie_hhb = zeros(rid.shape)
mie_wind = zeros(rid.shape)
# mie_pppp = zeros(rid.shape) #klukens
mie_valid = zeros(rid.shape)
mie_length = zeros(rid.shape)
mie_sratio = zeros(rid.shape)
mie_valid = zeros(rid.shape)
mie_length = zeros(rid.shape)
mie_sratio = zeros(rid.shape)
# mie_snr = zeros(rid.shape)
# wind m/s,
mie_wind[rid !=0] = mie_wind0[rid[rid !=0]-1]*0.01
mie_azimuth[rid !=0] = mie_azimuth0[rid[rid !=0]-1]*1.0
mie_wind[rid != 0] = mie_wind0[rid[rid != 0]-1]*0.01
mie_azimuth[rid != 0] = mie_azimuth0[rid[rid != 0]-1]*1.0
mie_valid[rid !=0] = mie_valid0[rid[rid !=0]-1]
mie_valid[rid != 0] = mie_valid0[rid[rid != 0]-1]
# length in km output
mie_length[rid !=0] = mie_length0[rid[rid !=0]-1]*0.001
mie_length[rid != 0] = mie_length0[rid[rid != 0]-1]*0.001
# mie_pppp[rid !=0] = mie_pppp0[rid[rid !=0]-1]*0.01 #klukens
# wind error m/s
mie_err[rid !=0] = mie_err0[rid[rid !=0]-1]*1.0
mie_err[rid != 0] = mie_err0[rid[rid != 0]-1]*1.0
# mie_snr [rid !=0] = mie_snr0 [rid[rid !=0]-1]*1.0
# height in (km)
# add 250m shift to the height for this version of L2B data
mie_hhh[rid !=0] = mie_alt0[rid[rid !=0]-1] *0.001+0.25
mie_hhh[rid != 0] = mie_alt0[rid[rid != 0]-1] * 0.001+0.25
mie_hht[rid !=0] = mie_altt[rid[rid !=0]-1] *0.001 +0.25
mie_hhb[rid !=0] = mie_altb[rid[rid !=0]-1] *0.001 +0.25
mie_hht[rid != 0] = mie_altt[rid[rid != 0]-1] * 0.001 + 0.25
mie_hhb[rid != 0] = mie_altb[rid[rid != 0]-1] * 0.001 + 0.25
latrid = coda.fetch(product, 'mie_profile',-1, 'Profile_lat_average')
lonrid = coda.fetch(product, 'mie_profile',-1, 'Profile_lon_average')
sstime = coda.fetch(product, 'mie_profile',-1, 'Profile_DateTime_Average')
latrid = coda.fetch(product, 'mie_profile',-1, 'Profile_lat_average')
lonrid = coda.fetch(product, 'mie_profile',-1, 'Profile_lon_average')
sstime = coda.fetch(product, 'mie_profile',-1, 'Profile_DateTime_Average')
for i in range(nprofm):
timestep = datetime.datetime(2000, 1, 1)+datetime.timedelta(seconds=sstime[i])
......@@ -160,24 +161,34 @@ for n, filename in enumerate(files):
dd = timestep.strftime('%d')
hh = timestep.strftime('%H')
min = timestep.strftime('%M')
sec = timestep.strftime('%S') #klukens
sec = timestep.strftime('%S') # klukens
totlevs = numpy.sum(logical_and(mie_valid[i, :] > 0, logical_and(rid[i, :] > 0, mie_err[i, :] < wind_err_thresh)))
if check_wind_err:
totlevs = numpy.sum(logical_and(mie_valid[i, :] > 0, logical_and(rid[i, :] > 0, mie_err[i, :] < wind_err_thresh)))
else:
totlevs = numpy.sum(logical_and(mie_valid[i, :] > 0, rid[i, :] > 0))
if totlevs > 0:
if typ_id[i] == 1:
# cloudy type Mie winds
if typ_id[i] == 1: # cloudy type Mie winds
print(yyyy, mm, dd, hh, min, sec, '%7.2f %7.2f %2i' % (float(lonrid[i]), float(latrid[i]), int(totlevs)), file=f60)
for m in range(nlevm):
# keep consistent with the lines of totlevs above !!!
if rid[i, m] > 0:
if mie_err[i, m] < wind_err_thresh:
if mie_valid[i, m] > 0.0:
print('%2i %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f' % (int(m+1),
mie_hhh[i,m], mie_hht[i,m], mie_hhb[i,m], mie_err[i,m],
mie_azimuth[i,m], mie_wind[i,m], mie_length[i,m]), file=f60)
if check_wind_err:
for m in range(nlevm):
# keep consistent with the lines of totlevs above !!!
if rid[i, m] > 0:
if mie_err[i, m] < wind_err_thresh:
if mie_valid[i, m] > 0.0:
print('%2i %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f' % (int(m+1),
mie_hhh[i,m], mie_hht[i,m], mie_hhb[i,m], mie_err[i,m],
mie_azimuth[i,m], mie_wind[i,m], mie_length[i,m]), file=f60)
else:
for m in range(nlevm):
if rid[i, m] > 0:
if mie_valid[i, m] > 0.0:
print('%2i %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f' % (int(m+1),
mie_hhh[i,m], mie_hht[i,m], mie_hhb[i,m], mie_err[i,m],
mie_azimuth[i,m], mie_wind[i,m], mie_length[i,m]), file=f60)
# -----------------------------------------------
......@@ -202,24 +213,23 @@ for n, filename in enumerate(files):
# NOTE: i = 0 - nprof-1 in the xrange FUNTION of PYTHON
#-----------------------------------------------------------------
ray_azimuth = zeros(rid.shape)
ray_err = zeros(rid.shape)
wind_sens_T = zeros(rid.shape)
wind_sens_P = zeros(rid.shape)
ray_length = zeros(rid.shape)
ray_valid = zeros(rid.shape)
ref_temp = zeros(rid.shape)
ref_pppp = zeros(rid.shape)
ray_azimuth = zeros(rid.shape)
ray_err = zeros(rid.shape)
wind_sens_T = zeros(rid.shape)
wind_sens_P = zeros(rid.shape)
ray_length = zeros(rid.shape)
ray_valid = zeros(rid.shape)
ref_temp = zeros(rid.shape)
ref_pppp = zeros(rid.shape)
ray_hhh = zeros(rid.shape)
ray_hht = zeros(rid.shape)
ray_hhb = zeros(rid.shape)
ray_wind = zeros(rid.shape)
ray_sratio = zeros(rid.shape)
ray_wind = zeros(rid.shape)
ray_sratio = zeros(rid.shape)
ray_wind[rid !=0] = rayleigh_wind0[rid[rid !=0]-1]*0.01
ray_azimuth[rid !=0] = rayleigh_azimuth0[rid[rid !=0]-1]*1.0
ray_sratio [rid !=0] = rayleigh_sratio0[rid[rid !=0]-1]*1.0
ray_wind[rid != 0] = rayleigh_wind0[rid[rid != 0]-1]*0.01
ray_azimuth[rid != 0] = rayleigh_azimuth0[rid[rid != 0]-1]*1.0
ray_sratio [rid != 0] = rayleigh_sratio0[rid[rid != 0]-1]*1.0
# print(rayleigh_wind0.shape)
# print(rid.shape)
......@@ -228,24 +238,24 @@ for n, filename in enumerate(files):
#
# wind error m/s
ray_err[rid !=0] = rayleigh_err0[rid[rid !=0]-1]*1.0
ray_err[rid != 0] = rayleigh_err0[rid[rid != 0]-1]*1.0
# m/s/K
wind_sens_T[rid !=0] = rayleigh_wind_to_T[rid[rid !=0]-1]*0.01
wind_sens_T[rid != 0] = rayleigh_wind_to_T[rid[rid != 0]-1]*0.01
# K
ref_temp[rid !=0] = rayleigh_temp[rid[rid !=0]-1]
ref_pppp[rid !=0] = rayleigh_pppp[rid[rid !=0]-1]*0.01
ref_temp[rid != 0] = rayleigh_temp[rid[rid != 0]-1]
ref_pppp[rid != 0] = rayleigh_pppp[rid[rid != 0]-1]*0.01
# cm/s/hPa
wind_sens_P[rid !=0] = rayleigh_wind_to_P[rid[rid !=0]-1] *1.0e-4
ray_length[rid !=0] = ray_length0[rid[rid !=0]-1] *0.001
ray_valid[rid !=0] = rayleigh_valid0[rid[rid !=0]-1]
wind_sens_P[rid != 0] = rayleigh_wind_to_P[rid[rid !=0]-1] * 1.0e-4
ray_length[rid != 0] = ray_length0[rid[rid != 0]-1] * 0.001
ray_valid[rid != 0] = rayleigh_valid0[rid[rid != 0]-1]
# height in (km)
# add 250m shift to the height for this version of L2B data
ray_hhh[rid !=0] = rayleigh_alt0[rid[rid !=0]-1] *0.001 +0.25
ray_hht[rid !=0] = rayleigh_altt[rid[rid !=0]-1] *0.001 +0.25
ray_hhb[rid !=0] = rayleigh_altb[rid[rid !=0]-1] *0.001 +0.25
ray_hhh[rid != 0] = rayleigh_alt0[rid[rid != 0]-1] * 0.001 + 0.25
ray_hht[rid != 0] = rayleigh_altt[rid[rid != 0]-1] * 0.001 + 0.25
ray_hhb[rid != 0] = rayleigh_altb[rid[rid != 0]-1] * 0.001 + 0.25
latrid =coda.fetch(product, 'rayleigh_profile',-1, 'Profile_lat_average')
lonrid =coda.fetch(product, 'rayleigh_profile',-1, 'Profile_lon_average')
......@@ -260,14 +270,10 @@ for n, filename in enumerate(files):
min = timestep.strftime('%M')
sec = timestep.strftime('%S') #klukens
totlevs = 0
for m in range(nlev):
if rid[i, m] > 0:
if ray_err[i,m] < wind_err_thresh:
if ray_valid[i, m] > 0.0:
totlevs = totlevs + 1
totlevs = numpy.sum(logical_and(ray_valid[i, :] > 0, logical_and(rid[i, :] > 0, ray_err[i, :] < wind_err_thresh)))
if check_wind_err:
totlevs = numpy.sum(logical_and(ray_valid[i, :] > 0, logical_and(rid[i, :] > 0, ray_err[i, :] < wind_err_thresh)))
else:
totlevs = numpy.sum(logical_and(ray_valid[i, :] > 0, rid[i, :] > 0))
# for clear sky Rayleigh winds ----------
if totlevs > 0:
......@@ -275,16 +281,26 @@ for n, filename in enumerate(files):
print(yyyy, mm, dd, hh, min, sec, '%7.2f %7.2f %2i' % (float(lonrid[i]), float(latrid[i]), int(totlevs)), file=f66)
for m in range(nlev):
# keep consistent with the lines of totlevs above !!!
if rid[i, m] > 0:
if ray_err[i,m] < wind_err_thresh:
if ray_valid[i, m] > 0.0:
print('%2i %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f'
% (int(m+1), ray_hhh[i,m], ray_hht[i,m], ray_hhb[i,m],
ray_err[i,m], ray_azimuth[i,m], ray_wind[i,m],
ref_temp[i,m]*0.01, ref_pppp[i,m], wind_sens_T[i,m],
wind_sens_P[i,m], ray_sratio [i,m], ray_length[i,m]), file=f66)
if check_wind_err:
for m in range(nlev):
# keep consistent with the lines of totlevs above !!!
if rid[i, m] > 0:
if ray_err[i, m] < wind_err_thresh:
if ray_valid[i, m] > 0.0:
print('%2i %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f'
% (int(m+1), ray_hhh[i,m], ray_hht[i,m], ray_hhb[i,m],
ray_err[i,m], ray_azimuth[i,m], ray_wind[i,m],
ref_temp[i,m]*0.01, ref_pppp[i,m], wind_sens_T[i,m],
wind_sens_P[i,m], ray_sratio [i,m], ray_length[i,m]), file=f66)
else:
for m in range(nlev):
if rid[i, m] > 0:
if ray_valid[i, m] > 0.0:
print('%2i %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f'
% (int(m + 1), ray_hhh[i, m], ray_hht[i, m], ray_hhb[i, m],
ray_err[i, m], ray_azimuth[i, m], ray_wind[i, m],
ref_temp[i, m] * 0.01, ref_pppp[i, m], wind_sens_T[i, m],
wind_sens_P[i, m], ray_sratio[i, m], ray_length[i, m]), file=f66)
coda.close(product)
......
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