Hi NCL users,
I am using "vcMinDistanceF" to control wind barb spacing from GFS data.
according to my understanding when i want plot the whole world map
-180 to 180 longitude is mapped to 0-1 in NDC space
and -90 to 90 latitude is mapped to 0-1 in NDC space
if so and if i want to draw a wind barb each 45°, vcMinDistanceF shoul=
d be
0.125
and when testing this i get a kind of random spacing (please see attached
image)
So is there any solution to control barb spacing according geographical
distance (in degrees).
Thank you for help.
below is you find my ncl script used :
;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;************************************************
begin
;************************************************
; read in GRIB2 file
;************************************************
a = addfile("gfs.t00z.pgrb2f00.grib2","r")
;************************************************
;;; get variables: temperature, longitude, latitude
t2m = a->TMP_P0_2L108_GLL0(:,:)
lon = a->lon_0
lat = a->lat_0
uu= a->UGRD_P0_L6_GLL0
vv= a->VGRD_P0_L6_GLL0
if (any(uu.lt.1000.)) then
x1D = ndtooned (uu) ; convert to 1D array
i50 = ind(x1D.lt.1000.) ; all indices x1D > 50
x1D(i50) = -30 ; set all array syntax
uu = onedtond(x1D, dimsizes(uu)); return to the original ar=
ray
delete (x1D) ; x1D no longer needed
delete (i50) ; i50 no longer needed
end if
if (any(vv.lt.1000.)) then
x1D = ndtooned (vv) ; convert to 1D array
i50 = ind(x1D.lt.1000.) ; all indices x1D > 50
x1D(i50) = -30 ; set all array syntax
vv = onedtond(x1D, dimsizes(vv)); return to the original ar=
ray
delete (x1D) ; x1D no longer needed
delete (i50) ; i50 no longer needed
end if
;
; create plot
;************************************************
wks_type="png"
wks_type@wkWidth = 1384
wks_type@wkHeight = 1384
wks_type@wkBackgroundOpacityF = 1.0
wks = gsn_open_wks(wks_type,"wind_barb") ; open a ncgm file
gsn_define_colormap(wks,"gui_default")
setvalues wks
"wkBackgroundColor" : (/1.,1.,1./)
end setvalues
res = True ; plot mods desired
res@pmTickMarkDisplayMode = "Always"
res@mpProjection = "Mercator" ; choose projection
res@mpGridAndLimbOn = True ; turn on lat/lon lines
res@mpPerimOn = True ; turn off box around plot
res@mpGridLatSpacingF = 45. ; spacing for lat lines
res@mpGridLonSpacingF = 45. ; spacing for lon lines
res@mpFillOn = False
res@mpLimitMode = "LatLon"
res@mpMinLatF = 85.0
res@mpMaxLatF = -85.0
res@mpMinLonF = -180
res@mpMaxLonF = 180
res@cnFillOn = False ; color plot desired
res@cnLineLabelsOn = False ; turn off contour lines
res@vpXF = 0 ; make plot bigger
res@vpYF = 1
res@vpWidthF = 1
res@vpHeightF = 1
res@vcGlyphStyle = "WindBarb" ; select wind barbs
res@vcRefMagnitudeF = 1 ; make vectors larger
res@vcRefLengthF = 0.03 ; ref vec length
res@vcWindBarbLineThicknessF = 8.0 ;Thickness
res@vcWindBarbTickSpacingF = 0.125 ;
res@vcMinDistanceF = 0.125 ; thin out windbarbs
res@vcMonoWindBarbColor = True
res@vcWindBarbColor = 1
res@mpOutlineOn = True ; turn on map outline
plot1=gsn_csm_vector_map(wks,uu,vv,res)
------------------------------
Cordialement,
Best regards,
Rabah Hachelaf
____
( )
( )
(___ __)
/////////
Received on Tue Jul 22 11:39:06 2014
This archive was generated by hypermail 2.1.8 : Fri Aug 01 2014 - 15:10:55 MDT