pro go_zonal_average, datelist, output_path common CPR_Freq, CPR_Occ_Grid, lat_vector, lon_vector, height_vector, dbz_vector, $ daytime_vector, Geoprof_occ_grid common count_cc_modis, count_cc_cloudless_global,count_cc_cloudy_global,count_cc_nc_global,$ count_modis_cloudy_top_global,count_modis_cloudless_top_global,count_modis_nc_top_global common global_frac_occ, raw_cc_frac,wt_cc_frac,raw_modis_frac,wt_modis_frac ;======================================================================= zonal_all_flag=1 zonal_day_flag=1 zonal_night_flag=1 zonal_avg_lat_flag=0 zonal_day_night_diff_flag=0 ;zonal_all_flag=1 ;zonal_avg_lat_flag=1 ;zonal_day_flag=1 ;zonal_night_flag=1 ;zonal_day_night_diff_flag=1 ; the first thing to do is look at the zonal average cloud occurrence fraction as a function of height. ;output dimensions will be lat and height ;----------------------- zonal_all_flag --------------------------; if zonal_all_flag eq 1 then begin lat_vector2=-90.0 dlat=1.25 ;dlat= 1.0 while max(lat_vector2) le 90. do lat_vector2=[lat_vector2,(max(lat_vector2))+(2.*dlat)] zonal_avg_freq=fltarr(n_elements(lat_vector2),n_elements(height_vector)) CPR_Occ_Grid_tot=fltarr(n_elements(lat_vector2),n_elements(height_vector)) CPR_Occ_Grid_dbz=fltarr(n_elements(lat_vector2),n_elements(height_vector)) for j=0,n_elements(lat_vector2)-1 do begin i=0 while lat_vector[i] le lat_vector2[j]-dlat and i lt n_elements(lat_vector)-2 do i=i+1 & lat_start_index=i while lat_vector[i] lt lat_vector2[j]+dlat and i lt n_elements(lat_vector)-2 do i=i+1 & lat_end_index=i for k=0,n_elements(height_vector)-1 do begin CPR_Occ_Grid_tot[j,k] = total(float(CPR_Occ_Grid[lat_start_index:lat_end_index,*,k,*,*])) CPR_Occ_Grid_dbz[j,k] = total(float(CPR_Occ_Grid[lat_start_index:lat_end_index,*,k, 1:n_elements(dbz_vector)-1, *])) if CPR_Occ_Grid_tot[j,k] ne 0 then begin zonal_avg_freq[j,k] = CPR_Occ_Grid_dbz[j,k] / CPR_Occ_Grid_tot[j,k] endif else begin zonal_avg_freq[j,k]=0.0 endelse endfor endfor common colors,r_orig,g_orig,b_orig,r_curr,g_curr,b_curr set_plot, 'z' ;device, set_resolution=[4000,2400] device, set_resolution=[1000,600];WINDOW, 1, XSIZE=1000, YSIZE=600,TITLE='1B CPR Zonal Avg' xl=0.1 & yl=0.2 & xr=0.90 & yr=0.95 ; upper right loadct, 4 & !p.multi=[0,2,2] & !p.charsize=1.5 r_curr[254:255]=255 & r_orig=r_curr g_curr[254:255]=255 & g_orig=g_curr b_curr[254:255]=255 & b_orig=b_curr !p.background=!d.n_colors-1 ;gamma_ct, 0.9, /current plot_2d_image_999_maxminin, zonal_avg_freq, lat_vector2, $ height_vector-0.5, n_elements(zonal_avg_freq[*,0]), n_elements(zonal_avg_freq[0,*]), $ 'CloudSat Zonal Average Cloud Occurrence ' + datelist[0] + '-' + datelist[n_elements(datelist)-1], $ 'Latitude', 'height (km)', [xl,yl,xr,yr], $ [xr+0.075,yl,+xr+0.085,yr], 'Frequency',0.65,0. tvlct, red, green,blue, /get write_gif, output_path+'all/RL_zonal_all_frequency_'+datelist[0]+'-'+datelist[n_elements(datelist)-1]+'.gif', $ tvrd();, red, green, blue write_2d_ncdf_zonal, output_path + "all/cdf/" + $ 'RL_zonal_all_frequency_'+datelist[0]+'-'+datelist[n_elements(datelist)-1]+'.cdf', $ zonal_avg_freq, CPR_Occ_Grid_tot, CPR_Occ_Grid_dbz, lat_vector2, height_vector-0.5 endif ; zonal_all_flag eq 1 ; ================================ ; ; zonal_day_flag ; ================================ ; if zonal_day_flag eq 1 then begin lat_vector2=-90.0 dlat=1.25 ;dlat= 1.0 while max(lat_vector2) le 90. do lat_vector2=[lat_vector2,(max(lat_vector2))+(2.*dlat)] zonal_avg_freq = fltarr(n_elements(lat_vector2),n_elements(height_vector)) CPR_Occ_Grid_tot = fltarr(n_elements(lat_vector2),n_elements(height_vector)) CPR_Occ_Grid_dbz = fltarr(n_elements(lat_vector2),n_elements(height_vector)) for j=0,n_elements(lat_vector2)-1 do begin i=0 while lat_vector[i] le lat_vector2[j]-dlat and i lt n_elements(lat_vector)-2 do i=i+1 & lat_start_index=i while lat_vector[i] lt lat_vector2[j]+dlat and i lt n_elements(lat_vector)-2 do i=i+1 & lat_end_index=i ; for k=0,n_elements(height_vector)-1 do begin ; if total(float(CPR_Occ_Grid[lat_start_index:lat_end_index,*,k,*,0])) ne 0 then begin ; zonal_avg_freq[j,k]=total(float(CPR_Occ_Grid[lat_start_index:lat_end_index,*,k,1:n_elements(dbz_vector)-1,0])) / $ ; total(float(CPR_Occ_Grid[lat_start_index:lat_end_index,*,k,*,0])) ; endif else begin ; zonal_avg_freq[j,k]=0.0 ; endelse ; endfor for k=0,n_elements(height_vector)-1 do begin CPR_Occ_Grid_tot[j,k] = total(float(CPR_Occ_Grid[lat_start_index:lat_end_index, *, k, *, 1])) CPR_Occ_Grid_dbz[j,k] = total(float(CPR_Occ_Grid[lat_start_index:lat_end_index, *, k, 1:n_elements(dbz_vector)-1, 1])) if CPR_Occ_Grid_tot[j,k] ne 0 then begin zonal_avg_freq[j,k] = CPR_Occ_Grid_dbz[j,k] / CPR_Occ_Grid_tot[j,k] endif else begin zonal_avg_freq[j,k]=0.0 endelse endfor endfor set_plot, 'z' device, set_resolution=[1000,600] ;WINDOW, 1, XSIZE=1000, YSIZE=600,TITLE='1B CPR Zonal Avg' xl=0.1 & yl=0.2 & xr=0.90 & yr=0.95 ; upper right loadct, 4 & !p.multi=[0,2,4] & !p.charsize=2.0 ;gamma_ct, 0.9, /current r_curr[254:255]=255 & r_orig=r_curr g_curr[254:255]=255 & g_orig=g_curr b_curr[254:255]=255 & b_orig=b_curr !p.background=!d.n_colors-1 plot_2d_image_999_maxminin, zonal_avg_freq, lat_vector2, $ height_vector-0.5, n_elements(zonal_avg_freq[*,0]), n_elements(zonal_avg_freq[0,*]), $ 'CloudSat Zonal Average Cloud Occurrence - Day '+datelist[0]+'-'+datelist[n_elements(datelist)-1], $ 'Latitude', 'height (km)', [xl,yl,xr,yr], $ [xr+0.055,yl,+xr+0.065,yr], 'Frequency',0.65,0. tvlct, red, green,blue, /get write_gif, output_path+'day/RL_zonal_Day_frequency_'+datelist[0]+'-'+datelist[n_elements(datelist)-1]+'.gif', $ tvrd() ;, red, green, blue write_2d_ncdf_zonal, output_path + "day/cdf/" + $ 'RL_zonal_Day_frequency_'+datelist[0]+'-'+datelist[n_elements(datelist)-1]+'.cdf', $ zonal_avg_freq, CPR_Occ_Grid_tot, CPR_Occ_Grid_dbz, lat_vector2, height_vector-0.5 endif ; zonal_day_flag eq 1 ; ================================== ; if zonal_night_flag eq 1 then begin lat_vector2=-90.0 dlat=1.25 ;dlat= 1.0 while max(lat_vector2) le 90. do lat_vector2=[lat_vector2,(max(lat_vector2))+(2.*dlat)] zonal_avg_freq = fltarr(n_elements(lat_vector2),n_elements(height_vector)) CPR_Occ_Grid_tot = fltarr(n_elements(lat_vector2),n_elements(height_vector)) CPR_Occ_Grid_dbz = fltarr(n_elements(lat_vector2),n_elements(height_vector)) for j=0,n_elements(lat_vector2)-1 do begin i=0 while lat_vector[i] le lat_vector2[j]-dlat and i lt n_elements(lat_vector)-2 do i=i+1 & lat_start_index=i while lat_vector[i] lt lat_vector2[j]+dlat and i lt n_elements(lat_vector)-2 do i=i+1 & lat_end_index=i ; for k=0,n_elements(height_vector)-1 do begin ; if total(float(CPR_Occ_Grid[lat_start_index:lat_end_index,*,k,*,1])) ne 0 then begin ; zonal_avg_freq[j,k]=total(float(CPR_Occ_Grid[lat_start_index:lat_end_index,*,k,1:n_elements(dbz_vector)-1,1]))/$ ; total(float(CPR_Occ_Grid[lat_start_index:lat_end_index,*,k,*,1])) ; endif else begin ; zonal_avg_freq[j,k]=0.0 ; endelse ; endfor for k=0,n_elements(height_vector)-1 do begin CPR_Occ_Grid_tot[j,k] = total(float(CPR_Occ_Grid[lat_start_index:lat_end_index, *, k, *, 0])) CPR_Occ_Grid_dbz[j,k] = total(float(CPR_Occ_Grid[lat_start_index:lat_end_index, *, k, 1:n_elements(dbz_vector)-1, 0])) if CPR_Occ_Grid_tot[j,k] ne 0 then begin zonal_avg_freq[j,k] = CPR_Occ_Grid_dbz[j,k] / CPR_Occ_Grid_tot[j,k] endif else begin zonal_avg_freq[j,k]=0.0 endelse endfor endfor set_plot, 'z' device, set_resolution=[1000,600] ;WINDOW, 1, XSIZE=1000, YSIZE=600,TITLE='1B CPR Zonal Avg' xl=0.1 & yl=0.2 & xr=0.90 & yr=0.95 ; upper right loadct, 4 & !p.multi=[0,2,4] & !p.charsize=2.0 r_curr[254:255]=255 & r_orig=r_curr g_curr[254:255]=255 & g_orig=g_curr b_curr[254:255]=255 & b_orig=b_curr !p.background=!d.n_colors-1 ;gamma_ct, 0.9, /current plot_2d_image_999_maxminin, zonal_avg_freq, lat_vector2, $ height_vector-0.5, n_elements(zonal_avg_freq[*,0]), n_elements(zonal_avg_freq[0,*]), $ 'CloudSat Zonal Average Cloud Occurrence - Night '+datelist[0]+'-'+datelist[n_elements(datelist)-1], 'Latitude', 'height (km)', [xl,yl,xr,yr], $ [xr+0.055,yl,+xr+0.065,yr], 'Frequency',0.65,0. tvlct, red, green,blue, /get write_gif, output_path+'ngt/RL_zonal_Night_frequency_'+datelist[0]+'-'+datelist[n_elements(datelist)-1]+'.gif', tvrd();, red, green, blue write_2d_ncdf_zonal, output_path + "ngt/cdf/" + $ 'RL_zonal_Night_frequency_'+datelist[0]+'-'+datelist[n_elements(datelist)-1]+'.cdf', $ zonal_avg_freq, CPR_Occ_Grid_tot, CPR_Occ_Grid_dbz, lat_vector2, height_vector-0.5 endif ; zonal_night_flag eq 1 ; ================================ ; ;----------------------- zonal_avg_lat_flag --------------------------; if zonal_avg_lat_flag eq 1 then begin lat_vector2=-90.0 ;dlat=1.25 dlat= 1.0 while max(lat_vector2) le 90. do lat_vector2=[lat_vector2,(max(lat_vector2))+(2.*dlat)] ;zonal_avg_freq=fltarr(n_elements(lat_vector2),n_elements(height_vector)) zonal_avg_freq = fltarr(n_elements(lat_vector2),n_elements(height_vector)) zzstr = [ 0, 0, 4, 7, 14] zzend = [20, 3, 6, 14, 20] nh = n_elements(zzstr) zonal_avg_freq_z = fltarr(n_elements(lat_vector2), nh) ;print, lat_vector2 ;print, height_vector for j=0, n_elements(lat_vector2)-1 do begin i=0 while lat_vector[i] le lat_vector2[j]-dlat and i lt n_elements(lat_vector)-2 do i=i+1 lat_start_index=i while lat_vector[i] lt lat_vector2[j]+dlat and i lt n_elements(lat_vector)-2 do i=i+1 lat_end_index=i for k=0, n_elements(height_vector)-1 do begin total_CPR_Occ_Grid = total(float(CPR_Occ_Grid[lat_start_index:lat_end_index,*,k,*,*])) if total_CPR_Occ_Grid ne 0 then begin total_CPR_Occ_Grid_aaa = total(float(CPR_Occ_Grid[lat_start_index:lat_end_index, $ *, k, 1:n_elements(dbz_vector)-1,*])) zonal_avg_freq[j,k] = total_CPR_Occ_Grid_aaa / total_CPR_Occ_Grid endif else begin zonal_avg_freq[j,k]=0.0 endelse ;zonal_avg_freq_z[j]=zonal_avg_freq_z[j] + zonal_avg_freq[j,k] endfor ; for k=0,n_elements(height_vector)-1 for h = 0, n_elements(zzstr)-1 do begin zonal_avg_freq_z[j, h] = 0 for k = zzstr[h], zzend[h] do begin zonal_avg_freq_z[j, h] = zonal_avg_freq_z[j, h] + zonal_avg_freq[j,k] endfor zonal_avg_freq_z[j, h] = zonal_avg_freq_z[j, h] / (zzend[h] - zzstr[h]) endfor endfor ; for j=0,n_elements(lat_vector2)-1 common colors,r_orig,g_orig,b_orig,r_curr,g_curr,b_curr set_plot, 'z' ;device, set_resolution=[4000,2400] device, set_resolution=[1000,600] ;WINDOW, 1, XSIZE=1000, YSIZE=600,TITLE='1B CPR Zonal Avg' xl=0.1 & yl=0.2 & xr=0.90 & yr=0.95 ; upper right loadct, 4 ;gamma_ct, 0.9, /current r_curr[254:255]=255 & r_orig=r_curr g_curr[254:255]=255 & g_orig=g_curr b_curr[254:255]=255 & b_orig=b_curr !p.background=!d.n_colors-1 !p.multi=[0,2,2] & !p.charsize=1.5 colArr = [0, 200, 100, 50, 0] plot, lat_vector2, zonal_avg_freq_z[*, 0], psym=-3, /nodata, $ xtitle='Latitude', ytitle='Zonally Averaged Coverage (%)', $ title='CloudSat/CALIPSO Zonal Cloud Cover', $ xrange=[-75.,75.], xstyle=1, $ yrange=[0.0,1.0], ystyle=1, $ color=colArr[0], thick=2, linestyle=0, $ pos=[0.1,0.3,0.9,0.9], charsize=1.5 oplot, lat_vector2, zonal_avg_freq_z[*, 1], color=colArr[1], thick=2, linestyle=2 oplot, lat_vector2, zonal_avg_freq_z[*, 2], color=colArr[2], thick=2, linestyle=1 oplot, lat_vector2, zonal_avg_freq_z[*, 3], color=colArr[3], thick=2, linestyle=3 oplot, lat_vector2, zonal_avg_freq_z[*, 4], color=colArr[4], thick=1, linestyle=0 xyouts, 10, 20, ' 0 < h < 3 km', color=colArr[1], /device xyouts, 10, 40, ' 3 < h < 6 km', color=colArr[2], /device xyouts, 10, 60, ' 6 < h < 14 km', color=colArr[3], /device xyouts, 10, 80, '14 < h < 20 km', color=colArr[4], /device ;tvlct, red, green,blue, /get write_gif, output_path+'RL_zonal_all_frequency_lat_'+datelist[0]+'-'+ $ datelist[n_elements(datelist)-1]+'.gif', tvrd();, red, green, blue ;write_2d_ncdf_contour, output_path+'RL_zonal_all_frequency_'+ $ ; datelist[0]+'-'+datelist[n_elements(datelist)-1]+'.cdf', $ ; zonal_avg_freq, lat_vector2, height_vector-0.5 endif ; zonal_avg_lat_flag eq 1 ; ================================== ; if zonal_day_night_diff_flag eq 1 then begin lat_vector2=-65. & dlat=2.0 while max(lat_vector2) le 65. do lat_vector2=[lat_vector2,(max(lat_vector2))+(2.*dlat)] zonal_avg_freq=fltarr(n_elements(lat_vector2),n_elements(height_vector)) for j=0,n_elements(lat_vector2)-1 do begin i=0 & while lat_vector[i] le lat_vector2[j]-dlat and i lt n_elements(lat_vector)-2 do i=i+1 & lat_start_index=i while lat_vector[i] lt lat_vector2[j]+dlat and i lt n_elements(lat_vector)-2 do i=i+1 & lat_end_index=i for k=0,n_elements(height_vector)-1 do begin if total(float(CPR_Occ_Grid[lat_start_index:lat_end_index,*,k,*,1])) ne 0 then begin day_freq=((total(float(CPR_Occ_Grid[lat_start_index:lat_end_index,*,k,1:n_elements(dbz_vector)-1,1])))/$ total(float(CPR_Occ_Grid[lat_start_index:lat_end_index,*,k,*,1]))) endif else begin day_freq=0.0 endelse if total(float(CPR_Occ_Grid[lat_start_index:lat_end_index,*,k,*,0])) ne 0 then begin night_freq=((total(float(CPR_Occ_Grid[lat_start_index:lat_end_index,*,k,1:n_elements(dbz_vector)-1,0])))/$ total(float(CPR_Occ_Grid[lat_start_index:lat_end_index,*,k,*,0]))) endif else begin night_freq=0.0 endelse zonal_avg_freq[j,k]=day_freq-night_freq endfor endfor set_plot, 'z' device, set_resolution=[1000,600] ;WINDOW, 1, XSIZE=1000, YSIZE=600,TITLE='1B CPR Zonal Avg' xl=0.1 & yl=0.2 & xr=0.90 & yr=0.95 ; upper right loadct, 4 & !p.multi=[0,2,4] & !p.charsize=2.0 r_curr[254:255]=255 & r_orig=r_curr g_curr[254:255]=255 & g_orig=g_curr b_curr[254:255]=255 & b_orig=b_curr !p.background=!d.n_colors-1 ;gamma_ct, 1.318, /current ;zonal_avg_freq[where(zonal_avg_freq eq 0.0)]=0.29 plot_2d_image_999_maxminin, zonal_avg_freq, lat_vector2, $ height_vector-0.5, n_elements(zonal_avg_freq[*,0]), n_elements(zonal_avg_freq[0,*]), $ 'CloudSat Zonal Average Cloud Occurrence - Day-Night Difference '+datelist[0]+'-'+datelist[n_elements(datelist)-1], 'Latitude', 'height (km)', [xl,yl,xr,yr], $ [xr+0.065,yl,+xr+0.075,yr], 'Frequency',0.25,-0.25 tvlct, red, green,blue, /get write_gif, output_path+'RL_zonal_Day-Night_Diff_frequency_'+datelist[0]+'-'+datelist[n_elements(datelist)-1]+'.gif', tvrd();, red, green, blue endif ; if zonal_day_night_diff_flag eq 1 then begin end