;;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" ;;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" dname = "./" fname = "nam.t00z.conusnest.hiresf24.tm00.grib2" a=addfile(dname+fname,"r") u_1=a->UGRD_P0_L102_GLC0(0,:,:) v_1=a->VGRD_P0_L102_GLC0(0,:,:) printVarSummary(u_1) ; [ygrid_0 | 1025] x [xgrid_0 | 1473] printVarSummary(v_1) ; [ygrid_0 | 1025] x [xgrid_0 | 1473] nmsg = num(ismissing(u_1)) ; count # of _FillValue print(nmsg) rot=a->gridrot_0(:,:) ; [ygrid_0 | 1025] x [xgrid_0 | 1473] printVarSummary(rot) ; [ygrid_0 | 1025] x [xgrid_0 | 1473] u=sin(rot)*v_1+cos(rot)*u_1 v=cos(rot)*v_1-sin(rot)*u_1 printVarSummary(u) lat2d = a->gridlat_0 ; [ygrid_0 | 1025] x [xgrid_0 | 1473] lon2d = a->gridlon_0 ; [ygrid_0 | 1025] x [xgrid_0 | 1473] printVarSummary(lat2d) printMinMax(lat2d,0) printVarSummary(lon2d) printMinMax(lon2d,0) dimll = dimsizes(lat2d) nlat = dimll(0) mlon = dimll(1) wks = gsn_open_wks("png","WangChao") res = True res@gsnMaximize = True res@gsnAddCyclic = False ; regional data res@mpFillOn = False res@mpDataBaseVersion = "MediumRes" res@mpDataSetName = "Earth..4" ;res@mpOutlineBoundarySets = "Geophysical" res@mpOutlineBoundarySets = "National" res@mpGeophysicalLineThicknessF = 2. res@mpNationalLineThicknessF = 2. res@mpProjection = "LambertConformal" res@mpLambertParallel1F = lat2d@Latin1 res@mpLambertParallel2F = lat2d@Latin2 res@mpLambertMeridianF = lat2d@Lov res@mpLimitMode = "Corners" res@mpLeftCornerLatF = lat2d(0,0) res@mpLeftCornerLonF = lon2d(0,0) res@mpRightCornerLatF = lat2d(nlat-1,mlon-1) res@mpRightCornerLonF = lon2d(nlat-1,mlon-1) res@mpOceanFillColor =0 res@tiMainString = fname res@vcRefMagnitudeF = 30 res@vcRefLengthF = 0.09 ;;res@vcMinDistanceF = 0.02 ; thin vectors res@gsnLeftString = "Wind Vectors" res@gsnRightString = u_1@units ;u@lat2d = lat2d ;u@lon2d = lon2d ;v@lat2d = lat2d ;v@lon2d = lon2d ;printVarSummary(u) res@vfYArray = lat2d res@vfXArray = lon2d plot = gsn_csm_vector_map(wks,u,v,res)