[ncl-talk] no value at the equator and additional line using gsn_add_polygon

Alan Brammer abrammer at albany.edu
Fri Oct 13 13:08:50 MDT 2017


That example is filling in the array from opposite ends in one loop.  e.g.
first half is in the normal order, second half is in the reverse order.

e.g.
nlat=30
xp    = new( (/2*nlat/), float )

do k=0,nlat-1
    xp(k)          =(k)
    xp(2*nlat-1-k) = (k)
    print(""+(2*nlat-1-k)+"     "+k)
end do


so if you print(xp) at the end it is 0..10..20..30..20..10..0   Your way
would have been 0..10..20..30..0..10..20..30

Draw the shape by hand without lifting the pen.  You'd draw the lower edge,
up, then top edge back to the start. The way you were doing it, was to draw
the bottom edge, straight line back to the start, then draw top edge and
finish with a straight line back to the start again.


Look at the arrays, print(xp+"   ,    "+yp)  it should become clear what
has changed.


On Fri, Oct 13, 2017 at 2:52 PM, 刘振 <286909655 at qq.com> wrote:

> Hi,
>
> It works. But I can not understand. I didn't see any value differences of
> xp and yp. Why it works? And actually I do this before because I copy the
> part from ncl website. See attached links:
> https://www.ncl.ucar.edu/Applications/Images/xy_10_lg.png
> https://www.ncl.ucar.edu/Applications/Scripts/xy_10.ncl
> But why there is no connection line from start point to the end point. I
> don't think the value is same for the start and end points. Thanks.
>
> ------------------
> 刘振
> 中山大学
> 环境科学与工程学院
> 大气科学系
> Phone: +86-15013246049 <+86%20150%201324%206049>
> Liu  Zhen
> Department of Atmospheric Science
> School of Environmental Science and Engineering
> Sun Yat-sen University
> Email address: liuzhen9 at mail2.sysu.edu.cn
>
>
>
> ------------------ 原始邮件 ------------------
> *发件人:* "Alan Brammer";<abrammer at albany.edu>;
> *发送时间:* 2017年10月14日(星期六) 凌晨2:40
> *收件人:* "刘振"<286909655 at qq.com>;
> *抄送:* "NCL"<ncl-talk at ucar.edu>;
> *主题:* Re: [ncl-talk] no value at the equator and additional line using
> gsn_add_polygon
>
> ahh, There's actually a thickness to that line.
>
> At the moment, your xp coord goes from  -90 : 90 then repeats -90 :90.
> You want to flip the direction of the 2nd half of the array so rather than
> start at 90S twice (and creating a discontinuity in the data halfway
> through) it traces the +std line in 1 direction then smoothly traces the
> -std line back to the origin.
>
>
> Not tested!!
>
> xp(:nlat-1)=lat
> xp(nlat:(2*nlat-1))=lat(::-1)
>
> yp(:nlat-1)=pr_lat(0,:)+allf_std
> yp(nlat:(2*nlat-1))=pr_lat(0,::-1)-allf_std(::-1)
>
>
>
> Good luck.
>
>
>
>
> On Fri, Oct 13, 2017 at 2:25 PM, 刘振 <286909655 at qq.com> wrote:
>
>> Hi -,
>>
>>   Thanks for your reply. But for the second question, if you look at the
>> Figure 2 in detail, I want to shading the one standard deviation of the red
>> line. But I want to delete the addition red line from the start point to
>> end point. So the function gsn_add_polyline may not satisfy my requirement.
>> Is there any other solutions? Thanks.
>>
>> Best regards,
>> zhen
>>
>> ------------------
>> 刘振
>> 中山大学
>> 环境科学与工程学院
>> 大气科学系
>> Phone: +86-15013246049
>> Liu  Zhen
>> Department of Atmospheric Science
>> School of Environmental Science and Engineering
>> Sun Yat-sen University
>> Email address: liuzhen9 at mail2.sysu.edu.cn
>>
>>
>>
>> ------------------ 原始邮件 ------------------
>> *发件人:* "Alan Brammer";<abrammer at albany.edu>;
>> *发送时间:* 2017年10月14日(星期六) 凌晨2:03
>> *收件人:* "刘振"<286909655 at qq.com>;
>> *抄送:* "ncl-talk"<ncl-talk at ucar.edu>;
>> *主题:* Re: [ncl-talk] no value at the equator and additional line using
>> gsn_add_polygon
>>
>> > why there is a white line over the equator? How to remove it?
>> You mean Greenwich Meridian?
>> https://www.ncl.ucar.edu/Document/Graphics/Resources/gsn.
>> shtml#gsnAddCyclic
>> You set this resource to false, therefore NCL did not bridge the gap.
>>  Near the top of your res file:
>> >   res at gsnAddCyclic          = False  ; data already has cyclic point
>>
>>
>> >  For All_F in red shading line, why there is a addition red line
>> connect from the beginning to the end. I found it seems to be a problem
>> with gsn_add_polygon function I used.
>>
>> It's trying to draw a polygon (i.e. a closed shaped), the docs clearly
>> state that if first and last points are not equal then the function will
>> close the shape for you.  If you just want a line, then draw a polyline.
>> https://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_
>> add_polyline.shtml
>>
>>
>> > The third question is how can I add more space between legend labels
>> vertically (i.e. All_F and Aero) in Figure 2?
>> https://www.ncl.ucar.edu/Applications/legend.shtml
>> Starting point is probably the resource pmLegendHeightF lots of examples
>> of legend layout though.
>>
>>
>> Documentation, the user guide and google for old ncl-talk emails will go
>> a long way.
>> https://www.ncl.ucar.edu/Document/
>>
>> Good luck,
>>
>>
>>
>>
>> On Fri, Oct 13, 2017 at 1:13 PM, 刘振 <286909655 at qq.com> wrote:
>>
>>> Dear Sir/Madam:
>>>
>>>   Attached please find my script and figures. I got three questions
>>> about the figures.
>>>   Figure 1: why there is a white line over the equator? How to remove it?
>>>   Figure 2: For All_F in red shading line, why there is a addition red
>>> line connect from the beginning to the end. I found it seems to be a
>>> problem with gsn_add_polygon function I used. How to remove this line?
>>>   The third question is how can I add more space between legend labels
>>> vertically (i.e. All_F and Aero) in Figure 2?
>>>   Look forward to your replies. Thanks.
>>>
>>> Best regards,
>>> zhen
>>>
>>> ------------------
>>> 刘振
>>> 中山大学
>>> 环境科学与工程学院
>>> 大气科学系
>>> Phone: +86-15013246049
>>> Liu  Zhen
>>> Department of Atmospheric Science
>>> School of Environmental Science and Engineering
>>> Sun Yat-sen University
>>> Email address: liuzhen9 at mail2.sysu.edu.cn
>>>
>>>
>>> _______________________________________________
>>> 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/20171013/def04c90/attachment.html>


More information about the ncl-talk mailing list