[ncl-talk] problem vector field representation with curlyVector

Francesco Trotta francesco.trotta4 at unibo.it
Tue Dec 20 15:20:14 MST 2016


Dear Ncl team,
   I'm using NCL - version 6.3.0
   I would like to create a map with curved vector style

   I’m using vcres at vcGlyphStyle = "CurlyVector" but same regions in the area are empty of vector (attachment1).
   When I use vcres at vcGlyphStyle = “lineArrow” all is ok. (attachment2)

   How can I solve this problem?

thanks
Francesco
;===========================================================

   wks = gsn_open_wks(typefile,namefile)
   setvalues NhlGetWorkspaceObjectId()
       "wsMaximumSize" : 300000000
   end setvalues
   gsn_define_colormap(wks,colorsMap)

   res = True
   ;--- Title attributes --------------------------------------
   if(ltitle) then res at tiMainString = titleplot+" "+inforun
   else res at tiMainString = "" end if
   res at tiMainFont     = 0
   res at tiMainPosition = "Center"
   res at tiMainFontHeightF = 0.011
   res at tiMainOffsetYF = 0.01
   ;--- (gsn) attributes --------------------------------------
   res at gsnDraw         = False
   res at gsnFrame        = False
   res at gsnMaximize     = True
   res at gsnAddCyclic    = False
   res at gsnSpreadColors = True
   res at gsnPaperOrientation = "landscape"
   if(lLeftString) then res at gsnLeftString = LeftString
   else res at gsnLeftString = "" end if
   res at gsnLeftStringFontHeightF = 11
   if(lRightString) then res at gsnRightString = field at units
   else res at gsnRightString = "" end if
   ;--- Map attributes (window) ----------------------------------
   res at mpLimitMode = "LatLon"      ; Zoom in on the plot area.
   res at mpMinLatF   = minLatF
   res at mpMaxLatF   = maxLatF
   res at mpMinLonF   = minLonF
   res at mpMaxLonF   = maxLonF
   ;--- Map attributes (land outlines) -------------------      res at mpDataBaseVersion = "HighRes"           ;use GMT coastline
   res at mpOutlineOn       = lmapOutlineOn       ;turn on continental outlines
   res at mpOutlineBoundarySets = "AllBoundaries" ;turn on country boundaries (all the boundaries database in use)
   res at mpGeophysicalLineThicknessF = 2.5       ;thickness of outlines
   res at mpGeophysicalLineColor= "Black"         ;color of cont. outlines
   res at mpOutlineDrawOrder    = "PostDraw"      ;draw continental outline last
   res at mpFillOn              = lmapFillOn      ;turn on gray fill for continental background
   res at mpFillDrawOrder       = "PreDraw"       ;draw area fill first
   res at pmTickMarkDisplayMode  = "Always"
   ;--- Map attributes (lat/lon grid lines) -------------------
   res at mpGridAndLimbOn        = False          ;turn on lat/lon lines
   res at mpGridLineDashPattern  = 2              ;... with xxxx lines
   res at mpGridLineColor        = "black"        ;color of the lines
   res at mpGridLatSpacingF      = 10             ;space (in degree) between 2 lines
   res at mpGridLonSpacingF      = 10             ;idem
   res at mpGridLineThicknessF   = 2.0            ;thickness of the lines
   res at mpGridAndLimbDrawOrder = "PostDraw"     ;draw lat/lon lines last
   res at mpLabelFontHeightF     = 0.005          ;label font size
   ;--- contours attributes -------------------------------
   res at cnFillOn              = True            ;areas between levels filled with color
   res at cnFillMode            = "AreaFill"      ;AreaFill
   res at cnLevelSelectionMode  = "ManualLevels"  ;set manual contour levels
   res at cnMinLevelValF        = minLevelVal     ;set max contour level
   res at cnMaxLevelValF        = maxLevelVal     ;set min contour level
   res at cnLevelSpacingF       = levelSpacing
   res at cnLinesOn             = False           ;turn off the contour lines
   res at cnLineLabelsOn        = False           ;turn off the line labels
   res at cnLineLabelFontHeightF= 0.005
   res at cnLineLabelDensityF   = 1               ;label spacing when cnLineLabelPlacementMode != "Constant"
   res at cnLineLabelFontAspectF= 1               ;shape of the line label. > 1 :thinner characters. < 1 :wider
   res at cnLineLabelInterval   = 1
   res at cnInfoLabelOn         = False           ;turn off "CONTOUR FROM X TO X BY X" legend.
   res at cnLabelMasking        = True            ;mask lines where label appear
   ;--- LabelBar attributes -------------------------------
   res at lbLabelBarOn       = llabbarOn
   res at lbLabelsOn         = llabbarLabelsOn
   res at lbTitleString      = labTitleStr+" ("+field at units+")"
   res at lbTitlePosition    = "Bottom"
   res at pmLabelBarOrthogonalPosF = 0.17   ; position wrt plot​
   res at lbLabelFontHeightF = 0.015
   res at lbTitleFontHeightF = 0.015
   res at lbLabelStride      = 5       ; Label every 5th entry
   res at lbLabelStrings     = "" + sprintf(labformatStr,fspan(minLevelVal,maxLevelVal,floattoint((maxLevelVal-minLevelVal)/levelSpacing)+1))

   ;--- (ScalarField) attributes -------------------------------
   res at sfXArray  = lon2d(0:ny-1,0:nx-1)
   res at sfYArray  = lat2d(0:ny-1,0:nx-1)

   ;--- vectorPlot Resources -----------------------------------
   vcres = True
   ;--- GSN attributes -----------------------------------------
   vcres at gsnDraw         = False
   vcres at gsnFrame        = False
   vcres at gsnMaximize     = True
   vcres at gsnAddCyclic    = False

   vcres at vcRefAnnoOn     = False        ; draw the reference vector annotation
   vcres at vcRefAnnoFontHeightF = 0.01
   vcres at vcRefMagnitudeF = 0.2           ; add a reference vector
   vcres at vcRefLengthF    = 0.045                ; what the ref length is
   vcres at vcGlyphStyle    = "CurlyVector"        ; style of glyph used to represent the vector
   vcres at vcMinDistanceF  = 0.02           ; reduce the crowding of vector arrows
   vcres at vcLineArrowThicknessF = 2.0  ; change vector thickness
   vcres at vcVectorDrawOrder = "PostDraw"         ; draw vectors last

   vector = gsn_csm_vector(wks,xfield(:,:),yfield(:,:),vcres) ; generate the vectors
   plot = gsn_csm_contour_map_ce(wks,field(:,:),res)
   overlay(plot,vector)

   draw(plot)
   frame(wks)​

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161220/fb384043/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: temp_xy_curlyvector.png
Type: image/png
Size: 865136 bytes
Desc: temp_xy_curlyvector.png
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161220/fb384043/attachment-0001.png 


More information about the ncl-talk mailing list