;*********************** ; coneff_7.ncl ;*********************** load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl" ;=========================== begin ;************************* ; get data ;************************* f = addfile("atmos.nc","r") u = f->U(0,:,:,:) ;************************* ; convert to pressure levels ;************************* hyam = f->hyam hybm = f->hybm ps = f->PS p0 = 1000. pres3d = (/1000,950,800,700,600,500,400,300,200/) pres3d@units= "mb" uint=(/vinth2p(u,hyam,hybm,pres3d,ps(0,:,:),2,\ p0,2,False)/) uint!0 = "plev" uint&plev = pres3d uint!1 = "lat" uint&lat = u&lat uint!2 = "lon" uint&lon = u&lon uzon=uint(:,:,0) uzon=dim_avg(uint) ;=========================== ; plot parameters ;=========================== wks = gsn_open_wks ("ps", "coneff" ) ; open workstation res = True ; plot mods desired res@gsnDraw = False ; do not draw res@gsnFrame = False ; do not advance frame res@cnLevelSpacingF = 4.0 ; contour level spacing res@cnInfoLabelOn = False ; turn off contour label plot = new(4,graphic) ; create a graphical array ;********************************************************************** ; Note that ShadeLtGtContour, ShadeLtContour and ShadeGtContour ; all use greater (less) than, and NOT greater (less) than or equal to. ; These functions will find the closest CONTOUR less than the specified ; threshold value when choosing when to start shading. ;********************************************************************** ; plot 1 res@gsnCenterString="< 4 shaded" plot(0) = gsn_csm_pres_hgt(wks, uzon, res ) plot(0) = ShadeLtContour(plot(0), 4.1, 3) ; plot 2 res@gsnCenterString="> 16 shaded" plot(1) = gsn_csm_pres_hgt(wks, uzon, res ) plot(1) = ShadeGtContour(plot(1), 16.5, 1) ; plot 3 res@gsnCenterString="< 0 shaded AND > 24 shaded" plot(2) = gsn_csm_pres_hgt(wks, uzon, res ) plot(2) = ShadeLtGtContour(plot(2),0.1,7,25.5,8) ;********************************************************************** ; Starting with the first contour less than the given low value, ; ShadeGeLeContour will shade all areas greater than that first contour ; and less than the last contour that is less than or equal to the ; given high value with the given fill pattern. ; ; In the example below, the given low value = 1, and the first contour ; level less than that value is the 0 contour level. With the given high ; value of 10, the first contour that is less than or equal to that value ; is the 8 contour level. Thus, all areas between the 0 and 8 contours ; will be shaded with fill pattern #10. ;********************************************************************** ; plot 4 res@gsnCenterString="Between 0 and 8 shaded" plot(3) = gsn_csm_pres_hgt(wks, uzon, res ) plot(3) = ShadeGeLeContour(plot(3),1.,10.,10) resP = True ; panel mods desired resP@gsnMaximize = True ; fill up the page gsn_panel(wks,plot,(/2,2/),resP) end