; This file contains routines for mapping data to colors. ; ; When adding a new field, three routines must be modified. Each routine ; contains a case statement which selects by radar field, and which must be ; modified to include the new field. The routines and modifications are as ; follows: ; ; Routine Modification ; ; rsl_loadcolortable Add color table for the new field. ; ; rsl_mapcolors Add the algorithm for mapping the data to color table ; indexes. ; ; rsl_colorbar (In file rsl_colorbar.pro). Add the labels and units for ; the color bar. ; ;***************************************************************************** ;*****************************; ; rsl_mapcolors ; ;*****************************; function rsl_mapcolors, ray, field ; This function takes the data from a ray and converts it to indexes to the ; color table. It returns the indexes in an array of size nbins. ; If an error occurs, the function returns -1. compile_opt hidden coloray = -1 if ray.h.nbins eq 0 then goto, finished range = ray.range[0:ray.h.nbins-1] nyquist = ray.h.nyq_vel ;stop ;print,ray.h.azimuth fieldtype = field if field eq 'ZT' or field eq 'CZ' then fieldtype = 'DZ' ;if field eq 'ZD' then fieldtype = 'DR' ;STOP case fieldtype of 'DZ': begin maxval = 65. minval = 0. color_bin_size = 5. ; dBZ ncolors = (maxval - minval) / color_bin_size + 1. ncolors = ncolors + 2 ; include indexes for out-of-bounds colors. below_minval_color = 1 above_maxval_color = ncolors color_offset = 2. ; 0 is reserved for black, 1 for below-minval color. coloray = long(range/color_bin_size + color_offset) s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = above_maxval_color s = where(range lt minval) if size(s,/n_dimensions) gt 0 then coloray[s] = below_minval_color s = where(range le -90.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 end 'DW': begin maxval = 50. minval = 0. color_bin_size = 2.5 ; dBZ ncolors = (maxval - minval) / color_bin_size + 1. ncolors = ncolors + 2 ; include indexes for out-of-bounds colors. below_minval_color = 1 above_maxval_color = ncolors color_offset = 2. ; 0 is reserved for black, 1 for below-minval color. adjust = color_offset + abs(minval)/color_bin_size ; for negative values coloray = long(range/color_bin_size + adjust) ; coloray = long(range/color_bin_size + color_offset) s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = above_maxval_color s = where(range lt minval) if size(s,/n_dimensions) gt 0 then coloray[s] = below_minval_color s = where(range le -90.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 ;STOP end 'DK': begin maxval = 30. minval = -20. color_bin_size = 2.5 ; dBZ ncolors = (maxval - minval) / color_bin_size + 1. ncolors = ncolors + 2 ; include indexes for out-of-bounds colors. below_minval_color = 1 above_maxval_color = ncolors color_offset = 2. ; 0 is reserved for black, 1 for below-minval color. adjust = color_offset + abs(minval)/color_bin_size ; for negative values coloray = long(range/color_bin_size + adjust) ; coloray = long(range/color_bin_size + color_offset) s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = above_maxval_color s = where(range lt minval) if size(s,/n_dimensions) gt 0 then coloray[s] = below_minval_color s = where(range le -90.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 ;STOP end 'VE': begin rangefolded = 13.35 ; color_bin_size = 0.8125 ; m/s ; adjust = 8 ; adjust for negative values. bins=[13.5,11.25,9.0,6.75,4.5,2.25,0,-2.25,-4.5,-6.75,-9.0,-11.25,-13.5] coloray=lonarr(n_elements(range)) for j=0,n_elements(range)-1 do begin if range(j) gt -99.9 then begin dum=range(j)-bins wh_val=where(abs(dum) eq min(abs(dum))) ; print, wh_val coloray(j) = wh_val[0] ; print, 'color: ', coloray[j] ;STOP endif else begin coloray(j)=-40 endelse endfor if nyquist gt 1. then begin s = where(abs(range) gt nyquist) if size(s,/n_dimensions) gt 0 then coloray[s] = rangefolded endif s = where(range lt -90.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 ;stop end 'CV': begin nyquist = 38. rangefolded = 38 color_bin_size = 5. ; m/s adjust = 7.5 ; adjust for negative values. coloray = long(range/color_bin_size + adjust) if nyquist gt 0. then begin s = where(abs(range) gt nyquist) if size(s,/n_dimensions) gt 0 then coloray[s] = rangefolded endif s = where(range lt -10000.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 end 'VR': begin nyquist = 27. rangefolded = 27 color_bin_size = 5. ; m/s adjust = 7.5 ; adjust for negative values. coloray = long(range/color_bin_size + adjust) if nyquist gt 0. then begin s = where(abs(range) gt nyquist) if size(s,/n_dimensions) gt 0 then coloray[s] = rangefolded endif s = where(range lt -10000.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 end 'SW': begin color_bin_size = 2. ; m/s color_offset = 1. maxval = 21. high_color = 12 rangefolded = 13 coloray = long(range/color_bin_size + color_offset) s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = high_color if nyquist gt 0. then begin s = where(range gt nyquist) if size(s,/n_dimensions) gt 0 then coloray[s] = rangefolded endif s = where(range lt -10000.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 end 'KX':begin maxval = 9. minval=-6.0 color_bin_size = 1.5 ; units: dBZ for DR ncolors = (maxval - minval) / color_bin_size + 1. ncolors = ncolors + 2 ; include indexes for out-of-bounds colors. below_minval_color = 1 above_maxval_color = ncolors color_offset = 2. ; 0 is reserved for black, 1 for below-minval color. adjust = color_offset + abs(minval)/color_bin_size ; for negative values coloray = long(range/color_bin_size + adjust) s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = above_maxval_color s = where(range lt minval) if size(s,/n_dimensions) gt 0 then coloray[s] = below_minval_color s = where(range lt -90.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 END 'KC':begin maxval = 5. minval=-2.0 color_bin_size = 0.5 ; units: dBZ for DR ncolors = (maxval - minval) / color_bin_size + 1. ;STOP ncolors = ncolors + 2 ; include indexes for out-of-bounds colors. below_minval_color = 1 above_maxval_color = ncolors color_offset = 2. ; 0 is reserved for black, 1 for below-minval color. adjust = color_offset + abs(minval)/color_bin_size ; for negative values coloray = long(range/color_bin_size + adjust) s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = above_maxval_color s = where(range lt minval) if size(s,/n_dimensions) gt 0 then coloray[s] = below_minval_color s = where(range lt -90.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 end 'DR': begin maxval = 5. minval = -1. color_bin_size = .5 ; units: dBZ for DR ncolors = (maxval - minval) / color_bin_size + 1. ncolors = ncolors + 2 ; include indexes for out-of-bounds colors. below_minval_color = 1 above_maxval_color = ncolors color_offset = 2. ; 0 is reserved for black, 1 for below-minval color. adjust = color_offset + abs(minval)/color_bin_size ; for negative values coloray = long(range/color_bin_size + adjust) s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = above_maxval_color s = where(range lt minval) if size(s,/n_dimensions) gt 0 then coloray[s] = below_minval_color s = where(range lt -90.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 end 'KD': begin maxval = 10 minval = 0. color_bin_size = 1.0 ; units: deg/km ncolors = (maxval - minval) / color_bin_size + 1. ncolors = ncolors + 2 ; include indexes for out-of-bounds colors. below_minval_color = 1 above_maxval_color = ncolors color_offset = 2. ; 0 is reserved for black, 1 for below-minval color. adjust = color_offset + abs(minval)/color_bin_size ; for negative values coloray = long(range/color_bin_size + adjust) s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = above_maxval_color s = where(range lt minval) if size(s,/n_dimensions) gt 0 then coloray[s] = below_minval_color s = where(range lt -90.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 end 'ZD': begin maxval = 5. minval=-2.0 color_bin_size = 0.5 ; units: dBZ for DR ncolors = (maxval - minval) / color_bin_size + 1. ;STOP ncolors = ncolors + 2 ; include indexes for out-of-bounds colors. below_minval_color = 1 above_maxval_color = ncolors color_offset = 2. ; 0 is reserved for black, 1 for below-minval color. adjust = color_offset + abs(minval)/color_bin_size ; for negative values coloray = long(range/color_bin_size + adjust) s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = above_maxval_color s = where(range lt minval) if size(s,/n_dimensions) gt 0 then coloray[s] = below_minval_color s = where(range lt -90.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 end 'RH': begin color_offset = 1 ; Since majority of values should be greater than 0.8, we want more ; detail in that range. Therefore the values are binned as follows: ; 0. .2 .4 .6 .80 .84 .88 .90 .92 .94 .96 .98 range=range ;/100. mult=1. ; endif else begin ; mult=1 ; endelse coloray = intarr(n_elements(range)) ; initialized with no data (=0). s = where(range ge 0.*mult and range lt .2*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset s = where(range ge .2*mult and range lt .4*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 1 s = where(range ge .4*mult and range lt .6*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 2 s = where(range ge .6*mult and range lt .8*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 3 s = where(range ge .8*mult and range lt .84*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 4 s = where(range ge .84*mult and range lt .88*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 5 s = where(range ge .88*mult and range lt .90*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 6 s = where(range ge .90*mult and range lt .92*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 7 s = where(range ge .92*mult and range lt .94*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 8 s = where(range ge .94*mult and range lt .96*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 9 s = where(range ge .96*mult and range lt .98*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 10 s = where(range ge .98*mult) s = where(range ge 0.*mult and range lt .2*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset s = where(range ge .2*mult and range lt .4*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 1 s = where(range ge .4*mult and range lt .6*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 2 s = where(range ge .6*mult and range lt .8*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 3 s = where(range ge .8*mult and range lt .84*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 4 s = where(range ge .84*mult and range lt .88*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 5 s = where(range ge .88*mult and range lt .90*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 6 s = where(range ge .975*mult and range lt .98*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 7 s = where(range ge .98*mult and range lt .985*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 8 s = where(range ge .985*mult and range lt .99*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 9 s = where(range ge .99*mult and range lt .995*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 10 s = where(range ge .995*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 11 end 'PH': begin maxval = 360. minval = -90. color_bin_size =450./12. ; units: dBZ for DR ncolors = 12 ncolors = ncolors + 2 ; include indexes for out-of-bounds colors. below_minval_color = 1 above_maxval_color = ncolors ; color_offset = 2. ; 0 is reserved for black, 1 for below-minval color. color_offset = -1 adjust = color_offset + abs(minval)/color_bin_size ; for negative values coloray = long(range/color_bin_size + adjust) s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = above_maxval_color s = where(range lt minval) if size(s,/n_dimensions) gt 0 then coloray[s] = below_minval_color s = where(range lt -91.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 ;stop end 'PC': begin maxval = 0. minval = -180. color_bin_size =180./12. ; units: dBZ for DR ncolors = 12 ncolors = ncolors + 2 ; include indexes for out-of-bounds colors. below_minval_color = 1 above_maxval_color = ncolors color_offset = 2. ; 0 is reserved for black, 1 for below-minval color. adjust = color_offset + abs(minval)/color_bin_size ; for negative values coloray = long(range/color_bin_size + adjust) s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = above_maxval_color s = where(range lt minval) if size(s,/n_dimensions) gt 0 then coloray[s] = below_minval_color s = where(range lt -91.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 ;stop end 'LD': begin maxval = 0 minval = -55. color_bin_size = 5 ; units: dBZ for DR ncolors = (maxval - minval) / color_bin_size + 1. ncolors = ncolors + 2 ; include indexes for out-of-bounds colors. below_minval_color = 1 above_maxval_color = ncolors color_offset = 2. ; 0 is reserved for black, 1 for below-minval color. adjust = color_offset + abs(minval)/color_bin_size ; for negative values coloray = long(range/color_bin_size + adjust) s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = above_maxval_color s = where(range lt minval) if size(s,/n_dimensions) gt 0 then coloray[s] = below_minval_color s = where(range lt -10000.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 end 'T': begin maxval = -20. minval = -100. color_bin_size = 10 ; units: dBZ for DR ncolors = (maxval - minval) / color_bin_size + 1. ncolors = ncolors + 2 ; include indexes for out-of-bounds colors. below_minval_color = 1 above_maxval_color = ncolors color_offset = 2. ; 0 is reserved for black, 1 for below-minval color. adjust = color_offset + abs(minval)/color_bin_size ; for negative values coloray = long(range/color_bin_size + adjust) s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = above_maxval_color s = where(range lt minval) if size(s,/n_dimensions) gt 0 then coloray[s] = below_minval_color s = where(range lt -10000.) ; bad or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 end 'RR': begin color_offset = 1 ; Manual value ; 0. 0.5 1.0 2.0 4.0 8.00 12.5 15.0 25.0 50.0 75.0 100.0 range=range ;/100. mult=1. coloray = intarr(n_elements(range)) ; initialized with no data (=0). s = where(range ge 0.*mult and range lt .5*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset s = where(range ge .5*mult and range lt 1.0*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 1 s = where(range ge 1.0*mult and range lt 2.0*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 2 s = where(range ge 2.0*mult and range lt 4.0*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 3 s = where(range ge 4.0*mult and range lt 8.0*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 4 s = where(range ge 8.0*mult and range lt 12.5*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 5 s = where(range ge 12.5*mult and range lt 15.0*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 6 s = where(range ge 15.0*mult and range lt 25.0*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 7 s = where(range ge 25.0*mult and range lt 50.*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 8 s = where(range ge 50.0*mult and range lt 75.0*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 9 s = where(range ge 75.0*mult and range lt 100.0*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 10 s = where(range ge 100.0*mult) if size(s,/n_dimensions) gt 0 then coloray[s] = color_offset + 11 end ; 'RR': begin ; maxval = 50 ; minval = 0. ; color_bin_size = 5. ; mm/hr ; ncolors = (maxval - minval) / color_bin_size + 1. ; color_offset = 1. ; 0 is reserved for black. ; coloray = long(range/color_bin_size + color_offset) ; s = where(range le 0.) ; 0. or missing value ; if size(s,/n_dimensions) gt 0 then coloray[s] = 0 ; s = where(range gt maxval) ; if size(s,/n_dimensions) gt 0 then coloray[s] = ncolors ; end 'D0': begin maxval = 7.5 minval = 0.0 color_bin_size = 0.5 ; units: mm ncolors = (maxval - minval) / color_bin_size + 1. color_offset = 1. ; 0 is reserved for black, 1 for below-minval color. adjust = color_offset + abs(minval)/color_bin_size ; for negative values color_offset = 1. ; 0 is reserved for black. coloray = long(range/color_bin_size + color_offset) s = where(range le 0.) ; 0. or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = ncolors end 'NW': begin maxval = 7.5 minval = 0.0 color_bin_size = 0.5 ; units: mm ncolors = (maxval - minval) / color_bin_size + 1. color_offset = 1. ; 0 is reserved for black, 1 for below-minval color. adjust = color_offset + abs(minval)/color_bin_size ; for negative values color_offset = 1. ; 0 is reserved for black. coloray = long(range/color_bin_size + color_offset) s = where(range le 0.) ; 0. or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = ncolors end 'FHT': begin maxval = 9. minval = 0. color_bin_size = 1. ; mm/hr ncolors = (maxval - minval) / color_bin_size + 1. color_offset = 1. ; 0 is reserved for black. coloray = long(range/color_bin_size + color_offset) s = where(range lt 0.) ; 0. or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = ncolors end 'FHK': begin maxval = 9. minval = 0. color_bin_size = 1. ; mm/hr ncolors = (maxval - minval) / color_bin_size + 1. color_offset = 1. ; 0 is reserved for black. coloray = long(range/color_bin_size + color_offset) s = where(range lt 0.) ; 0. or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = ncolors end 'FHK11': begin maxval = 11. minval = 0. color_bin_size = 1. ; mm/hr ncolors = (maxval - minval) / color_bin_size + 1. color_offset = 1. ; 0 is reserved for black. coloray = long(range/color_bin_size + color_offset) s = where(range lt 0.) ; 0. or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = ncolors end 'FHSUM': begin maxval = 10. minval = 0. color_bin_size = 1. ; mm/hr ncolors = (maxval - minval) / color_bin_size + 1. color_offset = 1. ; 0 is reserved for black. coloray = long(range/color_bin_size + color_offset) s = where(range lt 0.) ; 0. or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = ncolors end 'MC': begin s = where(range eq 1.,c) if (c gt 0) then begin range[s] = 0. endif s = where(range eq 2.,c) if (c gt 0) then begin range[s] = 1. endif s = where(range eq 3.,c) if (c gt 0) then begin range[s] = 2. endif s = where(range eq 4.,c) if (c gt 0) then begin range[s] = 3. endif maxval = 3. minval = 0. color_bin_size = 1. ; mm/hr ncolors = (maxval - minval) / color_bin_size + 1. color_offset = 1. ; 0 is reserved for black. coloray = long(range/color_bin_size + color_offset) s = where(range lt 0.,c) ; 0. or missing value if (c gt 0) then begin coloray[s] = 0 endif s = where(range gt maxval,c) if (c gt 0) then begin coloray[s] = ncolors endif end 'MR': begin s = where(range eq 1.,c) if (c gt 0) then begin range[s] = 0. endif s = where(range eq 2.,c) if (c gt 0) then begin range[s] = 1. endif s = where(range eq 3.,c) if (c gt 0) then begin range[s] = 2. endif s = where(range eq 4.,c) if (c gt 0) then begin range[s] = 3. endif s = where(range eq 5.,c) if (c gt 0) then begin range[s] = 4. endif maxval = 4. minval = 0. color_bin_size = 1. ; mm/hr ncolors = (maxval - minval) / color_bin_size + 1. color_offset = 1. ; 0 is reserved for black. coloray = long(range/color_bin_size + color_offset) s = where(range lt 0.,c) ; 0. or missing value if (c gt 0) then begin coloray[s] = 0 endif s = where(range gt maxval,c) if (c gt 0) then begin coloray[s] = ncolors endif end 'MP': begin s = where(range eq 1.,c) if (c gt 0) then begin range[s] = 0. endif s = where(range eq 2.,c) if (c gt 0) then begin range[s] = 1. endif s = where(range eq 3.,c) if (c gt 0) then begin range[s] = 2. endif s = where(range eq 4.,c) if (c gt 0) then begin range[s] = 3. endif s = where(range eq 5.,c) if (c gt 0) then begin range[s] = 4. endif maxval = 4. minval = 0. color_bin_size = 1. ; mm/hr ncolors = (maxval - minval) / color_bin_size + 1. color_offset = 1. ; 0 is reserved for black. coloray = long(range/color_bin_size + color_offset) s = where(range lt 0.,c) ; 0. or missing value if (c gt 0) then begin coloray[s] = 0 endif s = where(range gt maxval,c) if (c gt 0) then begin coloray[s] = ncolors endif end 'DHC': begin s = where(range eq 6.,c) if (c gt 0) then begin range[s] = 0. endif s = where(range eq 7.,c) if (c gt 0) then begin range[s] = 1. endif s = where(range eq 8.,c) if (c gt 0) then begin range[s] = 2. endif s = where(range eq 9.,c) if (c gt 0) then begin range[s] = 3. endif s = where(range eq 10.,c) if (c gt 0) then begin range[s] = 4. endif s = where(range eq 11.,c) if (c gt 0) then begin range[s] = 5. endif s = where(range eq 12.,c) if (c gt 0) then begin range[s] = 6. endif s = where(range eq 13.,c) if (c gt 0) then begin range[s] = 7. endif s = where(range eq 14.,c) if (c gt 0) then begin range[s] = 8. endif s = where(range eq 15.,c) if (c gt 0) then begin range[s] = 9. endif s = where(range eq 16.,c) if (c gt 0) then begin range[s] = 10. endif maxval = 10. minval = 0. color_bin_size = 1. ; mm/hr ncolors = (maxval - minval) / color_bin_size + 1. color_offset = 1. ; 0 is reserved for black. coloray = long(range/color_bin_size + color_offset) s = where(range lt 0.,c) ; 0. or missing value if (c gt 0) then begin coloray[s] = 0 endif s = where(range gt maxval,c) if (c gt 0) then begin coloray[s] = ncolors endif end 'FHCOLD': begin maxval = 11. minval = 0. color_bin_size = 1. ; mm/hr ncolors = (maxval - minval) / color_bin_size + 1. color_offset = 1. ; 0 is reserved for black. coloray = long(range/color_bin_size + color_offset) s = where(range lt 0.) ; 0. or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = ncolors ;STOP end 'FHB': begin maxval = 10. minval = 0. color_bin_size = 1. ; mm/hr ncolors = (maxval - minval) / color_bin_size + 1. color_offset = 1. ; 0 is reserved for black. coloray = long(range/color_bin_size + color_offset) s = where(range lt 0.) ; 0. or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = ncolors end 'FHCP': begin maxval = 7. minval = 0. color_bin_size = 1. ; mm/hr ncolors = (maxval - minval) / color_bin_size + 1. color_offset = 1. ; 0 is reserved for black. coloray = long(range/color_bin_size + color_offset) s = where(range lt 0.) ; 0. or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = ncolors end 'FHC': begin maxval = 7. minval = 0. color_bin_size = 1. ; mm/hr ncolors = (maxval - minval) / color_bin_size + 1. color_offset = 1. ; 0 is reserved for black. coloray = long(range/color_bin_size + color_offset) s = where(range lt 0.) ; 0. or missing value if size(s,/n_dimensions) gt 0 then coloray[s] = 0 s = where(range gt maxval) if size(s,/n_dimensions) gt 0 then coloray[s] = ncolors end endcase finished: return, coloray end ; rsl_mapcolors ;*****************************; ; rsl_loadcolortable ; ;*****************************; pro rsl_loadcolortable, field, error ; Load colortable for radar images. ;true compile_opt hidden r = indgen(256) g = r b = r if n_elements(field) eq 0 then field = 'DZ' fieldtype = field if field eq 'ZT' or field eq 'CZ' then fieldtype = 'DZ' ;if field eq 'ZD' then fieldtype = 'DR' ; Darwin uses ZD for DR. case fieldtype of 'DZ': begin r[0:16]= [0,102,153, 0, 0, 0, 0, 0, 0,255,255,255,241,196,151,239,135] g[0:16]= [0,102,153,218,109, 0,241,190,139,253,195,138, 0, 0, 0, 0, 35] b[0:16]= [0,102,153,223,227,232, 1, 0, 0, 0, 0, 0, 0, 0, 0,255,255] end 'DW': begin r[0:22]= [000,223,102,153,209,168,000,000,000,179,000,000,000,255,255,255,255,196,151,241,255,173,097] g[0:22]= [000,223,102,153,149,230,218,109,000,243,241,190,139,253,195,138,070,000,000,000,000,035,000] b[0:22]= [000,223,102,153,255,255,223,227,232,037,001,000,000,000,000,000,000,000,000,085,255,255,166] end 'DK': begin r[0:22]= [000,223,102,153,209,168,000,000,000,179,000,000,000,255,255,255,255,196,151,241,255,173,097] g[0:22]= [000,223,102,153,149,230,218,109,000,243,241,190,139,253,195,138,070,000,000,000,000,035,000] b[0:22]= [000,223,102,153,255,255,223,227,232,037,001,000,000,000,000,000,000,000,000,085,255,255,166] end 'VR': begin vr_zero = 255 ; white for black background. if !p.background eq 255 then vr_zero = 231 ; gray for white background. r[0:14]= [0, 0, 0, 0, 0, 0, 0, vr_zero, 246,255,255,241,196,151,239] g[0:14]= [0, 0,109,218,139,190,241, vr_zero, 246,195,138, 0, 0, 0, 0] b[0:14]= [0,232,223,227, 0, 0, 1, vr_zero, 0, 0, 0, 0, 0, 0,255] end 'VE': begin vr_zero = 255 ; white for black background. if !p.background eq 255 then vr_zero = 231 ; gray for white background. r[0:14]= [0, 0, 0, 0, 0, 0, 0, vr_zero, 246,255,255,241,196,151,239] g[0:14]= [0, 0,109,218,139,190,241, vr_zero, 246,195,138, 0, 0, 0, 0] b[0:14]= [0,232,223,227, 0, 0, 1, vr_zero, 0, 0, 0, 0, 0, 0,255] end 'CV': begin vr_zero = 255 ; white for black background. if !p.background eq 255 then vr_zero = 231 ; gray for white background. r[0:14]= [0, 0, 0, 0, 0, 0, 0, vr_zero, 246,255,255,241,196,151,239] g[0:14]= [0, 0,109,218,139,190,241, vr_zero, 246,195,138, 0, 0, 0, 0] b[0:14]= [0,232,223,227, 0, 0, 1, vr_zero, 0, 0, 0, 0, 0, 0,255] end 'SW': begin r[0:13]= [0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 241, 196, 151, 239] g[0:13]= [0, 218, 109, 0, 241, 190, 139, 253, 195, 138, 0, 0, 0, 0] b[0:13]= [0, 223, 227, 232, 1, 0, 0, 0, 0, 0, 0, 0, 0, 255] end 'DR': begin r[0:15]= [0,153, 0, 0, 0, 0, 0, 0,255,255,255,241,196,151,239,135] g[0:15]= [0,153,218,109, 0,241,190,139,253,195,138, 0, 0, 0, 0, 35] b[0:15]= [0,153,223,227,232, 1, 0, 0, 0, 0, 0, 0, 0, 0,255,255] end 'ZD': begin ; r[0:17]= [0,60, 102,153, 0, 0, 0, 0, 0, 0,255,255,255,241,196,151,239,135] ; g[0:17]= [0,60, 102,153,218,109, 0,241,190,139,253,195,138, 0, 0, 0, 0, 35] ; b[0:17]= [0,60, 102,153,223,227,232, 1, 0, 0, 0, 0, 0, 0, 0, 0,255,255] r[0:17]= [0, 0, 0, 0, 102,153,200, 0, 0, 0, 255,255,255,241,196,151,239,135] g[0:17]= [0, 0,218,109, 102,153,200,241,190,139,253,195,138, 0, 0, 0, 0, 35] b[0:17]= [0,232,223,227, 102,153,200, 1, 0, 0, 0, 0, 0, 0, 0, 0, 255,255] end 'KD': begin r[0:13]= [0, 0, 0, 0, 0, 0,255,255,255,241,196,151,239,135] g[0:13]= [0,218, 0,241,190,139,253,195,138, 0, 0, 0, 0, 35] b[0:13]= [0,223,232, 1, 0, 0, 0, 0, 0, 0, 0, 0,255,255] end 'KX': begin r[0:13]= [0, 0, 0, 0, 0, 0,255,255,255,241,196,151,239,135] g[0:13]= [0,218, 0,241,190,139,253,195,138, 0, 0, 0, 0, 35] b[0:13]= [0,223,232, 1, 0, 0, 0, 0, 0, 0, 0, 0,255,255] end 'KC': begin r[0:17]= [0, 0, 0, 0, 102,153,200, 0, 0, 0, 255,255,255,241,196,151,239,135] g[0:17]= [0, 0,218,109, 102,153,200,241,190,139,253,195,138, 0, 0, 0, 0, 35] b[0:17]= [0,232,223,227, 102,153,200, 1, 0, 0, 0, 0, 0, 0, 0, 0, 255,255] end 'LD': begin r[0:13]= [0, 0, 0, 0, 0, 0,255,255,255,241,196,151,239,135] g[0:13]= [0,218, 0,241,190,139,253,195,138, 0, 0, 0, 0, 35] b[0:13]= [0,223,232, 1, 0, 0, 0, 0, 0, 0, 0, 0,255,255] end 'RH': begin r[0:12]= [0, 0, 0, 0, 0, 0, 0,246,255,255,241,196,151] g[0:12]= [0, 0,109,218,139,190,241,246,195,138, 0, 0, 0] b[0:12]= [0,232,223,227, 0, 0, 1, 0, 0, 0, 0, 0, 0] end 'PH': begin r[0:12]= [0, 0, 0, 0, 0, 0, 0,246,255,255,241,196,151] g[0:12]= [0, 0,109,218,139,190,241,246,195,138, 0, 0, 0] b[0:12]= [0,232,223,227, 0, 0, 1, 0, 0, 0, 0, 0, 0] end 'PC': begin r[0:12]= [0, 0, 0, 0, 0, 0, 0,246,255,255,241,196,151] g[0:12]= [0, 0,109,218,139,190,241,246,195,138, 0, 0, 0] b[0:12]= [0,232,223,227, 0, 0, 1, 0, 0, 0, 0, 0, 0] end 'RR': begin r[0:12]= [0, 0, 0, 0, 0, 0, 0,246,255,255,241,196,151] g[0:12]= [0, 0,109,218,139,190,241,246,195,138, 0, 0, 0] b[0:12]= [0,232,223,227, 0, 0, 1, 0, 0, 0, 0, 0, 0] end 'D0': begin ; r[0:15]= [0,153, 0, 0, 0, 0, 0, 0,255,255,255,241,196,151,239,135] ; g[0:15]= [0,153,218,109, 0,241,190,139,253,195,138, 0, 0, 0, 0, 35] ; b[0:15]= [0,153,223,227,232, 1, 0, 0, 0, 0, 0, 0, 0, 0,255,255] r[0:15]= [0,100, 0, 0, 0, 0, 0, 0,255,255,255,241,196,151,239,135] g[0:15]= [0,100,255,109, 0,241,190,139,253,195,138, 0, 0, 0, 0, 35] b[0:15]= [0,100,223,227,232, 1, 0, 0, 0, 0, 0, 0, 0, 0,255,255] end 'NW': begin r[0:15]= [0,100, 0, 0, 0, 0, 0, 0,255,255,255,241,196,151,239,135] g[0:15]= [0,100,255,109, 0,241,190,139,253,195,138, 0, 0, 0, 0, 35] b[0:15]= [0,100,223,227,232, 1, 0, 0, 0, 0, 0, 0, 0, 0,255,255] end ; ; *** CSU HID Stuff ; 'FHT': begin print,'Using ' + fieldtype + ' colors!' r[0:10]= [0, 43,135, 0,232,255, 0,153, 43,255,255] g[0:10]= [0,159, 35, 82,159,253,241,153,255,138, 0] b[0:10]= [0,165,255,227,185, 0, 1,153,237, 0, 0] end 'FHK': begin print,'Using ' + fieldtype + ' colors!' ; [ UC, DZ RN DS WS VI DG WG SH LH ] r[0:10]= [0, 43, 135, 0, 232, 43, 153, 0, 255, 255, 255] g[0:10]= [0, 159, 35, 82, 159, 255, 153, 241, 253, 138, 0] b[0:10]= [0, 165, 255, 227, 185, 237, 153, 1, 0, 0, 0] end 'FHK11': begin print,'Using ' + fieldtype + ' colors!' ; [ UC, DZ RN DS WS VI DG WG SH LH SH+R LH+R] r[0:12]= [0, 43, 135, 0, 232, 43, 153, 0, 255, 255, 255, 239, 205] g[0:12]= [0, 159, 35, 82, 159, 255, 153, 241, 253, 138, 0, 0, 138] b[0:12]= [0, 165, 255, 227, 185, 237, 153, 1, 0, 0, 0, 255, 100] end 'FHSUM': begin print,'Using ' + fieldtype + ' colors!' ; [ UC DZ RN CR DS WS VI LDG HDG HA BD] r[0:11]= [0, 43, 135, 0, 255, 232, 43, 153, 0, 255, 255, 239] g[0:11]= [0, 159, 35, 82, 138, 159, 255, 153, 241, 253, 0, 0] b[0:11]= [0, 165, 255, 227, 0, 185, 237, 153, 1, 0, 0, 255] end 'MC': begin print,'Using ' + fieldtype + ' colors!' ; [ 1 2 3 4] r[0:4]= [0, 43, 135, 43, 255] g[0:4]= [0, 159, 35, 255, 138] b[0:4]= [0, 165, 255, 237, 0] end 'MP': begin print,'Using ' + fieldtype + ' colors!' ; [ 1 2 3 4 5] r[0:5]= [0, 43, 135, 43, 255, 255] g[0:5]= [0, 159, 35, 255, 138, 253] b[0:5]= [0, 165, 255, 237, 0, 0] end 'MR': begin print,'Using ' + fieldtype + ' colors!' ; [ 1 2 3 4 5] r[0:5]= [0, 43, 135, 43, 255, 255] g[0:5]= [0, 159, 35, 255, 138, 253] b[0:5]= [0, 165, 255, 237, 0, 0] end 'DHC': begin print,'Using ' + fieldtype + ' colors!' ; [ LD DR RA HR RH HA GR WI DI CR DN ] ; r[0:10]= [0, 43, 135, 0, 255, 232, 43, 153, 0, 255, 255, 239] ; g[0:10]= [0, 159, 35, 82, 138, 159, 255, 153, 241, 253, 0, 0] ; b[0:10]= [0, 165, 255, 227, 0, 185, 237, 153, 1, 0, 0, 255] r[0:11]= [0, 43, 135, 0, 255, 232, 43, 153, 0, 255, 255, 239] g[0:11]= [0, 159, 35, 82, 138, 159, 255, 153, 241, 253, 0, 0] b[0:11]= [0, 165, 255, 227, 0, 185, 237, 153, 1, 0, 0, 255] ; r[0:16]= [255, 255, 255, 255, 255, 255, 43, 135, 0, 255, 232, 43, 153, 0, 255, 255, 239] ; g[0:16]= [255, 255, 255, 255, 255, 255, 159, 35, 82, 138, 159, 255, 153, 241, 253, 0, 0] ; b[0:16]= [255, 255, 255, 255, 255, 255, 165, 255, 227, 0, 185, 237, 153, 1, 0, 0, 255] end 'FHCOLD': begin print,'Using ' + fieldtype + ' colors!' ; [ UC, DZ LtRn RN WS DS DN PL AG VI LDG HDG] r[0:12]= [0, 43, 135, 0, 0, 43, 232, 205, 239, 255, 153, 255, 255] g[0:12]= [0, 159, 35, 82, 241, 255, 159, 138, 0, 138, 153, 253, 0] b[0:12]= [0, 165, 255, 227, 1, 237, 185, 100, 255, 0, 153, 0, 0] end 'FHB': begin print,'Using ' + fieldtype + ' colors!' ; [ UC, DZ RN DS WS VI DG WG SH LH BD ] r[0:11]= [0, 43, 135, 0, 232, 43, 153, 0, 255, 255, 255, 239] g[0:11]= [0, 159, 35, 82, 159, 255, 153, 241, 253, 138, 0, 0] b[0:11]= [0, 165, 255, 227, 185, 237, 153, 1, 0, 0, 0, 255] end 'FHC': begin print,'Using ' + fieldtype + ' colors!' ; [ UC, DZ, RN, AG, CR, LDG, HDG, VI] r[0:10]= [0, 43, 135, 0, 232, 255, 255, 0, 43, 153, 255] g[0:10]= [0, 159, 35, 82, 159, 138, 253, 241, 255, 153, 0] b[0:10]= [0, 165, 255, 227, 185, 0, 0, 1, 237, 153, 0] end 'FHCP': begin print,'Using ' + fieldtype + ' colors!' ; [ UC, DZ, RN, VI, SN, WS, LDG, HDG, HA] r[0:9]= [0, 43, 135, 0, 153, 232, 43, 255, 0, 255] g[0:9]= [0, 159, 35, 82, 153, 159, 255, 253, 241, 0] b[0:9]= [0, 165, 255, 227, 153, 185, 237, 0, 1, 0] end 'T': begin r[0:10]= [0, 43, 135, 0, 232, 255, 0, 153, 43, 255,255] g[0:10]= [0, 159, 35, 82, 159, 253, 241, 153, 255, 138, 0] b[0:10]= [0, 165, 255, 227, 185, 0, 1, 153, 237, 0, 0] end else: begin message, "Unknown field '" + field + "'.", /informational print," Suggestion: Try using LIKE_FIELD keyword. For example" print," rsl_plotsweep_from_radar, radar, field='"+field+$ "', like_field='DZ'" error = 1 return end endcase ; Make the last color white. Plotting routines use this for axes, grids, etc. r[255] = 255 g[255] = 255 b[255] = 255 tvlct, r, g, b ; load colortable. end ; rsl_loadcolortable