vector plot

From: Chao Luo <chao.luo_at_nyahnyahspammersnyahnyah>
Date: Fri Apr 08 2011 - 16:30:35 MDT

Hi,

I am trying to plot wind vector. What I am doing is to read U and V from ascii data file and read 2D lat and lon, and use
  res@sfXArray = lon2d
  res@sfYArray = lat2d
the error message like:
warning:sfXArray is not a valid resource in vector_vector at this time
warning:sfYArray is not a valid resource in vector_vector at this time

How to set lat and lon attributes to U and V, since U and V read from ASCII data file?

here is my short script

--------------------------------------
;***************************************************************************
; tstvec_1.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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

procedure metaUtil (z[*][*][*]:numeric, time[*], lat[*], lon[*])

begin
   z!0 = "time" ; name dimensions
   z!1 = "lat"
   z!2 = "lon"
   z&time = time ; assign coordinate variables
   z&lat = lat
   z&lon = lon
end

begin
  f = addfile ("GRIDCRO2D_4km.20060101.nc", "r")
  lat2d = f->LAT(0,0,:,:)
  lon2d = f->LON(0,0,:,:)

;;;; read model simulated IC2CG data
lat_nbr = 100
lon_nbr = 142
;;; read ASCII data

uw = asciiread("/data12/cluo/cmaq4.6/data/post/4km/dat/uu_sfc_dot.dat", (/lat_nbr,lon_nbr/),"float")
vw = asciiread("/data12/cluo/cmaq4.6/data/post/4km/dat/vv_sfc_dot.dat", (/lat_nbr,lon_nbr/),"float")

;*************create plots*******************
  wks = gsn_open_wks ("ps", "vector") ; open workstation
  gsn_define_colormap(wks,"BlAqGrYeOrRe") ; choose colormap
  res = True ; plot mods desired
  res@gsnDraw = False ; Don't draw plot or advance the
  res@gsnFrame = False ; frame after plot is created.
  res@gsnFrame = False ; so we can draw time stamp
  res@vcRefAnnoOrthogonalPosF = -1.0 ; move ref vector up
  res@vcRefMagnitudeF = 10.0 ; define vector ref mag
  res@vcRefLengthF = 0.045 ; define length of vec ref
  res@vcGlyphStyle = "CurlyVector" ; turn on curly vectors
  res@vcMinDistanceF = 0.017
  res@sfXArray = lon2d
  res@sfYArray = lat2d
  res@mpLimitMode = "Corners"
  res@mpLeftCornerLatF = lat2d(0,0)
  res@mpLeftCornerLonF = lon2d(0,0)
  res@mpRightCornerLatF = lat2d(99,141)
  res@mpRightCornerLonF = lon2d(99,141)

  vector = gsn_csm_vector_map_ce(wks,uw,vw,res)
  frame (wks)
end

--------------------------------------------------
Thanks,
Chao

Thanks,

Chao
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Apr 9 08:30:43 2011

This archive was generated by hypermail 2.1.8 : Tue Apr 19 2011 - 18:32:03 MDT