;************************************************* ; adds color ;************************************************ load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "$HAO_NCL_LIB/halfzp2full.ncl" ;************************************************ begin in = addfile("/chewy/d/murphys/files/FOSTER.tgcm24r.sy2n005.nc","r") y = in->lev ; read in y-axis variable lat2plt = -22 lon2plt = 90 t2plt = 2 ; to put multiple profiles on one plot, we have to create an array ; to hold them all. fields = (/"O2","O1"/) data = new((/dimsizes(fields),dimsizes(y)/),"double") do i = 0,dimsizes(fields)-1 x = in->$fields(i)$ ; read in data x = halfzp(fields(i),x) ; interp to full zp data(i,:) = x(t2plt,:,{lat2plt},{lon2plt}) end do ;****************************************** ; create plot ;****************************************** wks = gsn_open_wks("ps","prof") ; open a ps file res = True ; plot mods desired ; we turn off the x-axis title b/c it defaults to the long_name of ; the first variable in data. with multiple lines on a plot, this ; is incorrect. res@tiXAxisOn = False res@tmLabelAutoStride = True ; nice label stride res@tiMainString = "Color plot w/ Multiple Curves" ; title ; add some color res@xyLineColors = (/"green","blue"/) ; line color res@xyLineThicknesses = (/2.,1./) ; line thickness ; these resources control the legend res@pmLegendDisplayMode = "Always" ; turn on legend res@pmLegendSide = "Top" ; Change location of res@pmLegendParallelPosF = .7 ; move units right res@pmLegendOrthogonalPosF = -0.9 ; move units down res@pmLegendWidthF = 0.15 ; Change width and res@pmLegendHeightF = 0.18 ; height of legend. res@lgPerimOn = False ; turn off box around res@lgLabelFontHeightF = .025 ; label font height res@xyExplicitLegendLabels = (/"O2","O1"/) ; create explicit labels plot = gsn_csm_xy(wks,data,y, res) end