Skip to content
Snippets Groups Projects
cws2__plot_cpr_vertical.pro 2.83 KiB
;+
;  plot cpr reflectance as a 2d-color plot
;  these procedure is used by other routines
;-
pro cws2::plot_cpr_vertical, _extra=_extra, ind=ind, position=position, charsize=charsize, show_lat=show_lat

  COMMON FEEDBACK, quiet, verbose, debug

  default, charsize, 1.

  if verbose then print,'... start cws2::plot_cpr_vertical'
  ; ATTENTION, THERE IS ALSO A plot_cpr_vertical FOR THE OBJECT cws_stats

  radar  = self->get_data(sen='CPR'     ,pro='RFL',/DATA)
  height = self->get_data(sen='CPR'     ,pro='HGT',/DATA)
  sfcbin = self->get_data(sen='CPR'     ,pro='SHB',/DATA)
  time   = self->get_data(pro='YDT',/DATA)
  lat    = self->get_data(prod='LAT',/data)

  cth_cpr =  self->get_data(sen='CPR', prod='CTH',/data)

  default, ind, indgen(n_elements(time))

  radar   = radar[*,ind]
  height  = height[*,ind]
  sfcbin  = sfcbin[ind]
  time    = time[ind]
  cth_cpr = cth_cpr[ind]

  for u=0, n_elements(sfcbin)-1 do radar[sfcbin[u]:*,u]= -999.

  h = REVERSE(FINDGEN(99)*0.25) + 0.5 ; this just for quicklook height bins starting 500 m above surfcae
  l = LINDGEN(N_ELEMENTS(ind))
   
  zind =(99-FINDGEN(99))  #  (FLTARR(N_ELEMENTS(sfcbin))+1)
  zind =(FLTARR(99)+1) #  (sfcbin-2)  - 2 - zind
  ;horizontal index
  lind =(FLTARR(99)+1) # FINDGEN(N_ELEMENTS(sfcbin)) 

  r = TRANSPOSE(radar[zind,lind])

  loadct, 34, ncolors=120

  tvlct, fsc_color('black',/triple), 0
  ;for pp=1,9 do tvlct,fsc_color('gray',/triple),pp

  ; position is passed here with _extra
  contour, 15<r>(-34), l, h,/FILL,c_colors=indgen(20)*6 , /color, NLEV=20, _EXTRA=_EXTRA, YRANGE=[0,20] $
    ,YSTY=5, XStyle=5, XRANGE=[MIN(l),MAX(l)], position=position $
    ,title=group, charsize=charsize, /norm, min_val=-34, max_val=16., levels=levels

  if not keyword_set(show_lat) then xyouts,0,-2,'CLOUDSAT CPR Reflectivity',charsize=0.5,col=fsc_color('black')
  oplot,height[sfcbin,indgen(n_elements(ind))]/1000.
   
  axis,yax=0,yrange=[0,20],  yticks=yticks, YSTY=1, ytitle='km', charsize=charsize
  axis,yax=1, yticks=yticks, ytickform='(A1)',yminor=1, charsize=charsize ; draw right y axis w/o labels.
  if keyword_set(show_lat) then begin
    axis,xaxis=0,charsize=charsize $
      , Xrange=[lat[ind[0]],lat[ind[n_elements(ind)-1]]],/xstyle $
      , xTitle='Latitude'; draw lower x axis w/o labels.
  endif else $
    axis,xax=0, xticks=1, xtickform='(A1)', xminor=1, charsize=charsize ; draw lower x axis w/o labels.
  axis,xax=1, xticks=1, xtickform='(A1)', xminor=1, charsize=charsize ; draw lower x axis w/o labels.

  pos_colorbar = [0.2,0.08,0.9,0.1]
  if n_elements(position) eq 4 then begin
    pos_colorbar[0] = position[0]  ; copy x0 position
    pos_colorbar[2] = position[2]  ; copy x1 position
  endif 
  colorbar, ncolors=120, pos=pos_colorbar, /norm, minrange=-34, maxRange=16, charsize=charsize

  if not keyword_set(show_lat) then xyouts,0.5,0.045,'dBZ',align=0.5,/normal,charsize=0.6
  
end