[ncl-talk] Vectorplot: Not getting curly vectors

Tabish Ansari tabishumaransari at gmail.com
Mon Feb 17 02:01:59 MST 2020


Hi Dave

Thanks a lot for pointing this out - I now get nice curved vectors.

Cheers

Tabish


*Tabish U Ansari*

*Postdoctoral Researcher *

*Centre for Climate and Air Pollution Studies (C-CAPS)*
*School of Physics, NUI-Galway**, Ireland*
*ResearchGate: https://www.researchgate.net/profile/Tabish_Ansari
<https://www.researchgate.net/profile/Tabish_Ansari>*


On Mon, 17 Feb 2020 at 02:56, Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:

> Those really are curly vectors.  However, there is a mistake in your plot
> data.  In the second line here, you are subsetting u_corr when I think you
> want v_corr.  This has the remarkable effect of making the vectors pointing
> always to or from the same direction.  This results in zero apparent
> divergence, thus the vectors do not curl.
>
>     U = u_corr(0,2,0:260,1160:1438)
>     V = u_corr(0,2,0:260,1160:1438)
>
>
> On Sun, Feb 16, 2020 at 5:42 PM Tabish Ansari via ncl-talk <
> ncl-talk at ucar.edu> wrote:
>
>> Hi
>>
>> I'm trying to make a wind vector plot using 0.25deg resolution gridded
>> data. I want to draw curly vectors but despite using "vecres at vcGlyphStyle
>>     = "CurlyVector"  option, I'm getting straight vectors (see attached
>> plot). Could you please point out what is wrong here?
>>
>> Here's my script:
>>
>> #########################################################################
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *begin;READING WIND COMPONENTS OFF THE FILEa =
>> addfile("/ichec/work/ngear013c/ERA5_uvw_1000-975-950hpa_27-30Jun2011.nc","r")u
>> = a->uv = a->v;APPLYING CORRECTIONS AND OFFSETS TO GET REAL VALUESu_corr =
>> (/0.0012*u/)u_corr = (/u_corr-0.6127/)v_corr = (/0.0012*v/)v_corr =
>> (/v_corr-1.7441/);PRESERVING VARIABLE METADATA FOR CORRECTED
>> ARRAYScopy_VarMeta(u,u_corr)copy_VarMeta(v,v_corr)print("Transformed");PRINTING
>> MIN AND MAX VALUES FROM THE CORRECTED ARRAYS TO CONFIRM IF THE RANGE IS
>> REALISTICprintMinMax(u_corr(:,0,:,:),1) ;
>> 950HPAprintMinMax(u_corr(:,1,:,:),1) ; 975
>> HPAprintMinMax(u_corr(:,2,:,:),1) ; 1000 HPA;READING 1000HPA WINDS FOR THE
>> FIRST HOUR AND CROPPING OVER GREENLAND-IRELAND REGIONU =
>> u_corr(0,2,0:260,1160:1438)V = u_corr(0,2,0:260,1160:1438)speed =
>> sqrt(U^2+V^2)copy_VarCoords(U,speed)      ;OPEN A WORKSTATION  wks   =
>> gsn_open_wks ("pdf", "windvectors-Oct2011")       ; send graphics to PNG
>> file  res                     = True  res at gsnDraw             = False
>>     ; don't draw  res at gsnFrame            = False           ; don't advance
>> frame  res at gsnMaximize         = True    ; Maximize plot in frame
>> res at cnFillOn            = True            ; turn on color
>> res at cnFillPalette       = "gui_default"   ; set color map  res at cnLinesOn
>>         = False           ; no contour lines  res at gsnLeftString       =
>> "Wind Speed"         ; change left string  res at gsnRightString      =
>> U at units         ; assign right string  res at gsnAddCyclic        = False
>> res at mpFillOn            = False           ; no map fill
>> res at mpGeophysicalLineThicknessF = 2.0  res at mpDataBaseVersion   =
>> "MediumRes" ; SELECTING THE GREENLAND-IRELAND SUBREGION FROM THE MAP
>> res at mpMinLonF            =  -70.                 res at mpMaxLonF            =
>>  0.  res at mpMinLatF            =  30.   res at mpMaxLatF            =  90.
>> vecres                  = True            ; vector only resources
>> vecres at gsnDraw          = False           ; don't draw  vecres at gsnFrame
>>     = False           ; don't advance frame  vecres at vcGlyphStyle     =
>> "CurlyVector"   ; curly vectors  vecres at vcRefMagnitudeF  = 20
>>  ; define vector ref mag  vecres at vcRefLengthF     = 0.045           ;
>> define length of vec ref  vecres at gsnRightString   = " "             ; turn
>> off right string  vecres at gsnLeftString    = " "             ; turn off left
>> string  vecres at tiXAxisString    = " "             ; turn off axis label
>> vecres at vcRefAnnoOrthogonalPosF = -.35    ; move ref vector into plot  plotA
>>   = gsn_csm_contour_map_ce(wks,speed(:,:),res)  plotB   =
>> gsn_csm_vector(wks,U(::10,::10),V(::10,::10),vecres)  overlay(plotA,plotB)
>>                      ; overlaying plotB over plotAdraw(plotA)frame(wks)end*
>> ############################################################
>>
>> Thanks in advance.
>>
>> Tabish
>>
>>
>> *Tabish U Ansari*
>>
>> *Postdoctoral Researcher *
>>
>> *Centre for Climate and Air Pollution Studies (C-CAPS)*
>> *School of Physics, NUI-Galway**, Ireland*
>> *ResearchGate: https://www.researchgate.net/profile/Tabish_Ansari
>> <https://www.researchgate.net/profile/Tabish_Ansari>*
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200217/1e07dc26/attachment.html>


More information about the ncl-talk mailing list