$Id$ @read_2d_table @get_prob_1d @get_prob_2d @get_prob_3d @get_prior_1d @get_prior_2d @get_prior_3d @get_prior_map @compute_month_day @leapyr ;-------------------------------------------------------------------------------------- ; test IDL implentation of new naive bayes cloud mask/phase ;-------------------------------------------------------------------------------------- pro test_new_ecm_level2, level2_file, mask_in = mask_in, sensor_name = sensor_name use_mask_in_flag = 0 if (keyword_set(mask_in)) then use_mask_in_flag = 1 if (~keyword_set(sensor_name)) then sensor_name='modis' table_path = "tables/" ;-------------------------------------------------------------------------------------- ;-- constants ;-------------------------------------------------------------------------------------- missing = -999.0 cloud_clear_prob_thresh = 0.5 prob_min_thresh = 0.001 r_max = 1000.0 ;-------------------------------------------------------------------------------------- ;--- read prior ;-------------------------------------------------------------------------------------- prior_map_name = table_path + 'nb_cloud_mask_calipso_prior.nc' get_prior_map, prior_map_name ;-------------------------------------------------------------------------------------- ;--- read in observations ;-------------------------------------------------------------------------------------- cloud_mask_aux = read_standard_hdf(level2_file, 'cloud_mask_aux') cloud_mask_in = read_standard_hdf(level2_file, 'cloud_mask') cloud_type_in = read_standard_hdf(level2_file, 'cloud_type') cloud_type_aux = read_standard_hdf(level2_file, 'cloud_type_aux') post_prob_cloud_in = read_standard_hdf(level2_file, 'cloud_probability') topa = read_standard_hdf(level2_file, 'cld_temp_opaque') etrop = read_standard_hdf(level2_file, 'emissivity_11um_tropopause') emiss375 = read_standard_hdf(level2_file, 'emiss_3_75um_nom') sfc_emiss375 = read_standard_hdf(level2_file, 'sfc_emiss_3_75um_nom_nwp') bt85 = read_standard_hdf(level2_file, 'temp_8_5um_nom') bt11 = read_standard_hdf(level2_file, 'temp_11_0um_nom') bt12 = read_standard_hdf(level2_file, 'temp_12_0um_nom') bt11bt67covar = read_standard_hdf(level2_file, 'temp_11_0um_nom') bt11_std = read_standard_hdf(level2_file, 'temp_11_0um_nom_stddev_3x3') solzen = read_standard_hdf(level2_file, 'solar_zenith_angle') glintzen = read_standard_hdf(level2_file, 'glint_zenith_angle') land_class = read_standard_hdf(level2_file, 'land_class') snow_class = read_standard_hdf(level2_file, 'snow_class') sfc_type = read_standard_hdf(level2_file, 'surface_type') zsfc = read_standard_hdf(level2_file, 'surface_elevation') lat = read_standard_hdf(level2_file, 'latitude') lon = read_standard_hdf(level2_file, 'longitude') cod065 = read_standard_hdf(level2_file, 'cld_opd_mask_0_65um_nom') cod138 = read_standard_hdf(level2_file, 'cld_opd_mask_1_38um_nom') ref065 = read_standard_hdf(level2_file, 'refl_0_65um_nom') ref065_clr = read_standard_hdf(level2_file, 'refl_0_65um_nom_clear_sky') ref160 = read_standard_hdf(level2_file, 'refl_1_60um_nom') ref138 = read_standard_hdf(level2_file, 'refl_1_38um_nom') bt11bt11covar = read_standard_hdf(level2_file, 'temp_11um_vs_67um_covar_5x5') elem_idx_lrc = read_standard_hdf(level2_file, 'diagnostic_1') line_idx_lrc = read_standard_hdf(level2_file, 'diagnostic_2') sfc_type_mask = read_standard_hdf(level2_file, 'bayes_mask_sfc_type') nx = n_elements(lat[*,0]) ny = n_elements(lat[0,*]) logcod065 = cod065 idx = where(cod065 gt 0.0,cc) & if (cc gt 0) then logcod065[idx] = alog10(cod065[idx]) logcod138 = cod138 idx = where(cod138 gt 0.0,cc) & if (cc gt 0) then logcod138[idx] = alog10(cod138[idx]) nx = n_elements(lat[*,0]) ny = n_elements(lat[0,*]) cloud_phase_in = intarr(nx,ny) idx = where(cloud_type_in ge 0 and cloud_type_in le 1, cc) if (cc gt 0) then cloud_phase_in[idx] = 0 idx = where(cloud_type_in ge 2 and cloud_type_in le 5, cc) if (cc gt 0) then cloud_phase_in[idx] = 1 idx = where(cloud_type_in ge 6 and cloud_type_in le 9, cc) if (cc gt 0) then cloud_phase_in[idx] = 2 cloud_phase_aux = intarr(nx,ny) idx = where(cloud_type_aux ge 0 and cloud_type_aux le 1, cc) if (cc gt 0) then cloud_phase_aux[idx] = 0 idx = where(cloud_type_aux ge 2 and cloud_type_aux le 5, cc) if (cc gt 0) then cloud_phase_aux[idx] = 1 idx = where(cloud_type_aux ge 6 and cloud_type_aux le 9, cc) if (cc gt 0) then cloud_phase_aux[idx] = 2 ;----------------------------------------------- ; make surface type ;---------------------------------------------- ;sst_back_uni = make_array(nx,ny,/FLOAT, VALUE=0.0) ;bayes_sfc_type_2d, land_class, snow_class, sfc_type, sst_back_uni, lon, lat, sfc_emiss375, sfc_type_mask ;----------------------------------------------- ; adjust lrc ;---------------------------------------------- idx = where(elem_idx_lrc gt 0,cc) & if (cc gt 0) then elem_idx_lrc[idx] = elem_idx_lrc[idx] - 1 idx = where(line_idx_lrc gt 0,cc) & if (cc gt 0) then line_idx_lrc[idx] = line_idx_lrc[idx] - 1 ;-------------------------------------------------------------------------------------- ; end of reading observations ;-------------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------------- ;-- define sensor ;-------------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------------- ;-- define table arrays and turn channels on and off ;-------------------------------------------------------------------------------------- @table_library.inc ;-------------------------------------------------------------------------------------- ;--- read tables ;------------------------------------------------------------------------------------- table_read_flag[*] = 0 for itable = 0, ntables - 1 do begin temp_table_name = table_path + sensor_name + "_" + table_name[itable] + ".nc" if (table_rank[itable] eq 1) then begin read_1d_table, temp_table_name, lut_temp, attrs_temp, read_flag *(lut[itable]) = lut_temp *(attrs[itable]) = attrs_temp table_read_flag[itable] = read_flag endif if (table_rank[itable] eq 2) then begin read_2d_table, temp_table_name, lut_temp, attrs_temp, read_flag *(lut[itable]) = lut_temp *(attrs[itable]) = attrs_temp table_read_flag[itable] = read_flag endif if (table_rank[itable] eq 3) then begin read_3d_table, temp_table_name, lut_temp, attrs_temp, read_flag *(lut[itable]) = lut_temp *(attrs[itable]) = attrs_temp table_read_flag[itable] = read_flag endif ;--- turn off tables that were not read in if (table_read_flag[itable] eq 0) then table_on_flag[itable] = 0 endfor ;------------------------------------------------------------------------------------- ; check that the channels are on for each table ;------------------------------------------------------------------------------------- for itable = 0, ntables - 1 do begin for i = 0, nchan_tables - 1 do begin if(chan_on_table[itable,i] gt 0) then begin if(chan_on_flag[chan_on_table[itable,i]] eq 0) then table_on_flag[itable] = 0 endif endfor endfor ;------------------------------------------------------------------------------------- ; define output ;------------------------------------------------------------------------------------- r_clear = make_array(nx,ny,/FLOAT,VALUE=missing) r_water = make_array(nx,ny,/FLOAT,VALUE=missing) r_ice = make_array(nx,ny,/FLOAT,VALUE=missing) post_prob_cloud = make_array(nx,ny,/FLOAT,VALUE=missing) post_prob_clear = make_array(nx,ny,/FLOAT,VALUE=missing) post_prob_ice = make_array(nx,ny,/FLOAT,VALUE=missing) post_prob_water= make_array(nx,ny,/FLOAT,VALUE=missing) post_prob_clear_test = make_array(ntables,nx,ny,/FLOAT,VALUE=missing) post_prob_water_test = make_array(ntables,nx,ny,/FLOAT,VALUE=missing) post_prob_ice_test = make_array(ntables,nx,ny,/FLOAT,VALUE=missing) post_prob_cloud_test = make_array(ntables,nx,ny,/FLOAT,VALUE=missing) prior_prob_cloud = make_array(nx,ny,/FLOAT,VALUE=missing) ;----------------------------------------------------------- ; determine first valid table index ;----------------------------------------------------------- first_valid_table = -1 itable = 0 while (first_valid_table lt 0 and itable lt ntables) do begin if (table_read_flag[itable] eq 1) then first_valid_table = itable itable++ endwhile if (first_valid_table lt 0) then begin print, 'ERROR, no valid tables found' endif ;----------------------------------------------------------- ; read year and day of year from file attributes ;----------------------------------------------------------- sd_id = hdf_sd_start(level2_file) hdf_sd_attrinfo, sd_id, hdf_sd_attrfind(sd_id,'START_DAY'),data = doy hdf_sd_attrinfo, sd_id, hdf_sd_attrfind(sd_id,'START_YEAR'),data = year hdf_sd_end,sd_id doy = doy[0] year = year[0] ;----------------------------------------------------------- ; Loop over Pixels and generate probabilities ;----------------------------------------------------------- compute_month_day, doy, leapyr(year), month, day imonth = month - 1 idiurnal = 0 for i = 0, nx-1 do begin for j = 0, ny-1 do begin isfc = sfc_type_mask[i,j] - 1 ; idl is zero based ;--- prior get_prior_values, lon[i,j], lat[i,j], imonth, idiurnal, prior_prob_clear, prior_prob_ice, prior_prob_water, prior_prob_sc ;--- take prior for this from any of the luts ; f = *(lut[first_valid_table]) ; prior_prob_cloud = f[isfc].cloud_fraction ; prior_prob_clear = 1.0 - prior_prob_cloud ; prior_prob_ice = f[isfc].ice_fraction ; prior_prob_water = f[isfc].water_fraction ;--- force water and ice priors to be equal (combats over-icing) ; prior_prob_water = 0.5*(1.0-prior_prob_clear) ; prior_prob_ice = prior_prob_water prior_prob_cloud[i,j] = 1.0 - prior_prob_clear ;---- reset table probabilities to missing clear_cond_ratio[*] = missing water_cond_ratio[*] = missing ice_cond_ratio[*] = missing obs_prob[*] = missing ;---- loop through each table for itable = 0, ntables - 1 do begin if (table_on_flag[itable] eq 0) then goto, skip_table x = missing y = missing z = missing case table_name[itable] OF ;--- 1d 'all_etropo': begin x = etrop[i,j] end 'all_bt11bt67covari': begin x = bt11bt67covar[i,j] end 'all_btd8511': begin x = bt85[i,j] - bt11[i,j] end 'day_emiss375': begin x = emiss375[i,j] end 'night_emiss375': begin x = emiss375[i,j] end 'day_logcod065': begin x = logcod065[i,j] end 'night_logcod065': begin x = logcod065[i,j] end 'day_logcod138': begin x = logcod138[i,j] end 'day_dref_065': begin x = ref065[i,j] - ref065_clr[i,j] end 'day_ndsi': begin x = (ref065[i,j] - ref160[i,j]) / (ref065[i,j] + ref160[i,j]) end ;--- 2d 'all_etropo_topa_logbt11std': begin x = etrop[i,j] y = topa[i,j] z = alog10(bt11_std[i,j]) end 'all_etropo_logbt11std': begin x = etrop[i,j] y = alog10(bt11_std[i,j]) end 'all_btd1112_btd8511': begin x = bt11[i,j] - bt12[i,j] y = bt85[i,j] - bt11[i,j] end 'all_etropo_btd8511': begin x = etrop[i,j] y = bt85[i,j] - bt11[i,j] end 'all_etropo_btd1112': begin x = etrop[i,j] y = bt11[i,j] - bt12[i,j] end 'all_etropo_bt11bt67covari': begin x = etrop[i,j] y = bt11bt67covar[i,j] end 'day_etropo_emiss375': begin x = etrop[i,j] y = emiss375[i,j] end 'night_etropo_emiss375': begin x = etrop[i,j] y = emiss375[i,j] end 'day_etropo_logcod065': begin x = etrop[i,j] y = logcod065[i,j] end 'day_etropo_logcod138': begin x = etrop[i,j] y = logcod138[i,j] end 'day_ref160_ref138': begin x = ref160[i,j] y = ref138[i,j] end 'day_etropo_ref160': begin x = etrop[i,j] y = ref160[i,j] end endcase if (table_rank[itable] eq 1) then begin get_prob_1d, x, solzen[i,j], glintzen[i,j], zsfc[i,j], snow_class[i,j], isfc,$ *(lut[itable]), *(attrs[itable]), prob_min_thresh, r_max, missing, $ cloud_mask_in, use_mask_in_flag, $ z1, z2, z3, z4 endif if (table_rank[itable] eq 2) then begin get_prob_2d, x, y, solzen[i,j], glintzen[i,j], zsfc[i,j], snow_class[i,j], isfc,$ *(lut[itable]), *(attrs[itable]), prob_min_thresh, r_max, missing, $ cloud_mask_in, use_mask_in_flag, $ z1, z2, z3, z4 endif if (table_rank[itable] eq 3) then begin get_prob_3d, x, y, z, solzen[i,j], glintzen[i,j], zsfc[i,j], snow_class[i,j], isfc,$ *(lut[itable]), *(attrs[itable]), prob_min_thresh, r_max, missing, $ cloud_mask_in, use_mask_in_flag, $ z1, z2, z3, z4 endif clear_cond_ratio[itable] = z1 water_cond_ratio[itable] = z2 ice_cond_ratio[itable] = z3 obs_prob[itable] = z4 skip_table: endfor ;-------------------------------------------------------------------------------------------- ; combine probabilities from each tables into a final value using standard naive bayes ;-------------------------------------------------------------------------------------------- ;post_prob_clear[i,j] = prior_prob_clear ;post_prob_water[i,j] = prior_prob_water ;post_prob_ice[i,j] = prior_prob_ice r_clear[i,j] = 1.0 r_water[i,j] = 1.0 r_ice[i,j] = 1.0 for itable = 0, ntables - 1 do begin if (clear_cond_ratio[itable] ne missing) then r_clear[i,j] = r_clear[i,j] * clear_cond_ratio[itable] if (water_cond_ratio[itable] ne missing) then r_water[i,j] = r_water[i,j] * water_cond_ratio[itable] if (ice_cond_ratio[itable] ne missing) then r_ice[i,j] = r_ice[i,j] * ice_cond_ratio[itable] endfor ;--- turn ratios into probabilities via post_prob = 1.0 / ( 1.0 + r/prior_yes - r) post_prob_clear[i,j] = 1.0 / (1.0 + r_clear[i,j]/prior_prob_clear - r_clear[i,j]) post_prob_water[i,j] = 1.0 / (1.0 + r_water[i,j]/prior_prob_water - r_water[i,j]) post_prob_ice[i,j] = 1.0 / (1.0 + r_ice[i,j]/prior_prob_ice - r_ice[i,j]) ;--- normalize these probabilties so that they sum to 1 post_sum = post_prob_clear[i,j] + post_prob_water[i,j] + post_prob_ice[i,j] post_prob_clear[i,j] = post_prob_clear[i,j] / post_sum post_prob_water[i,j] = post_prob_water[i,j] / post_sum post_prob_ice[i,j] = post_prob_ice[i,j] / post_sum ;--- make a cloud probability from the complement of the clear probability post_prob_cloud[i,j] = 1.0 - post_prob_clear[i,j] ;--- each test for itable = 0, ntables - 1 do begin post_prob_cloud_test[itable,i,j] = 1.0 - prior_prob_clear ; default if (clear_cond_ratio[itable] ne missing and water_cond_ratio[itable] ne missing and ice_cond_ratio[itable] ne missing) then begin post_prob_clear_test[itable,i,j] = 1.0 / (1.0 + clear_cond_ratio[itable]/prior_prob_clear - clear_cond_ratio[itable]) post_prob_water_test[itable,i,j] = 1.0 / (1.0 + water_cond_ratio[itable]/prior_prob_water - water_cond_ratio[itable]) post_prob_ice_test[itable,i,j] = 1.0 / (1.0 + ice_cond_ratio[itable]/prior_prob_ice - ice_cond_ratio[itable]) post_prob_cloud_test[itable,i,j] = 1.0 - post_prob_clear_test[itable,i,j] endif endfor endfor endfor ;----------------------------------------------------------------------- ; destroy pointers ;----------------------------------------------------------------------- lut = !null attrs = !null ;----------------------------------------------------------------------- ; construct a 4-level cloud mask ;----------------------------------------------------------------------- cloud_mask = cloud_mask_in idx = where(post_prob_cloud ge 0.00,cc) & if (cc gt 0) then cloud_mask[idx] = 0 idx = where(post_prob_cloud ge 0.10,cc) & if (cc gt 0) then cloud_mask[idx] = 1 idx = where(post_prob_cloud ge 0.50,cc) & if (cc gt 0) then cloud_mask[idx] = 2 idx = where(post_prob_cloud ge 0.90,cc) & if (cc gt 0) then cloud_mask[idx] = 3 ;----------------------------------------------------------------------- ; construct a 3-level cloud phase ;----------------------------------------------------------------------- cloud_phase = intarr(nx,ny) idx = where(cloud_mask eq 0 or cloud_mask eq 1, cc) & if (cc gt 0) then cloud_phase[idx] = 0 idx = where(cloud_mask ge 2, cc) & if (cc gt 0) then cloud_phase[idx] = 1 idx = where(cloud_mask ge 2 and post_prob_ice gt post_prob_water, cc) & if (cc gt 0) then cloud_phase[idx] = 2 ;----------------------------------------------------------------------- ; apply filters to the cloud phase ;----------------------------------------------------------------------- cloud_phase_median = median(cloud_phase,5) cloud_phase_filtered = cloud_phase_median for i = 0, nx - 1 do begin for j = 0, ny - 1 do begin if (elem_idx_lrc[i,j] ge 0 and line_idx_lrc[i,j] ge 0) then begin cloud_phase_filtered[i,j] = cloud_phase_median[elem_idx_lrc[i,j],line_idx_lrc[i,j]] endif endfor endfor ;--- make sure median and lrc don't impact mask idx = where(cloud_phase eq 0 and cloud_phase_filtered gt 0,cc) & if (cc gt 0) then cloud_phase_filtered[idx] = 0 idx = where(cloud_phase gt 0 and cloud_phase_filtered eq 0,cc) & if (cc gt 0) then cloud_phase_filtered[idx] = cloud_phase[idx] ;---------------------------------------------------------------------------------------------- ; compare input and output cloud fractions (optional diagnostic) ;---------------------------------------------------------------------------------------------- idx = where(post_prob_cloud_in ge 0.5, count_cloud_in) idx = where(post_prob_cloud_in ge 0.0, count_all_in) idx = where(post_prob_cloud ge 0.5, count_cloud) idx = where(post_prob_cloud ge 0.0, count_all) print, 'input cloud fraction = ', float(count_cloud_in) / float(count_all_in) print, 'output cloud fraction = ', float(count_cloud) / float(count_all) ;---------------------------------------------------------------------------------------------- ; compare input and output cloud masks visually ;---------------------------------------------------------------------------------------------- window, 0, xsize = 1200, ysize = 800 view, bt11, /t11_image, /current, position = [0.0,0.5,0.5,1.0], /nocbar view, cloud_mask_aux, /mask_image, /current, position = [0.5,0.5,1.0,1.0], /nocbar view, cloud_mask_in, /mask_image, /current, position = [0.0,0.0,0.5,0.5], /nocbar view, cloud_mask, /mask_image, /current, position = [0.5,0.0,1.0,0.5], /nocbar legend_local, [level2_file], position=[0.0,1.0], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.5 legend_local, ['MYD35'], position=[0.5,1.0], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.5 legend_local, ['ECM TRUNK'], position=[0.0,0.5], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.5 legend_local, ['ECM 2D'], position=[0.5,0.5], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.5 ;---------------------------------------------------------------------------------------------- ; compare input and output cloud phases visually ;---------------------------------------------------------------------------------------------- window, 1, xsize = 1200, ysize = 800 view, bt11, /t11_image, /current, position = [0.0,0.5,0.5,1.0], /nocbar load_color_table, 0, 0, 1.0, 249 view, cloud_phase_aux, sds_min=-101, sds_max=2, /current, position = [0.5,0.50,1.0,1.0], /nocbar view, cloud_phase_in, sds_min=-101, sds_max=2, /current, position = [0.0,0.0,0.5,0.5], /nocbar view, cloud_phase_filtered, sds_min=-101, sds_max=2, /current, position = [0.5,0.00,1.0,0.5], /nocbar legend_local, [level2_file], position=[0.0,1.0], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.5 legend_local, ['MYD35'], position=[0.5,1.0], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.5 legend_local, ['ECM TRUNK'], position=[0.0,0.5], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.5 legend_local, ['ECM 2D'], position=[0.5,0.5], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.5 window, 2, xsize = 1200, ysize = 1200 dx = 0.25 dy = 0.25 view, prior_prob_cloud, /current, position = [0.0,0.75,0.25,1.0], /nocbar view, post_prob_cloud, /current, position = [0.25,0.75,0.5,1.0], /nocbar if (ntables gt 0) then begin &if (table_on_flag[0] eq 1) then view, reform(post_prob_cloud_test[0,*,*]), /current, position = [0.50,0.75,0.75,1.00], /nocbar & endif if (ntables gt 1) then begin &if (table_on_flag[1] eq 1) then view, reform(post_prob_cloud_test[1,*,*]), /current, position = [0.75,0.75,1.00,1.00], /nocbar & endif if (ntables gt 2) then begin &if (table_on_flag[2] eq 1) then view, reform(post_prob_cloud_test[2,*,*]), /current, position = [0.00,0.50,0.25,0.75], /nocbar & endif if (ntables gt 3) then begin &if (table_on_flag[3] eq 1) then view, reform(post_prob_cloud_test[3,*,*]), /current, position = [0.25,0.50,0.50,0.75], /nocbar & endif if (ntables gt 4) then begin &if (table_on_flag[4] eq 1) then view, reform(post_prob_cloud_test[4,*,*]), /current, position = [0.50,0.50,0.75,0.75], /nocbar & endif if (ntables gt 5) then begin &if (table_on_flag[5] eq 1) then view, reform(post_prob_cloud_test[5,*,*]), /current, position = [0.75,0.50,1.00,0.75], /nocbar & endif if (ntables gt 6) then begin &if (table_on_flag[6] eq 1) then view, reform(post_prob_cloud_test[6,*,*]), /current, position = [0.00,0.25,0.25,0.50], /nocbar & endif if (ntables gt 7) then begin &if (table_on_flag[7] eq 1) then view, reform(post_prob_cloud_test[7,*,*]), /current, position = [0.25,0.25,0.50,0.50], /nocbar & endif if (ntables gt 8) then begin &if (table_on_flag[8] eq 1) then view, reform(post_prob_cloud_test[8,*,*]), /current, position = [0.50,0.25,0.75,0.50], /nocbar & endif if (ntables gt 9) then begin &if (table_on_flag[9] eq 1) then view, reform(post_prob_cloud_test[9,*,*]), /current, position = [0.75,0.25,1.00,0.50], /nocbar & endif legend_local, ['Prior'], position=[0.0,1.0], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.0 legend_local, ['Posterior'], position=[0.25,1.0], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.0 if (ntables gt 0) then legend_local, [table_name[0]], position=[0.5,1.0], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.0 if (ntables gt 1) then legend_local, [table_name[1]], position=[0.75,1.0], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.0 if (ntables gt 2) then legend_local, [table_name[2]], position=[0.00,0.75], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.0 if (ntables gt 3) then legend_local, [table_name[3]], position=[0.25,0.75], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.0 if (ntables gt 4) then legend_local, [table_name[4]], position=[0.50,0.75], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.0 if (ntables gt 5) then legend_local, [table_name[5]], position=[0.75,0.75], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.0 if (ntables gt 6) then legend_local, [table_name[6]], position=[0.00,0.50], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.0 if (ntables gt 7) then legend_local, [table_name[7]], position=[0.25,0.50], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.0 if (ntables gt 8) then legend_local, [table_name[8]], position=[0.50,0.50], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.0 if (ntables gt 9) then legend_local, [table_name[9]], position=[0.75,0.50], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.0 ;window, 3, xsize = 1200, ysize = 400 ;view, bt11, /t11_image, /current, position = [0.0,0.0,0.333,1.0], /nocbar ;load_color_table, 0, 0, 1.0, 249 ;view, cloud_phase_filtered, sds_min=-101, sds_max=2, /current, position = [0.333,0.00,0.666,1.0], /nocbar ;legend_local, [level2_file], position=[0.0,1.0], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.5 ;legend_local, ['BT11'], position=[0.0,1.0], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.5 ;legend_local, ['Phase'], position=[0.333,1.0], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.5 ;legend_local, ['SuperCooled'], position=[0.666,1.0], bxcolor=2, textcolors=[3], /clear, /normal, charsize=1.5 end