function wrf_contour_ggp(nc_file:file,lat[*][*]:numeric, lon[*][*]:numeric, \ wks[1]: graphic, data[*][*]:numeric, \ opt_args[1]:logical) ; This function creates a contour plot and adds some titles to it. ; ; 1. Determine width to height ratio of plot. ; ; 2. First determine if this is to be a filled or line ; contour plot (fill_on) ; ; 3. If the ContourParameters attribute is set, then calculate ; the contour levels. ; ; 4. Set two resources for setting the zero contour line to ; a larger thickness, and for changing the negative contour ; lines to a dashed pattern. ; ; 5. If doing a filled contour plot, set a title for the labelbar ; based on whether a units attribute is set. ; ; 6. Make a copy of the resource list, and set some additional ; resources for filled contour plots. ; ; 7. Create the contour plot, attach the titles, and draw ; and advance the frame (if requested). local dims begin opts = opt_args ; Make a copy of the resource list. if(opts.and.isatt(opts,"gsnDebugWriteFileName")) then wrf_debug_file = get_res_value(opts,"gsnDebugWriteFileName", "") end if if(opts.and.isatt(opts,"mpOutlineBoundarySets")) then delete(opts@mpOutlineBoundarySets) end if ; Calculate ratio of plot width and height. Note that this doesn't ; affect the setting of gsnMaximize to True, because gsnMaximize will ; retain the aspect ratio of the plot. if(opts.and.isatt(opts,"AspectRatio")) then ratio = opts@AspectRatio else dims = dimsizes(data) ratio = 1.*dims(0)/dims(1) if(ratio .gt. 1.2) then ratio = 1.2 end if if(ratio .lt. 0.6667) then ratio = 0.6667 end if end if print(ratio) if(ratio .gt. 1) width = 0.95*1.0/ratio ;0.65 * 1.0/ratio height = 0.95 ;0.65 else width = 1.2 height = 1.2 * ratio end if opts@vpWidthF = get_res_value_keep(opts,"vpWidthF", width) opts@vpHeightF = get_res_value_keep(opts,"vpHeightF", height) ; Set some basic contour resources opts = set_cn_resources(data,opts) ; Find out if we are working with a contour or a shaded plot ; fill_on = False : line contour plot ; fill_on = True : filled contour plot fill_on = get_res_value_keep(opts,"cnFillOn",False) if(fill_on) then ; set lb resources if needed opts = set_lb_resources(data,opts) atmp = get_res_value(opts,"lbLabelBarOn",True) ; Remove this resource delete(atmp) ; just in case. end if ; Set Title resources opts = set_title_resources(data,opts) ; Setting gsnScale to True ensures that the tickmark lengths and labels ; will be the same size on both axes. opts@gsnScale = get_res_value_keep(opts,"gsnScale", True) ; The default is not to draw the plot or advance the frame, and ; to maximize the plot in the frame. opts@gsnDraw = False ; Make sure don't draw or frame or, opts@gsnFrame = False ; maximize, b/c we'll do this later. opts@gsnMaximize = False opts2 = opts delete_attrs(opts2) ; Clean up. cn = gsn_contour(wks,data,opts2) ; Create the plot. _SetMainTitle(nc_file,wks,cn,opts) ; Set some titles if(isvar("wrf_debug_file")) then write_wrf_debug_info(wks,data,False,wrf_debug_file,opts2,"wrf_contour") end if opts2@gsnDraw = get_res_value_keep(opts2,"gsnDraw", False) opts2@gsnFrame = get_res_value_keep(opts2,"gsnFrame", False) opts2@gsnMaximize = get_res_value_keep(opts2,"gsnMaximize", True) draw_and_frame(wks,cn,opts2@gsnDraw,opts2@gsnFrame,False,opts2@gsnMaximize) return(cn) ; Return end