;---------------------------------------------------------------------- ; vector_4.ncl ; ; Concepts illustrated: ; - Coloring vectors based on temperature data ; - Drawing curly vectors ; - Thinning vectors using a minimum distance resource ; - Changing the length of the smallest vector as a fraction of the reference vector ;---------------------------------------------------------------------- load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" begin ;---Read in netCDF file a = addfile("uwnd.mon.mean.nc","r") b = addfile("vwnd.mon.mean.nc","r") ;---Read in zonal [u] and meridional [v] winds u = a->uwnd v = b->vwnd ;u1 = u(:,:,5) ;dimension reduction ;v1 = v(:,5,:);dimension reduction wspd = u wspd = (/ sqrt(u^2+v^2) /) ;---Create plot wks = gsn_open_wks("x11","vector") ; open a ps file cmap = read_colormap_file("BlAqGrYeOrReVi200") vcres = True ; plot mods desired vcres@lbLabelStride = 2 ; plot every other colar bar label vcres@vcRefMagnitudeF = 5.0 ; make vectors larger vcres@vcRefLengthF = 0.050 ; ref vec length vcres@vcGlyphStyle = "CurlyVector" ; turn on curly vectors vcres@vcMinDistanceF = 0.017 ; thin out vectors vcres@vcLevelPalette = cmap(6:193,:) vcres@tiMainString = "Vectors colored by a scalar map" plot=gsn_csm_vector_scalar_map_ce(wks,u,v,wspd,vcres) ; create plot end