[ncl-talk] Overlay wind vectors on orthographic map
Karin Meier-Fleischer
meier-fleischer at dkrz.de
Wed Jul 5 01:52:29 MDT 2017
Hi Lyndon,
the plot function gsn_csm_vector_scalar can't handle the @cn resources
and gives the warnings. To get rid of the warnings separate the contour
(res: contour and map) and vector resources (e.g. in vcres) as shown in
the attached script.
To use the @vcLineArrowColor you have to set the @vcMonoLineArrowColor
to True which is described in the documentation:
http://ncl.ucar.edu/Document/Graphics/Resources/vc.shtml#vcLineArrowColor
It is always a good idea to take a look at the resources documentation
(and read) if a resource setting is not working as expected.
Bye,
Karin
Am 05.07.17 um 09:23 schrieb Lyndon Mark Olaguera:
> Dear NCL-experts,
>
>
> I am trying to overlay wind vectors over an orthographic map but I am
> getting the following warning messages:
>
> warning:cnFillOn is not a valid resource in proj_vector at this time
> warning:cnLineLabelsOn is not a valid resource in proj_vector at this time
> warning:cnLevelSelectionMode is not a valid resource in proj_vector at
> this time
> warning:cnMinLevelValF is not a valid resource in proj_vector at this time
> warning:cnMaxLevelValF is not a valid resource in proj_vector at this time
> warning:cnLevelSpacingF is not a valid resource in proj_vector at this
> time
> warning:cnFillDrawOrder is not a valid resource in proj_vector at this
> time
> warning:cnLinesOn is not a valid resource in proj_vector at this time
> warning:cnFillPalette is not a valid resource in proj_vector at this time
>
>
> Also, when I try to use the *"LineArrow"* as a glyph style, the color
> of the arrows are "blue" and ignores whatever I set in
> *res at vcLineArrowColor = "black".* I also tried using "*FilledArrow"
> *as the glyph style and this solves the issue. Nonetheless, I want to
> know why the first one (LineArrow glyph style) does not work and also
> the warning messages.
>
>
> I'll appreciate any suggestion on how I can do this correctly in NCL.
>
> I am attaching my script and the output here.
> The sample data sets that I am using can be found in this link:
>
> https://www.dropbox.com/s/8vwk894gkyof082/sample_data.zip?dl=0
>
> Lyndz
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170705/cfdca586/attachment.html
-------------- next part --------------
begin
a = addfile("may_hgt-hgt_1979-1995_850hPa.nc","r")
b = addfile("regpval_uwnd_1979-1995.nc","r")
c = addfile("regpval_vwnd_1979-1995.nc","r")
;************************************************
; read in data
;************************************************
printVarSummary(a)
printVarSummary(b)
printVarSummary(c)
t = a->regslope(:,:)
u = b->regpval(:,:)
v = c->regpval(:,:)
;************************************************
; create plot
;************************************************
wks = gsn_open_wks("png","plot_proj") ; send graphics to PNG file
res = True
res at gsnDraw = False
res at gsnFrame = False ;-- don't advance the frame
res at cnLevelSelectionMode = "ManualLevels"
res at cnMinLevelValF = -5.00
res at cnMaxLevelValF = 5.00
res at cnLevelSpacingF = 0.5
res at mpProjection = "Orthographic" ; choose projection
res at mpCenterLonF = 122. ; choose center lon
res at mpCenterLatF = 45. ; choose center lat
res at mpPerimOn = False ; turn off box around plo
res at mpDataBaseVersion = "MediumRes"
res at mpOutlineOn = True
res at cnFillOn = True ; color plot desired
res at cnFillPalette = "BlueDarkRed18" ; select color map
res at cnLineLabelsOn = False ; turn off contour line labels
res at cnLinesOn = False ; turn off contour lines
res at cnFillDrawOrder = "PreDraw"
res at mpGridAndLimbOn = True ; turn on lat/lon grid lines
res at mpGridMaskMode = "MaskNotOcean" ; don't draw over land or
res at mpFillOn = False ; inland water bodies
; res at lbLabelFontHeightF = 0.015 ; label bar font height
res at gsnLeftString = ""
res at gsnRightString = ""
res at tiMainString = "Regressed Rainfall-HGT(850hPa)" ; add a title
; res at tiMainFontHeightF = .018 ; font height
plot = gsn_csm_contour_map(wks,t,res)
;;************************************************************
;;Add shapefiles
;;************************************************************
vcres = True
vcres at vcGlyphStyle = "LineArrow"
vcres at vcLineArrowThicknessF = 1.0
vcres at vcMonoLineArrowColor = True
vcres at vcLineArrowColor = "black"
vcres at vcMinDistanceF = 0.01
vcres at vcLineArrowHeadMaxSizeF = 0.025
vcres at vcRefLengthF = 0.0250
vcres at vcRefAnnoOrthogonalPosF = -1.0
vcres at vcRefAnnoArrowLineColor = "black"
vcres at vcRefMagnitudeF = 1.5
vcres at vcVectorDrawOrder = "PostDraw"
vcres at gsnDraw = False
vcres at gsnFrame = False
vector = gsn_csm_vector_scalar(wks,u,v,t,vcres)
overlay(plot,vector)
draw(plot)
frame(wks)
end
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_proj.png
Type: image/png
Size: 276926 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170705/cfdca586/attachment.png
More information about the ncl-talk
mailing list