Draws NDC grid lines at 0.1 NDC coordinate intervals and labels them.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" ; These four load statements not load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" ; needed in NCL 6.4.0 onward load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl" procedure drawNDCGrid ( wks : graphic )
This procedure draws NDC grid lines at 0.1 NDC coordinate intervals and labels them. This procedure is useful to help determine placement of labels and lines on plots when using functions like gsn_add_text.
The frame is not advanced in this procedure.
f = addfile ("$NCARG_ROOT/lib/ncarg/data/cdf/uv300.nc","r") x = f->U(1,:,:) ; Grab second timestep wks = gsn_open_wks("x11","test") ;---Create contours over a map and draw an NDC grid res = True res@gsnFrame = False plot = gsn_csm_contour_map(wks,x,res) drawNDCGrid(wks) ;---Draw a text string centered (X NDC=0.5) near the bottom of the page (Y NDC=0.2) txres = True txres@txFontHeightF = 0.015 gsn_text_ndc(wks,"Now I can exactly place the text where I want it to be!",0.5,0.2,txres) frame(wks)
For other application examples, see the list of example NCL scripts that drawNDCGrid appears in.