[ncl-talk] Adding vector on the map projection

Adam Phillips asphilli at ucar.edu
Mon Mar 8 11:07:51 MST 2021


HI Ivica,
Please remember to always respond to the ncl-talk email list on all
correspondence; that way others can assist if necessary.

You asked whether when using the method I outlayed in my original response,
if you could alter the location of the grid points used for the individual
vectors. The answer is yes. The core issue here is that one cannot just
draw an individual vector using a hypothetical function named
gsn_add_vector similar to how you can add a polyline using
gsn_add_polyline. I wish this capability did exist.

In my original reply I stated you could draw the original vector field, set
the original vectors arrays to missing and then set values for one grid
point and then draw the array again. One could follow the same procedure,
but instead of setting the original arrays to missing, create an entirely
new latitude x longitude array with coordinates set where your
observational values should be, and overlay this new array.

; untested...
res = True
res at gsnDraw = False
res at gsnFrame = False
...
res at vcRefLengthF = 0.05
res at vcRefMagnitudeF = 0.5
plot = gsn_csm_vector_map(wks,u,v,res)

u_obs = new(2,float)
u_obs!0 = "lat"
u_obs&lat = (/-35.,15/)
u_obs!1 = "lon"
u_obs&lon = (/15,-110/)
u_obs&lat at units = "degrees_north"
u_obs&lon at units = "degrees_east"
u_obs at units = "m/s"
v_obs = u_obs

u_obs({-35},{15}) = 1.5
v_obs({-35},{15}) = 4.2
; set other points if necessary
oplot = gsn_csm_vector(wks,u_obs,v_obs,res)   ; Add single vector

overlay(plot,oplot)
draw(plot)
frame(wks)

Adam


On Thu, Mar 4, 2021 at 3:22 PM Adam Phillips <asphilli at ucar.edu> wrote:

> Hi Ivica,
> I am not sure what you have in mind, but if you want to add a single
> vector and keep all the scaling the same as the original vector field,
> would it be possible to put your vector(s) in a gridded array?
> If so, I would recommend setting the vcRefLengthF/vcRefMagnitude resources
> so that the vector sizes are the same, and draw the vector field, and then
> overlay the single vector.
> For example:
>
> res = True
> res at gsnDraw = False
> res at gsnFrame = False
> ...
> res at vcRefLengthF = 0.05
> res at vcRefMagnitudeF = 0.5
> plot = gsn_csm_vector_map(wks,u,v,res)
>
> u = u at _FillValue
> v = v at _FillValue
> u({30},{125}) = 0.75
> v({30},{125}) = 0.31
> oplot = gsn_csm_vector(wks,u,v,res)   ; Add single vector
>
> overlay(plot,oplot)
> draw(plot)
> frame(wks)
>
> Hope that helps!
> Adam
>
> On Wed, Mar 3, 2021 at 8:56 PM Ivica Janeković via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> Dear users of NCL,
>>
>> I am plotting ROMS model results using standard
>> gsn_csm_vector_scalar_map and all that is working perfectly. To
>> compare model results with the observed currents I would like to
>> overlay vector(s) on the map. Is there any way to add a vector on the
>> map (and to be scaled as all other vectors from the map)?
>>
>> Thanks in advance,
>> Ivica
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at mailman.ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210308/142ecf74/attachment.html>


More information about the ncl-talk mailing list