[ncl-talk] 回复: 回复:Re: didn't show all markers

刘振 286909655 at qq.com
Mon Nov 13 14:47:34 MST 2017


Hi Mary,


  Thanks for your reply. But I am sorry I don't have the authority to copy the data. Maybe I have to leave this behind. Thanks for your really helpful tips and advices. I really appreciate it. 


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 


 




------------------ 原始邮件 ------------------
发件人: "Mary Haley";<haley at ucar.edu>;
发送时间: 2017年11月14日(星期二) 凌晨5:44
收件人: "刘振"<286909655 at qq.com>;
抄送: "ncl-talk"<ncl-talk at ucar.edu>; 
主题: Re: [ncl-talk] 回复:Re: didn't show all markers



Zhen,


The only way I can look at this is if you provide your full script and data, so I can run it here.


If the data file is not large, then can use our ftp:


http://www.ncl.ucar.edu/ftp_files.shtml



If it is large (say > 500 MB), then please provide the file somewhere that I can download it.


Thank you,


--Mary






On Fri, Nov 10, 2017 at 12:23 PM, 刘振 <286909655 at qq.com> wrote:
Hi Mary,

  Thank you so much for your cleaning tips (I have changed the script related with tip 1 in the last email based on your tips before), which are very useful. Sometimes I indeed find the script is quite slow. Yes, I do still have problems with the dots. The following figure shows parts of the dots are not shown on the plot (print("lat / plev = "+lat(indices(ip,1))+"/"+plev(indices(ip,0)))). The dots are not out of the range of the X and Y axes. I still cannot figure out what is going on and need your further help. Thanks.
(0)     lat / plev = -25/85000
(0)     lat / plev = -23/85000
(0)     lat / plev = -21/85000
(0)     lat / plev = -19/85000
(0)     lat / plev = -17/85000
(0)     lat / plev = -15/85000
(0)     lat / plev = -11/85000
(0)     lat / plev = -3/85000
(0)     lat / plev = -1/85000
(0)     lat / plev = 3/85000
(0)     lat / plev = 5/85000
(0)     lat / plev = 7/85000
(0)     lat / plev = 13/85000
(0)     lat / plev = 15/85000
(0)     lat / plev = 27/85000
(0)     lat / plev = 45/85000
(0)     lat / plev = 47/85000
(0)     lat / plev = 59.00000000000001/85000
(0)     lat / plev = 61/85000
(0)     lat / plev = 69/85000
(0)     lat / plev = 73/85000
(0)     lat / plev = 75/85000
(0)     lat / plev = 77/85000

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

---原始邮件---
发件人:"Mary Haley"<haley at ucar.edu>
发送时间:2017年11月11日(星期六) 凌晨1:33
收件人:"刘振"<286909655 at qq.com>;
主题: [ncl-talk] didn't show all markers


Zhen,

Which markers in particular are not showing up? It's too hard for us to look at your output and try to figure out which dots are on the plot and which are not.

Also, it's very unlikely that NCL would just drop some of those dots.&#xA0; There has to be something else going on, like the dots are out-of-range of the limits of your X and/or Y axes.

[1] Clean coding tip: you do not need to loop across each index of the array to add each dot, if you are drawing them all with the same color and size. Instead of this code:

dot=new((/dimsizes(forc),dimsizes(lat)*dimsizes(plev)/),graphic)
do iex=0,dimsizes(forc)-1
&#xA0;. . .

&#xA0; do ip=0,npts-1
&#xA0; &#xA0; dot(iex,ip) = gsn_add_polymarker(wks,plot(iex),lat(indices(ip,1)),plev(indices(ip,0)),resmarker)
&#xA0; end do

you can have this code:

dot=new((/dimsizes(forc),dimsizes(lat)/),graphic)
do iex=0,dimsizes(forc)-1
&#xA0;. . .
&#xA0; dot(iex) = gsn_add_polymarker(wks,plot(iex),lat(indices(:,1)),plev(indices(:,0)),resmarker)


This will run faster, because each call to gsn_add_polymarker causes the creation of an internal object, and if you do this for each single dot, you are going to end up using more memory and taking more time.

[2] Clean coding tip: if you find yourself calling "dimsizes" on the same variable multiple times, I suggest saving it to a variable so it can save you some typing:

For example:

var_run = new((/dimsizes(forc),dimsizes(ens),dimsizes(year),23,90/),"float")
var_djf_clim =&#xA0; new((/dimsizes(forc),dimsizes(ens),23,90/),"float") ; 10 years&#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0;
rc_m = new((/dimsizes(forc),23,90/),"float")
do iv=0,dimsizes(vars)-1

could be changed to:

nforc = dimsizes(forc)
nens&#xA0; = dimsizes(ens)
nyear = dimsizes(year)
nvars = dimsizes(vars)
var_run = new((/nforc,nens,nyear),23,90/),"float")
var_djf_clim =&#xA0; new((/nforc,nens),23,90/),"float") ; 10 years&#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; &#xA0;
rc_m = new((/nforc,23,90/),"float")
do iv=0,nvars-1
I don't know what "23" and "90" are supposed to represent, but it would be good to also assign these to variables as well, so if you need to change the 23 or 90 values later, you can just do it in one place.
[3] Clean coding tip: you don't need to use "new" to preallocate an array that is getting calculated by a function.&#xA0; You have this code:
rc_m = new((/dimsizes(forc),23,90/),"float")
rc_m =&#xA0;regCoef_n(year,var_ens,0,1)
Remove the "new" line as it is not needed.&#xA0; The regCoef_n function will allocate the memory for you, as does every single NCL function.
If you continue to have problems with the dots, please be more specific about which dots are not showing up.
--Mary


On Thu, Nov 9, 2017 at 2:56 PM, 刘振 <286909655 at qq.com> wrote:


Dear all,

&#xA0; I am using ncl 6.4 to plot and want to print dot when value pass student t test using function gsn_add_polymaker (script and figure attached, i.e. 850hPa). But the dots are only printed at some levels (not all levels) in vertical direction. Actually, I got 23 pressure levels for my data and indeed some dot are not printed on the plot when I print the indices passing significance level (see log files attached). Could you please help me to solve this problem. Thanks.


zhen

------------------
刘振
 中山大学
环境科学与工程学院
大气科学系
Phone: +86-15013246049
 Liu&#xA0; Zhen
 Department of Atmospheric Science
School of Environmental Science and Engineering
 Sun Yat-sen University
Email address: liuzhen9 at mail2.sysu.edu.cn&#xA0;


&#xA0;
_______________________________________________
 ncl-talk mailing list
 ncl-talk at ucar.edu
 List instructions, subscriber options, unsubscribe:
 http://mailman.ucar.edu/mailman/listinfo/ncl-talk
 





_______________________________________________
 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/20171114/4db70deb/attachment.html>


More information about the ncl-talk mailing list