function wrf_map_overlays_ggp(in_file[1]:file, \ lat[*][*]:numeric, lon[*][*]:numeric,\ wks:graphic, \ plots[*]:graphic, \ opt_arg[1]:logical, \ opt_mp[1]:logical) ; This procedure takes an array of plots and overlays them on a ; base plot - map background. ; ; It will advance the plot and cleanup, unless you set the ; PanelPlot resource to True. ; ; Attributes recognized by this procedure: ; FramePlot ; PanelPlot ; NoTitles (don't do any titles) ; CommonTitle & PlotTitle is used to overwrite field titles ; CommonTitle will supercede NoTitles ; LatLonOverlay ; ; If FramePlot False, then Draw the plot but do not Frame. ; In this case a user want to add to the drawing, and will ; have to advance the Frame manually in the script. ; ; If the "NoTitles" attribute exists and is set True, then ; don't create the top-left titles, and leave the main titles alone. ; This resource can be useful if you are planning to panel ; the plots. ; ; If PanelPlot is set to True, then this flags to wrf_map_overlays ; that these plots are going to be eventually paneled (likely ; by gsn_panel), and hence 1) draw and frame should not be called ; (unless gsnDraw and/or gsnFrame are explicitly set to True), ; and 2) the overlays and titles should not be removed with ; NhlRemoveOverlay and NhlRemoveAnnotation. ; ; If LatLonOverlay is set to True, then this means the user is ; using the 2D lat/lon coordinates to do the overlay, and hence ; tfDoNDCOverlay should not be set to True. (The default is False.) ; begin opts = opt_arg ; Make a copy of the resource lists opt_mp_2 = opt_mp if(opts.and.isatt(opts,"gsnDebugWriteFileName")) then opt_mp_2@gsnDebugWriteFileName = get_res_value(opts, \ "gsnDebugWriteFileName", "") wrf_debug_file = opt_mp_2@gsnDebugWriteFileName end if ; Let's make the map first base = wrf_map_ggp(wks,lat, lon,in_file,opt_mp_2) no_titles = get_res_value(opts,"NoTitles",False) ; Do we want field titles? com_title = get_res_value(opts,"CommonTitle",False) ; Do we have a common title? if ( com_title ) then plot_title = get_res_value(opts,"PlotTitle"," ") no_titles = True end if call_draw = True call_frame = get_res_value(opts,"FramePlot",True) ; Do we want to frame the plot? panel_plot = get_res_value(opts,"PanelPlot",False) ; Are we paneling? latlon_overlay = get_res_value(opts,"LatLonOverlay",False) ; Lat/lon Overlay? opts@gsnMaximize = get_res_value_keep(opts,"gsnMaximize", True) nplots = dimsizes(plots) ; font_color = "Black" do i=0,nplots-1 if(.not.ismissing(plots(i))) then ; class_name = NhlClassName(plots(i)) ; print(class_name) ; if(class_name.eq."contourPlotClass") then ; getvalues plots(i) ; "cnFillOn" : fill_on ; "cnLineColor" : line_color ; end getvalues ; if (.not.fill_on) then ; font_color = line_color ; end if ; end if if(.not.no_titles) then getvalues plots(i) "tiMainString" : SubTitle end getvalues if(i.eq.0) then SubTitles = SubTitle else SubTitles = SubTitles + "~C~" + SubTitle end if end if if(com_title .and. i .eq. nplots-1) then getvalues plots(i) "tiMainString" : SubTitle end getvalues SubTitles = plot_title end if if(.not.latlon_overlay) then setvalues plots(i) "tfDoNDCOverlay" : True "tiMainOn" : False end setvalues else setvalues plots(i) "tiMainOn" : False end setvalues end if overlay(base,plots(i)) else print("wrf_map_overlays: Warning: overlay plot #" + i + " is not valid.") end if end do if(.not.no_titles .or. com_title) then font_height = get_res_value_keep(opts,"FontHeightF",0.01) txt = create "map_titles" textItemClass wks "txString" : SubTitles "txFontHeightF" : font_height ;"txFontColor" : font_color end create anno = NhlAddAnnotation(base,txt) setvalues anno "amZone" : 3 "amJust" : "BottomLeft" "amSide" : "Top" "amParallelPosF" : 0.005 "amOrthogonalPosF" : 0.03 "amResizeNotify" : False end setvalues base@map_titles = anno end if ; ; gsnDraw and gsnFrame default to False if panel plot. ; if(panel_plot) then call_draw = False call_frame= False end if opts@gsnDraw = get_res_value_keep(opts,"gsnDraw", call_draw) opts@gsnFrame = get_res_value_keep(opts,"gsnFrame", call_frame) draw_and_frame(wks,base,opts@gsnDraw,opts@gsnFrame,False, \ opts@gsnMaximize) if(.not.panel_plot) then do i=0,nplots-1 if(.not.ismissing(plots(i))) then NhlRemoveOverlay(base,plots(i),False) else print("wrf_remove_map_overlays: Warning: overlay plot #" + i + " is not valid.") print(" Nothing to remove.") end if end do end if if(isvar("wrf_debug_file")) then write_wrf_debug_script(wks,wrf_debug_file,"wrf_map_overlays") end if if(.not.no_titles.and..not.panel_plot) then if(isatt(base,"map_titles")) then NhlRemoveAnnotation(base,base@map_titles) delete(base@map_titles) end if end if return(base) end