; stack_panel.pro ; ; Authors: Lon Riesberg / James Everton ; ; Date: 5/26/06 ; ; PURPOSE: ; ; REFERENCES: ; ; NOTES: ; ; CONSTRAINTS: ; ; OTHER SERVERS/MODULES USED: ; ; RELATED MODULES / CLASSES: ; called by cips_data_analyzer.pro ; ; -------------------------------------------------------------------------- ; PROCEDURE stack_panel_callback ; -------------------------------------------------------------------------- ; PURPOSE: ; This procedure is called whenever a registered component gencontour_btnserates a ; message. In this UI panel, there are no registered components, so this ; procedure is here simply for syntactical reasons. If components get ; registered later, this is where messages will be handled. ; ; INPUT PARAMETERS: (Automatically sent by the iTools environment) ; wPanel - the widget id of the panel widget ; strID - string identifying the source of the message ; messageIn - string that uniquely identifies the message being sent. ; component - a value that is associated with the message being sent. ; PRO stack_panel_callback, wPanel, strID, messageIn, component ; Make sure we have a valid widget ID IF ~WIDGET_INFO(wPanel, /VALID) THEN RETURN ; Retrieve the widget ID of the first child widget of the UI panel wChild = WIDGET_INFO(wPanel, /CHILD) ; Retrieve the state structure from the user value of the first child widget WIDGET_CONTROL, wChild, GET_UVALUE = state END ; -------------------------------------------------------------------------- ; PROCEDURE sensitize_retrieved_cloud_panel ; -------------------------------------------------------------------------- PRO sensitize_retrieved_cloud_panel COMMON CIPS_GLOBAL_STATE, cips_global_options COMMON CLOUD_WINDOW_STATE, cloud_window_options COMMON L1C_STACK_PANEL_BTNS, l1c_stack_panel_buttons COMMON STACK_PANEL_BTNS, stack_panel_buttons COMMON RETRIEVED_CLOUD_BTNS, cloud_panel_buttons COMMON SCENES_PANEL_BTNS, scenes_panel_buttons clear_l1c_stack_panel clear_stack_panel clear_scenes_panel cips_global_options.curr_view = 'clouds' WIDGET_CONTROL, cloud_panel_buttons.cld_props_btns, SENSITIVE=1 WIDGET_CONTROL, cloud_panel_buttons.option_btns, SENSITIVE=1 WIDGET_CONTROL, cloud_panel_buttons.plot_base_cloud, SENSITIVE=1 WIDGET_CONTROL, cloud_panel_buttons.export_base, SENSITIVE=1 WIDGET_CONTROL, cloud_panel_buttons.unc_btn, SENSITIVE=1 WIDGET_CONTROL, cloud_panel_buttons.map_proj_btn, SENSITIVE=1 WIDGET_CONTROL, cloud_panel_buttons.surface_btn, SENSITIVE=1 WIDGET_CONTROL, cloud_panel_buttons.contour_btns, SENSITIVE=1 if (cloud_window_options.surf_view eq 0) then begin WIDGET_CONTROL, cloud_panel_buttons.colorbar_btn, SENSITIVE=1 endif if (cips_global_options.is_l1c_stack ne 0) and (n_elements(l1c_stack_panel_buttons) gt 0) then begin WIDGET_CONTROL, l1c_stack_panel_buttons.option_btns, SENSITIVE=0 WIDGET_CONTROL, l1c_stack_panel_buttons.contour_btns, SENSITIVE=0 WIDGET_CONTROL, l1c_stack_panel_buttons.plot_base, SENSITIVE=0 WIDGET_CONTROL, l1c_stack_panel_buttons.export_base, SENSITIVE=0 WIDGET_CONTROL, l1c_stack_panel_buttons.contrast_sliders, SENSITIVE=0 WIDGET_CONTROL, l1c_stack_panel_buttons.animation_controls, SENSITIVE=0 ; if multiple views are showing (e.g. 1C coastline view), return to single view void = itgetcurrent(tool=oTool) layout_param = oTool->FindIdentifiers('*layout*') layout_obj = oTool->GetByIdentifier(layout_param) layout_props = layout_obj->QueryProperty() layout_obj->GetProperty, VIEW_COLUMNS=cols layout_obj->GetProperty, VIEW_ROWS=rows ; switch back to single panel layout if (rows gt 1) then begin result = oTool->DoSetProperty(layout_param, 'SHOW_EXECUTION_UI', 0) result = oTool->DoSetProperty(layout_param, 'LAYOUT_INDEX', 1) result = oTool->DoSetProperty(layout_param, 'VIEW_COLUMNS', 1) result = oTool->DoSetProperty(layout_param, 'VIEW_ROWS', 1) result = oTool->DoSetProperty(layout_param, 'AUTO_RESIZE', 1) result = oTool->DoAction(layout_param) oTool->CommitActions endif endif if (cips_global_options.is_stack ne 0) and (n_elements(stack_panel_buttons) gt 0) then begin WIDGET_CONTROL, stack_panel_buttons.option_btns, SENSITIVE=0 WIDGET_CONTROL, stack_panel_buttons.contour_btns, SENSITIVE=0 WIDGET_CONTROL, stack_panel_buttons.plot_base, SENSITIVE=0 WIDGET_CONTROL, stack_panel_buttons.export_base, SENSITIVE=0 WIDGET_CONTROL, stack_panel_buttons.contrast_sliders, SENSITIVE=0 WIDGET_CONTROL, stack_panel_buttons.animation_controls, SENSITIVE=0 ; if multiple views are showing (e.g. 1B coastline view), return to single view void = itgetcurrent(tool=oTool) layout_param = oTool->FindIdentifiers('*layout*') layout_obj = oTool->GetByIdentifier(layout_param) layout_props = layout_obj->QueryProperty() layout_obj->GetProperty, VIEW_COLUMNS=cols layout_obj->GetProperty, VIEW_ROWS=rows ; switch back to single panel layout if (rows gt 1) then begin result = oTool->DoSetProperty(layout_param, 'SHOW_EXECUTION_UI', 0) result = oTool->DoSetProperty(layout_param, 'LAYOUT_INDEX', 1) result = oTool->DoSetProperty(layout_param, 'VIEW_COLUMNS', 1) result = oTool->DoSetProperty(layout_param, 'VIEW_ROWS', 1) result = oTool->DoSetProperty(layout_param, 'AUTO_RESIZE', 1) result = oTool->DoAction(layout_param) oTool->CommitActions endif endif if (cips_global_options.is_scenes ne 0) and (n_elements(scenes_panel_buttons) gt 0) then begin WIDGET_CONTROL, scenes_panel_buttons.options_btns, SENSITIVE=0 WIDGET_CONTROL, scenes_panel_buttons.contours_btn, SENSITIVE=0 WIDGET_CONTROL, scenes_panel_buttons.plot_base, SENSITIVE=0 WIDGET_CONTROL, scenes_panel_buttons.export_base, SENSITIVE=0 WIDGET_CONTROL, scenes_panel_buttons.contrast_sliders, SENSITIVE=0 WIDGET_CONTROL, scenes_panel_buttons.animation_controls, SENSITIVE=0 endif END ; -------------------------------------------------------------------------- ; FUNCTION get_cloud_props_image ; -------------------------------------------------------------------------- FUNCTION get_cloud_props_image, title=title, max_value=max_value COMMON VIEW_CIPS_CLOUD, cloud_images COMMON CLOUD_WINDOW_STATE, cloud_window_options CASE cloud_window_options.view OF 'albedo': BEGIN title = 'Albedo' if (cloud_window_options.unc eq 0) then $ window_image = (cloud_images.cld_properties).cld_albedo $ else window_image = (cloud_images.cld_properties).cld_albedo_unc END 'particle_size': BEGIN title = 'Particle Size' if (cloud_window_options.unc eq 0) then $ window_image = (cloud_images.cld_properties).particle_radius $ else window_image = (cloud_images.cld_properties).particle_radius_unc END 'ozone': BEGIN title = 'Ozone Density' if (cloud_window_options.unc eq 0) then $ window_image = (cloud_images.cld_properties).ozone_col_density $ else window_image = (cloud_images.cld_properties).ozone_col_density_unc END 'scale_height': BEGIN title = 'Scale Height Ratio' if (cloud_window_options.unc eq 0) then $ window_image = (cloud_images.cld_properties).scale_height_ratio $ else window_image = (cloud_images.cld_properties).scale_height_ratio_unc END ELSE: BEGIN window_image = ptr_new() print, 'No image found' END ENDCASE if (cloud_window_options.unc eq 1) then title = title + ' Uncertainty' title = title + ' - Orbit Number ' + string((cloud_images.cld_properties).aim_orbit_number, format='(i0)') if ptr_valid(window_image) then max_value = find_image_95th_percentile(window_image) RETURN, window_image END ; -------------------------------------------------------------------------- ; PROCEDURE setup_for_cloud_plot ; -------------------------------------------------------------------------- PRO setup_for_cloud_plot, x_values, y_values, x_title, y_title, min_value, max_value COMMON VIEW_CIPS_CLOUD, cloud_images COMMON CLOUD_WINDOW_STATE, cloud_window_options ; setup x-axis CASE cloud_window_options.xplot OF 'input_albedo': BEGIN x_values = (*(cloud_images.cld_properties.cloud_no_phase))[*] x_title = 'Input Albedo' END 'zenith_angle': BEGIN if cloud_images.cld_properties.version le 3.00 then begin x_values = (*(cloud_images.cld_properties.zenith_angle))[*] endif else begin x_values = (*(cloud_images.cld_properties.zenith_angle_ray_peak))[*] endelse x_title = 'Solar Zenith Angle' END 'latitude': BEGIN x_values = (*(cloud_images.cld_properties.latitude))[*] x_title = 'Latitude' END 'stack_thickness': BEGIN x_values = (*(cloud_images.cld_properties.indicators.nlayer))[*] x_title = 'Stack Thickness' END ELSE: break ENDCASE ; setup y-axis CASE cloud_window_options.yplot OF 'albedo': BEGIN y_values = (*(cloud_images.cld_properties.cld_albedo))[*] ;y_values = cloud_window_options.scaling_min > ; (*(cloud_images.cld_properties.cld_albedo))[*] ; < cloud_window_options.scaling_max y_title = 'Cloud Albedo' max_value = 50.0 min_value = 0.0 END 'particle_size': BEGIN y_values = (*(cloud_images.cld_properties.particle_radius))[*] ;y_values = cloud_window_options.scaling_min > ; (*(cloud_images.cld_properties.particle_radius))[*] ; < cloud_window_options.scaling_max y_title = 'Particle Size' max_value = 100.0 min_value = 0.0 END 'ozone_density': BEGIN y_values = (*(cloud_images.cld_properties.ozone_col_density))[*] ;y_values = cloud_window_options.scaling_min > ; (*(cloud_images.cld_properties.ozone_col_density))[*] ; < cloud_window_options.scaling_max y_title = 'Ozone Density' max_value = 100.0 min_value = 0.0 END 'scale_height': BEGIN y_values = (*(cloud_images.cld_properties.scale_height_ratio))[*] ;y_values = cloud_window_options.scaling_min > ; (*(cloud_images.cld_properties.scale_height_ratio))[*] ; < cloud_window_options.scaling_max y_title = 'Scale Height Ratio' max_value = 2.0 min_value = 0.0 END 'correlation': BEGIN y_values = (*(cloud_images.cld_properties.indicators.corr))[*] ;y_values = cloud_window_options.scaling_min > ; (*(cloud_images.cld_properties.indicators.corr))[*] ; < cloud_window_options.scaling_max y_title = 'Correlation' max_value = 1.0 min_value = 0.0 END 'slope_ratio': BEGIN y_values = (*(cloud_images.cld_properties.indicators.sloperat))[*] ;y_values = cloud_window_options.scaling_min > ; (*(cloud_images.cld_properties.indicators.sloperat))[*] ; < cloud_window_options.scaling_max y_title = 'Slope Ratio' max_value = 1.0 min_value = 0.0 END 'all_ratio': BEGIN y_values = (*(cloud_images.cld_properties.indicators.ratall))[*] ;y_values = cloud_window_options.scaling_min > ; (*(cloud_images.cld_properties.indicators.ratall))[*] ; < cloud_window_options.scaling_max y_title = 'All Ratio' max_value = 1.0 min_value = 0.0 END 'rat2': BEGIN y_values = (*(cloud_images.cld_properties.indicators.rat2))[*] ;y_values = cloud_window_options.scaling_min > ; (*(cloud_images.cld_properties.indicators.rat2))[*] ; < cloud_window_options.scaling_max y_title = 'Rat 2' max_value = 1.0 min_value = 0.0 END 'precloud1': BEGIN y_values = (*(cloud_images.cld_properties.indicators.precloud1))[*] ;y_values = cloud_window_options.scaling_min > ; (*(cloud_images.cld_properties.indicators.precloud1))[*] ; < cloud_window_options.scaling_max y_title = 'Precloud 1' max_value = 2.0 min_value = 0.0 END 'precloud2': BEGIN y_values = (*(cloud_images.cld_properties.indicators.precloud2))[*] ;y_values = cloud_window_options.scaling_min > ; (*(cloud_images.cld_properties.indicators.precloud2))[*] ; < cloud_window_options.scaling_max y_title = 'Precloud 2' max_value = 2.0 min_value = 0.0 END 'rr2': BEGIN y_values = (*(cloud_images.cld_properties.indicators.rr2))[*] ;y_values = cloud_window_options.scaling_min > ; (*(cloud_images.cld_properties.indicators.rr2))[*] ; < cloud_window_options.scaling_max y_title = 'RR 2' max_value = 2.0 min_value = 0.0 END 'chi_square': BEGIN y_values = (*(cloud_images.cld_properties.indicators.chi_square))[*] ;y_values = cloud_window_options.scaling_min > ; (*(cloud_images.cld_properties.indicators.chi_square))[*] ; < cloud_window_options.scaling_max y_title = 'Chi Square' max_value = 2.0 min_value = 0.0 END ELSE: break ENDCASE END ; -------------------------------------------------------------------------- ; PROCEDURE remove_retrieval_coastlines ; -------------------------------------------------------------------------- pro remove_retrieval_coastlines, oTool idCoast = oTool->FindIdentifiers('*SPACE/PLOT*', /VISUALIZATIONS) for i=0, N_ELEMENTS(idCoast)-1 do begin if idCoast[i] ne '' then begin success = oTool->RemoveByIdentifier(idCoast[i]) endif endfor END ; -------------------------------------------------------------------------- ; PROCEDURE show_retrieval_coastlines ; -------------------------------------------------------------------------- pro show_retrieval_coastlines, oTool, oView, line_color COMMON CIPS_GLOBAL_STATE, cips_global_options COMMON VIEW_CIPS_CLOUD, cloud_images COMMON CLOUD_WINDOW_STATE, cloud_window_options if (cloud_window_options.show_coast eq 1) then begin if n_elements(coast) eq 0 then restore, !COMMON_INPUT_DATA + '/coast.sav' if strcmp(cloud_images.cld_properties.hemisphere, 'S') eq 1 then south=1 else south=0 project_lambert, lat=coast[1,*], lon=coast[0,*], x=x, y=y, $ center_lon=cloud_images.cld_properties.center_lon, $ south=south, _extra=extra iplot, (x-cloud_images.cld_properties.bbox[0])/3, $ (y-cloud_images.cld_properties.bbox[1])/3, $ overplot=oTool, COLOR=line_color if (cips_global_options.colorbar eq 0) then oView->SetCurrentZoom, 2 lat_lon_color=[119,119,119] show_global_lat_lon, oTool, lat_lon_color ;void = oTool->DoAction(oTool->findidentifiers('*SENDTOBACK*', /OPERATIONS)) endif END ; -------------------------------------------------------------------------- ; PROCEDURE show_global_lat_lon ; -------------------------------------------------------------------------- pro show_global_lat_lon, oTool, line_color COMMON VIEW_CIPS_CLOUD, cloud_images idx = 0 ; build lat lat_lon=make_array(2, 13718, /float) for lat=-90.0, 90.0, 10 do begin for lon=-180.0, 180.0 do begin lat_lon[0, idx] = lat lat_lon[1, idx] = lon idx++ endfor endfor ; build lon for lon=-180.0, 180.0, 10 do begin for lat=-90.0, 90.0 do begin lat_lon[0, idx] = lat lat_lon[1, idx] = lon idx++ endfor endfor if strcmp(cloud_images.cld_properties.hemisphere, 'S') eq 1 then south=1 else south=0 project_lambert, lon=lat_lon[1,*], lat=lat_lon[0,*], x=x, y=y, $ center_lon=cloud_images.cld_properties.center_lon, $ south=south, _extra=extra iplot, (x-cloud_images.cld_properties.bbox[0])/3, $ (y-cloud_images.cld_properties.bbox[1])/3, $ overplot=oTool, COLOR=line_color, linestyle=1 view_ID = oTool->FindIdentifiers('*VIEW_1') oView = oTool->GetByIdentifier(view_ID) oView->Select, 1 end ; -------------------------------------------------------------------------- ; PROCEDURE draw_cloud_contours ; -------------------------------------------------------------------------- pro draw_cloud_contours, oTool COMMON COLORS, R_orig, G_orig, B_orig, R_curr, G_curr, B_curr COMMON CIPS_GLOBAL_STATE, cips_global_options COMMON VIEW_CIPS_CLOUD, cloud_images COMMON CLOUD_WINDOW_STATE, cloud_window_options if (cloud_window_options.surf_view eq 1) and (cips_global_options.black_bg eq 0) then begin linecolor=[0,0,0] endif else begin linecolor=[255,255,255] endelse ; clear any existing contours idCON = oTool->FindIdentifiers('*SPACE/CONTOUR*', /VISUALIZATIONS) for i=0, N_ELEMENTS(idCON)-1 do begin if idCON[i] ne '' then begin success = oTool->RemoveByIdentifier(idCON[i]) endif endfor ; draw SZA contours if (cloud_window_options.sza_contours eq 1) then begin contour_values = indgen(30) * 6 if cloud_images.cld_properties.version le 3.00 then begin zenith_angles = *(cloud_images.cld_properties).zenith_angle endif else begin zenith_angles = *(cloud_images.cld_properties).zenith_angle_ray_peak endelse icontour, zenith_angles, overplot=oTool, COLOR=linecolor, C_VALUE=contour_values, C_LABEL_SHOW=contour_values endif ; draw lat/lon contours if (cloud_window_options.latlon_contours eq 1) then begin lat_contour_values = [ -180, -170, -160, -150, -140, -130, -120, -110, -100, -90, $ -80, -70, -60, -50, -40, -30, -20, -10, 0, 10, 20, 30, 40, $ 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180 ] lat_contour_labels = [ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 ] lon_contour_values = [ -180, -140, -100, -60, -20, 20, 60, 100, 140, 180 ] icontour, *(cloud_images.cld_properties).latitude, overplot=oTool, COLOR=linecolor, C_VALUE=lat_contour_values, C_LABEL_SHOW=lat_contour_labels icontour, *(cloud_images.cld_properties).longitude, overplot=oTool, COLOR=linecolor, C_VALUE=lon_contour_values, C_LABEL_SHOW=lon_contour_values endif end ; -------------------------------------------------------------------------- ; PROCEDURE retrieved_cloud_panel_event ; -------------------------------------------------------------------------- ; INPUT PARAMETERS: (Automatically sent by the iTools environment) ; event - a widget event generated by a widget ; PRO retrieved_cloud_panel_event, event COMMON COLORS, R_orig, G_orig, B_orig, R_curr, G_curr, B_curr COMMON VIEW_CIPS_CLOUD, cloud_images COMMON SCENES_WINDOW_STATE, scenes_window_options COMMON STACK_WINDOW_STATE, stack_window_options COMMON CLOUD_WINDOW_STATE, cloud_window_options COMMON CIPS_GLOBAL_STATE, cips_global_options COMMON RETRIEVED_CLOUD_BTNS, cloud_panel_buttons COMMON L1C_STACK_PANEL_BTNS, l1c_stack_panel_buttons COMMON STACK_PANEL_BTNS, stack_panel_buttons COMMON SCENES_PANEL_BTNS, scenes_panel_buttons ; Initialize exec_option and color variables exec_option = 0 colorbar_needs_updating = 0 if (cips_global_options.black_bg eq 1) then begin bg_color = [0, 0, 0] line_color = [255, 255, 255] endif else begin bg_color = [255, 255, 255] line_color = [0, 0, 0] endelse ; Retrieve widget ID of first child widget of the UI panel wChild = WIDGET_INFO(event.handler, /CHILD) ; Retrieve the state structure from the user value of the first child widget. WIDGET_CONTROL, wChild, GET_UVALUE = state ; Retrieve the user value of the widget that generated the event WIDGET_CONTROL, event.id, GET_UVALUE = uvalue oTool=state.oTool view_ID = oTool->FindIdentifiers('*VIEW_1') oView = oTool->GetByIdentifier(view_ID) CASE WIDGET_INFO(event.id, /UNAME) OF 'SHOWBLACKBGBTN': BEGIN ; Set the black_bg variable and set up the color scheme cips_global_options.black_bg = WIDGET_INFO(event.id, /BUTTON_SET) if (cips_global_options.black_bg eq 1) then begin bg_color = [0, 0, 0] line_color = [255, 255, 255] font_param = oTool->FindIdentifiers('*STYLE/ANNOTATIONS/TEXT*') result = oTool->DoSetProperty(font_param, 'FONT_SIZE', 20) result = oTool->DoSetProperty(font_param, 'COLOR', line_color) oTool->CommitActions endif else begin bg_color = [255, 255, 255] line_color = [0, 0, 0] font_param = oTool->FindIdentifiers('*STYLE/ANNOTATIONS/TEXT*') result = oTool->DoSetProperty(font_param, 'FONT_SIZE', 20) result = oTool->DoSetProperty(font_param, 'COLOR', line_color) oTool->CommitActions endelse if n_elements(l1c_stack_panel_buttons) ne 0 then begin WIDGET_CONTROL, l1c_stack_panel_buttons.black_bg_btn, $ SET_BUTTON=cips_global_options.black_bg endif if n_elements(stack_panel_buttons) ne 0 then begin WIDGET_CONTROL, stack_panel_buttons.black_bg_btn, $ SET_BUTTON=cips_global_options.black_bg endif if n_elements(scenes_panel_buttons) ne 0 then begin WIDGET_CONTROL, scenes_panel_buttons.black_bg_btn, $ SET_BUTTON=cips_global_options.black_bg endif if cips_global_options.colorbar eq 1 then update_colorbar exec_option = 1 END 'SHOWSURFACEBTN':BEGIN cloud_window_options.surf_view = WIDGET_INFO(event.id, /BUTTON_SET) ; if the surface button was unselected if (cloud_window_options.surf_view eq 0) then begin ; re-enable coastlines and colorbars WIDGET_CONTROL, cloud_panel_buttons.map_proj_btn, SENSITIVE=1 WIDGET_CONTROL, cloud_panel_buttons.colorbar_btn, SENSITIVE=1 ; clear screen result = [oTool->FindIdentifiers('*VIEW_*VISUALIZATION LAYER/DATA SPACE'), $ oTool->FindIdentifiers('*VIEW_*ANNOTATION LAYER/COLORBAR*')] for i=0, N_ELEMENTS(result)-1 do begin if result[i] ne '' then begin success = oTool->RemoveByIdentifier(result[i]) endif endfor ; surface view endif else begin ; disable coastline display and colorbars WIDGET_CONTROL, cloud_panel_buttons.map_proj_btn, SENSITIVE=0 WIDGET_CONTROL, cloud_panel_buttons.colorbar_btn, SENSITIVE=0 cips_global_options.colorbar = 0 update_colorbar endelse exec_option = 1 END 'SHOWCOASTBTN': BEGIN cloud_window_options.show_coast = WIDGET_INFO(event.id, /BUTTON_SET) ; if in coastline view, don't allow surface plots if cloud_window_options.show_coast eq 1 then begin WIDGET_CONTROL, cloud_panel_buttons.surface_btn, SENSITIVE=0 endif else begin WIDGET_CONTROL, cloud_panel_buttons.surface_btn, SENSITIVE=1 endelse if (cloud_window_options.show_coast eq 1) then begin show_retrieval_coastlines, oTool, oView, line_color endif else begin remove_retrieval_coastlines, oTool endelse END 'SHOWSZACONTOURSBTN': BEGIN cloud_window_options.sza_contours = WIDGET_INFO(event.id, /BUTTON_SET) draw_cloud_contours, oTool END 'SHOWLATLONCONTOURSBTN':BEGIN cloud_window_options.latlon_contours = WIDGET_INFO(event.id, /BUTTON_SET) draw_cloud_contours, oTool END 'CLEARCONTOURSBTN':BEGIN cloud_window_options.latlon_contours = 0 cloud_window_options.sza_contours = 0 END 'SHOWCOLORBARBTN': BEGIN cips_global_options.colorbar = WIDGET_INFO(event.id, /BUTTON_SET) update_colorbar END 'MAXCONTRASTSLIDER': BEGIN cloud_window_options.scaling_max = event.value WIDGET_CONTROL, cloud_panel_buttons.max_value_label, $ set_value=' '+strtrim(string(event.value),2)+'%' exec_option=1 END 'MINCONTRASTSLIDER': BEGIN cloud_window_options.scaling_min = event.value WIDGET_CONTROL, cloud_panel_buttons.min_value_label, $ set_value=' '+strtrim(string(event.value),2)+'%' exec_option=1 END 'SHOWPLOTBTN': BEGIN ; if in coastline view, remove if (cloud_window_options.show_coast eq 1) then remove_retrieval_coastlines, oTool ; clear panel buttons if (cloud_window_options.view ne '') and (cloud_window_options.view ne 'plot') then begin clear_retrieved_cloud_panel endif cloud_window_options.view = 'plot' WIDGET_CONTROL, cloud_panel_buttons.option_btns, SENSITIVE=0 WIDGET_CONTROL, cloud_panel_buttons.unc_btn, SENSITIVE=0 WIDGET_CONTROL, cloud_panel_buttons.contour_btns, SENSITIVE=0 ; clear any labels and/or colorbars result = [oTool->FindIdentifiers('*VIEW_1*TEXT*'), $ oTool->FindIdentifiers('*ANNOTATION LAYER/COLORBAR*')] for i=0, N_ELEMENTS(result)-1 do begin if result[i] ne '' then begin success = oTool->RemoveByIdentifier(result[i]) endif endfor setup_for_cloud_plot, x_values, y_values, x_title, y_title, min_value, max_value min_max = filter_sigma(y_values, 5) if((n_elements(max_value) ne 0) and (n_elements(min_value) ne 0)) then begin iplot, x_values, min_max[0]> y_values y_values SetCurrentZoom, 1.0 oView->Select, 1 END 'EXPORTBTN': BEGIN filename = dialog_pickfile(DIALOG_PARENT=event.handler, /WRITE, /OVERWRITE_PROMPT, path=!USER_DATA_PATH) if(strtrim(filename, 2) ne '') then begin data = cloud_images.cld_properties save, data, filename=filename endif END 'ALBEDOBTN': BEGIN ; Return on a button-release event if (event.select eq 0) then return ; if coming from another panel or switching from plot to image view, update colorbar if (cloud_window_options.view eq 'plot') or (cips_global_options.curr_view ne 'clouds') then begin case cips_global_options.curr_view of 'scenes' : if (scenes_window_options.view eq 'plot') then colorbar_needs_updating = 1 'stack' : if (stack_window_options.view eq 'plot') then colorbar_needs_updating = 1 'clouds' : if (cloud_window_options.view eq 'plot') then colorbar_needs_updating = 1 else : message, cips_global_options.curr_view + ' not found', /info endcase endif sensitize_retrieved_cloud_panel cloud_window_options.view = 'albedo' exec_option = 1 END 'PARTSIZEBTN': BEGIN ; Return on a button-release event if (event.select eq 0) then return ; if coming from another panel or switching from plot to image view, update colorbar if (cloud_window_options.view eq 'plot') or (cips_global_options.curr_view ne 'clouds') then begin case cips_global_options.curr_view of 'scenes' : if (scenes_window_options.view eq 'plot') then colorbar_needs_updating = 1 'stack' : if (stack_window_options.view eq 'plot') then colorbar_needs_updating = 1 'clouds' : if (cloud_window_options.view eq 'plot') then colorbar_needs_updating = 1 else : message, cips_global_options.curr_view + ' not found', /info endcase endif sensitize_retrieved_cloud_panel cloud_window_options.view = 'particle_size' exec_option = 1 END 'OZONEDENBTN': BEGIN ; Return on a button-release event if (event.select eq 0) then return ; if coming from another panel or switching from plot to image view, update colorbar if (cloud_window_options.view eq 'plot') or (cips_global_options.curr_view ne 'clouds') then begin case cips_global_options.curr_view of 'scenes' : if (scenes_window_options.view eq 'plot') then colorbar_needs_updating = 1 'stack' : if (stack_window_options.view eq 'plot') then colorbar_needs_updating = 1 'clouds' : if (cloud_window_options.view eq 'plot') then colorbar_needs_updating = 1 else : message, cips_global_options.curr_view + ' not found', /info endcase endif sensitize_retrieved_cloud_panel cloud_window_options.view = 'ozone' exec_option = 1 END 'SCALERATBTN': BEGIN ; Return on a button-release event if (event.select eq 0) then return ; if coming from another panel or switching from plot to image view, update colorbar if (cloud_window_options.view eq 'plot') or (cips_global_options.curr_view ne 'clouds') then begin case cips_global_options.curr_view of 'scenes' : if (scenes_window_options.view eq 'plot') then colorbar_needs_updating = 1 'stack' : if (stack_window_options.view eq 'plot') then colorbar_needs_updating = 1 'clouds' : if (cloud_window_options.view eq 'plot') then colorbar_needs_updating = 1 else : message, cips_global_options.curr_view + ' not found', /info endcase endif sensitize_retrieved_cloud_panel cloud_window_options.view = 'scale_height' exec_option = 1 END 'UNCBTN': BEGIN ; if showing a plot, don't let the uncertainty button cause a swap to an ; image view since uncertainty alone isn't an image if (cloud_window_options.view eq 'plot') then begin WIDGET_CONTROL, state.uncertainty_btn, set_button=0 return endif cloud_window_options.unc = WIDGET_INFO(event.id, /BUTTON_SET) exec_option = 1 END ENDCASE ; If we want to redraw... if ( exec_option eq 1 ) then begin void = itgetcurrent(tool=oTool) ; Get the min and max values for the image if (cloud_window_options.view eq 'ozone') then begin ; temp fix min_max = make_array(2, /float) img = get_cloud_props_image(max_value=max_value) min_max[0] = 0 min_max[1] = max_value endif else begin min_max = filter_sigma(*(get_cloud_props_image()), 5) endelse scale = min_max[1] - min_max[0] min_max[1] = min_max[0] + scale*(cloud_window_options.scaling_max/100.0) min_max[0] = min_max[0] + scale*(cloud_window_options.scaling_min/100.0) ; Reset colors to black/white if zeroed out ret = where(r_orig eq 0, count_r) ret = where(g_orig eq 0, count_g) ret = where(b_orig eq 0, count_b) if ((count_r eq 256) and (count_g eq 256) and (count_b eq 256)) then loadct, 0 ; remove any labels result = oTool->FindIdentifiers('*VIEW_1*TEXT*') for i=0, N_ELEMENTS(result)-1 do begin if result[i] ne '' then begin success = oTool->RemoveByIdentifier(result[i]) endif endfor ;loadct, 0 ; surface view if (cloud_window_options.surf_view eq 1) then begin oView->SetCurrentZoom, 1 iSurface, 0> *(get_cloud_props_image(title=title)), $ STYLE=2, SHADING=1, XTEXT_COLOR=line_color, $ YTEXT_COLOR=line_color, ZTEXT_COLOR=line_color, $ BACKGROUND_COLOR=bg_color, VIEW_TITLE=title, VIEW_NUMBER=1 ; image view endif else begin image_dims = size(*(get_cloud_props_image()), /DIMENSIONS) ; display new image iImage, 0 > *(get_cloud_props_image(title=title)), $ BACKGROUND_COLOR=bg_color, RGB_TABLE=[[r_orig], [g_orig], [b_orig]], $ ;BACKGROUND_COLOR=bg_color, $;RGB_TABLE=[[r], [g], [b]], $ VIEW_TITLE=title, VIEW_NUMBER=1 endelse if (colorbar_needs_updating eq 1) then update_colorbar draw_cloud_contours, oTool if (cloud_window_options.show_coast eq 1) then begin show_retrieval_coastlines, oTool, oView, line_color show_global_lat_lon, oTool, line_color endif endif END ; -------------------------------------------------------------------------- ; PROCEDURE init_retrieved_cloud_panel ; -------------------------------------------------------------------------- PRO init_retrieved_cloud_panel, widgetID COMMON CLOUD_WINDOW_STATE, cloud_window_options COMMON RETRIEVED_CLOUD_BTNS, cloud_panel_buttons sensitize_retrieved_cloud_panel ; init font void = ITGetCurrent(tool=oTool) font_param = oTool->FindIdentifiers('*STYLE/ANNOTATIONS/TEXT*') result = oTool->DoSetProperty(font_param, 'FONT_SIZE', 20) result = oTool->DoSetProperty(font_param, 'COLOR', [0,0,0]) oTool->CommitActions ; window initializes with albedo... if cloud_window_options.view eq 'albedo' then widget_control, cloud_panel_buttons.albedo, /SET_BUTTON END ; -------------------------------------------------------------------------- ; PROCEDURE set_x_axis_plot_retrieval ; -------------------------------------------------------------------------- pro set_x_axis_plot_retrieval, event COMMON CLOUD_WINDOW_STATE, cloud_window_options CASE event.str OF 'Input Albedo': cloud_window_options.xplot = 'input_albedo' 'Solar Zenith Angle': cloud_window_options.xplot = 'zenith_angle' 'Latitude': cloud_window_options.xplot = 'latitude' 'Stack Thickness': cloud_window_options.xplot = 'stack_thickness' ELSE: print, 'x-axis value not implemented' ENDCASE return end ; -------------------------------------------------------------------------- ; PROCEDURE set_y_axis_plot_retrieval ; -------------------------------------------------------------------------- pro set_y_axis_plot_retrieval, event COMMON CLOUD_WINDOW_STATE, cloud_window_options ; Note: 'particle size ' has two extra spaces to keep the buttons the ; same size. the spaces are important here too or that event won't be ; recognized. CASE event.str OF 'Albedo': cloud_window_options.yplot = 'albedo' 'Particle Size ': cloud_window_options.yplot = 'particle_size' 'Ozone Density': cloud_window_options.yplot = 'ozone_density' 'Scale Height Ratio': cloud_window_options.yplot = 'scale_height' 'Correlation': cloud_window_options.yplot = 'correlation' 'Slope Ratio': cloud_window_options.yplot = 'slope_ratio' 'All Ratio': cloud_window_options.yplot = 'all_ratio' 'Rat2': cloud_window_options.yplot = 'rat2' 'Precloud 1': cloud_window_options.yplot = 'precloud1' 'Precloud 2': cloud_window_options.yplot = 'precloud2' 'RR 2': cloud_window_options.yplot = 'rr2' 'Chi Square': cloud_window_options.yplot = 'chi_square' ELSE: print, 'y-axis value not implemented' ENDCASE return end ; -------------------------------------------------------------------------- ; PROCEDURE retrieved_cloud_panel ; -------------------------------------------------------------------------- PRO retrieved_cloud_panel, wPanel, oUI COMMON VIEW_CIPS_CLOUD, cloud_images COMMON CLOUD_WINDOW_STATE, cloud_window_options ; Name the panel WIDGET_CONTROL, wPanel, BASE_SET_TITLE = cloud_images.panel_name ; Specify the event handler WIDGET_CONTROL, wPanel, EVENT_PRO = "retrieved_cloud_panel_event" ; Register the panel with the UI object strObserverIdentifier = oUI->RegisterWidget(wPanel, "Panel", 'retrieved_cloud_panel_callback') ; Get reference to current iTool oTool = oUI->GetTool() ; Create widget base wBase = WIDGET_BASE(wPanel, /COLUMN, SPACE = 10, /BASE_ALIGN_CENTER, $ NOTIFY_REALIZE='init_retrieved_cloud_panel') ; options options_base_cloud = WIDGET_BASE(wBase, /COLUMN, /FRAME, UNAME='WINDOWBASE', xsize=250, /align_center) label = widget_label(options_base_cloud, value='-- Options --') options_check_base_cloud = widget_base(options_base_cloud, /NONEXCLUSIVE, /COLUMN) check_black_bg_base = widget_base(options_base_cloud, /NONEXCLUSIVE, /COLUMN) show_black_bg_btn = widget_button(options_check_base_cloud, value='Black Background', $ UNAME='SHOWBLACKBGBTN', /ALIGN_LEFT) show_colorbar_btn = widget_button(options_check_base_cloud, value='Insert Colorbar', $ UNAME='SHOWCOLORBARBTN', /ALIGN_LEFT) check_surface_base = widget_base(options_base_cloud, /NONEXCLUSIVE, /COLUMN) show_surface_btn = widget_button(options_check_base_cloud, value='Surface View', /ALIGN_LEFT, $ UNAME='SHOWSURFACEBTN') show_map_proj_btn = widget_button(options_check_base_cloud, value='Show Coastlines', $ UNAME='SHOWCOASTBTN', /ALIGN_LEFT) export_var_btn = widget_button(options_base_cloud, value='Export Data', UNAME='EXPORTBTN', $ xsize=195, /align_center) ; scaling ;contrast_base_scene = widget_base(wBase, /COLUMN, /FRAME, UNAME='CONTRASTBASE', xsize=250, / align_left) ;label = widget_label(contrast_base_scene, value='-- Scaling --') ;horiz_base = widget_base(contrast_base_scene, /ROW, UNAME='MAXCONTRASTBASE', xsize=250, /align_left) ;label = widget_label(horiz_base, value='Max Value: ') ;max_contrast_slider = widget_slider(horiz_base, /SUPPRESS_VALUE, minimum=0, maximum=100, uname='MAXCONTRASTSLIDER', value=100) ;max_value_label = widget_label(horiz_base, value='100 %', xsize=70) ;horiz_base = widget_base(contrast_base_scene, /ROW, UNAME='MINCONTRASTBASE', xsize=250, /align_left) ;label = widget_label(horiz_base, value='Min Value: ') ;min_contrast_slider = widget_slider(horiz_base, /SUPPRESS_VALUE, minimum=0, maximum=100, uname='MINCONTRASTSLIDER', value=0) ;min_value_label = widget_label(horiz_base, value=' 0 %', xsize=70) ; contour plot selection contours_base_cloud = widget_base(wBase, /COLUMN, /FRAME, UNAME='CONTOURSBASE', xsize=250, /align_center) contours_label = widget_label(contours_base_cloud, value='-- Contour Plots --') contour_btns = widget_base(contours_base_cloud, /COLUMN, /ALIGN_LEFT, /EXCLUSIVE) clear_contours_btn = widget_button(contour_btns, value='None', $ UNAME='CLEARCONTOURSBTN', /ALIGN_LEFT) show_sza_contours_btn = widget_button(contour_btns, value='Solar Zenith Angles', $ UNAME='SHOWSZACONTOURSBTN', /ALIGN_LEFT) show_latlon_contours_btn = widget_button(contour_btns, value='Lat/Lon', $ UNAME='SHOWLATLONCONTOURSBTN', /ALIGN_LEFT) ; images cld_property_tags = tag_names(cloud_images.cld_properties) junk = where('OZONE_COL_DENSITY' eq cld_property_tags, has_ozone) junk = where('SCALE_HEIGHT_RATIO' eq cld_property_tags, has_scale_height) junk = where('INDICATORS' eq cld_property_tags, has_indicators) retrieval_base = widget_base(wBase, /COLUMN, /FRAME, UNAME='PLOTBASE', xsize=247, /align_center) label = widget_label(retrieval_base, value='-- Cloud Property Images --') cld_props_base = widget_base(retrieval_base, /EXCLUSIVE, /COLUMN) albedo_btn = widget_button(cld_props_base, value='Albedo ', UNAME='ALBEDOBTN') partsize_btn = widget_button(cld_props_base, value='Particle Size ', UNAME='PARTSIZEBTN') if has_ozone then ozoneden_btn = widget_button(cld_props_base, value='Ozone Density ', UNAME='OZONEDENBTN') $ else ozoneden_btn = ptr_new() if has_scale_height then scalerat_btn = widget_button(cld_props_base, value='Scale Ht. Ratio ', UNAME='SCALERATBTN') $ else scalerat_btn = ptr_new() check_unc_base = widget_base(retrieval_base, /NONEXCLUSIVE, /COLUMN) uncertainty_btn = widget_button(check_unc_base, value='Uncertainty', /ALIGN_LEFT, UNAME='UNCBTN') ; scatter plots plot_base_cloud = widget_base(wBase, /COLUMN, /FRAME, UNAME='PLOTBASE', xsize=250, /align_center) plot_label = widget_label(plot_base_cloud, value='-- Scatter Plots --') temp_base = widget_base(plot_base_cloud, /ROW) x_label = widget_label(temp_base, value='x-axis ') tags = tag_names(cloud_images.cld_properties) sim_check = where(strmatch(tags, 'cloud_no_phase') eq 1) if sim_check eq 1 then begin ; pre-launch simulated data xdroplist = widget_combobox(temp_base, UNAME='XDROP', EVENT_PRO='set_x_axis_plot_retrieval', $ value=['Input Albedo','Solar Zenith Angle','Latitude', 'Stack Thickness']) cloud_window_options.xplot = 'input_albedo' endif else begin xoptions = ['Solar Zenith Angle','Latitude'] if has_indicators then xoptions=[xoptions, 'Stack Thickness'] xdroplist = widget_combobox(temp_base, UNAME='XDROP', EVENT_PRO='set_x_axis_plot_retrieval', $ value=xoptions) cloud_window_options.xplot = 'zenith_angle' endelse temp_base = widget_base(plot_base_cloud, /ROW) y_label = widget_label(temp_base, value='y-axis ') if sim_check eq 1 then begin ; pre-launch simulated data ydroplist = widget_combobox(temp_base, UNAME='YDROP', EVENT_PRO='set_y_axis_plot_retrieval', $ value=['Albedo' ,'Particle Size ',$ 'Ozone Density' ,'Scale Height Ratio' ,$ 'Correlation' , 'Slope Ratio' ,$ 'All Ratio' , 'Rat2', 'Precloud' ]) cloud_window_options.yplot = 'albedo' endif else begin yoptions = ['Albedo', 'Particle Size '] if has_ozone then yoptions=[yoptions, 'Ozone Density'] if has_scale_height then yoptions=[yoptions, 'Scale Height Ratio'] ; the indicators that are produced varies depending on how the ; processing is run. for production processing, indicators that ; are slow to process are NOT calclated. for testing and analysis ; runs, indicators that take awhile to process (e.g. Chi Square, ; pre-cloud) are also calculated if has_indicators then begin if size(((*cloud_images.cld_properties.indicators.corr)[0]), /type) eq 4 $ then yoptions=[yoptions, 'Correlation'] if size(((*cloud_images.cld_properties.indicators.sloperat)[0]), /type) eq 4 $ then yoptions=[yoptions, 'Slope Ratio'] if size(((*cloud_images.cld_properties.indicators.ratall)[0]), /type) eq 4 $ then yoptions=[yoptions, 'All Ratio'] if size(((*cloud_images.cld_properties.indicators.rat2)[0]), /type) eq 4 $ then yoptions=[yoptions, 'Rat2'] if size(((*cloud_images.cld_properties.indicators.precloud1)[0]), /type) eq 4 $ then yoptions=[yoptions, 'Precloud 1'] if size(((*cloud_images.cld_properties.indicators.precloud2)[0]), /type) eq 4 $ then yoptions=[yoptions, 'Precloud 2'] if size(((*cloud_images.cld_properties.indicators.rr2)[0]), /type) eq 4 $ then yoptions=[yoptions, 'RR 2'] if size(((*cloud_images.cld_properties.indicators.chi_square)[0]), /type) eq 4 $ then yoptions=[yoptions, 'Chi Square'] endif ydroplist = widget_combobox(temp_base, UNAME='YDROP', EVENT_PRO='set_y_axis_plot_retrieval', $ value=yoptions) cloud_window_options.yplot = 'albedo' endelse y_label_geom = WIDGET_INFO(y_label, /geom, units=0) ydroplist_geom = WIDGET_INFO(ydroplist, /geom, units=0) showplot_btn = widget_button(plot_base_cloud, value='Show Plot', UNAME='SHOWPLOTBTN', xsize=195, /align_center) WIDGET_CONTROL, plot_base_cloud, set_uvalue={ xdroplist : xdroplist, ydroplist : ydroplist } ; Create state structure in first child state = { oTool:oTool, $ oUI:oUI, $ wPanel:wPanel, $ wBase:wBase, $ options_base_cloud:options_base_cloud, $ ;max_contrast_slider:max_contrast_slider, $ ;max_value_label:max_value_label, $ ;min_contrast_slider:min_contrast_slider, $ ;min_value_label:min_value_label, $ albedo_btn:albedo_btn, $ partsize_btn:partsize_btn, $ ozoneden_btn:ozoneden_btn, $ scalerat_btn:scalerat_btn, $ uncertainty_btn:uncertainty_btn, $ show_surface_btn:show_surface_btn, $ show_map_proj_btn:show_map_proj_btn, $ clear_contours_btn:clear_contours_btn, $ show_sza_contours_btn:show_sza_contours_btn, $ show_latlon_contours_btn:show_latlon_contours_btn, $ show_black_bg_btn:show_black_bg_btn, $ plot_base_cloud:plot_base_cloud, $ showplot_btn:showplot_btn, $ show_colorbar_btn:show_colorbar_btn, $ export_var_btn:export_var_btn $ } wChild = WIDGET_INFO(wPanel, /CHILD) IF wChild NE 0 THEN WIDGET_CONTROL, wChild, SET_UVALUE = state, /NO_COPY ; Add the wPanel object to the data manager ; Create the IDLitDataObject oPanel = OBJ_NEW('IDLitData', wPanel, IDENTIFIER = 'SPLIT_PANEL2') ; Add the data object to the data manager oTool->AddByIdentifier, '/Data Manager', oData ; structure that will be stored in common block so buttons can be ; cleared on a 'view plot' event COMMON RETRIEVED_CLOUD_BTNS, cloud_panel_buttons cloud_panel_buttons = {cld_props_btns: cld_props_base, $ albedo:albedo_btn, $ unc_btn: uncertainty_btn, $ surface_btn: show_surface_btn, $ map_proj_btn: show_map_proj_btn, $ option_btns: options_check_base_cloud, $ black_bg_btn: show_black_bg_btn, $ colorbar_btn: show_colorbar_btn, $ ;max_value_label: max_value_label, $ ;min_value_label: min_value_label, $ contours_base_cloud:contours_base_cloud, $ contour_btns:contour_btns, $ plot_base_cloud: plot_base_cloud, $ export_base: export_var_btn $ } END