;************************************************* ; wind_2.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/contributed.ncl" ;************************************************* begin ;************************************************* ; open file and read in data ;************************************************* f = addfile ("uv300.nc", "r") u = f->U(:,:,0:127) v = f->V(:,:,0:127) time = f->time ;************************************************* ; calculate vorticity ; we loose coordinate variables and attributes in ; this calculation, so they must be explicitly assigned ;************************************************* vrt = uv2vrG(u,v) copy_VarCoords(u, vrt) vrt@long_name = "vorticity" vrt@units = "1/s" ;************************************************* ; calculate rotational wind component ;************************************************* ; note: the calculation uses a procedure, so memory ; must be preallocated. ur = new ( dimsizes(u), typeof(u), u@_FillValue ) vr = new ( dimsizes(v), typeof(v), v@_FillValue ) vr2uvg(vrt, ur,vr) ur@long_name = "Zonal Rotational Wind" ur@units = u@units vr@long_name = "Meridional Rotational Wind" vr@units = v@units copy_VarCoords(u, ur ) copy_VarCoords(u, vr ) ;************************************************* ; plot results ;************************************************* wks = gsn_open_wks("ps","wind") ; open workstation res = True res@vcRefMagnitudeF = 5. ; make vectors larger res@vcRefLengthF = 0.050 ; reference vector res@vcGlyphStyle = "CurlyVector" ; turn on curly vectors res@vcMinDistanceF = 0.022 ; thin the vectors res@vcRefAnnoOrthogonalPosF = -1.0 ; move ref vector up res@gsnLeftString = "Rotational Wind" plot= gsn_csm_vector_map_ce(wks,ur(0,:,:),vr(0,:,:),res) end