<div dir="ltr"><div><div><div><div><div><div><div>re: "<span>I mean I want to know the number of repetition of "station_id" <b>using a prepared function</b> in ncl"<br><br></span></div><span>There can't be a function for everything.<br><br>  station_id_u   = get_unique_values(station_id)<br><br>  nidu = dimsizes(station_id_u)<br>  station_id_uc = count_unique_values(station_<wbr>id)<br><br>  print("nid="+nid+"  station_id_uc="+station_id_uc)<wbr>  ; the same<br>  print("----------")<br><br>; <b>"</b>count the number of repetition of each unique value<b>"</b><br><br>  nid = new(nidu,typeof(station_id_u))<br>  do n=0,nidu-1<br>     nid(n) = num(station_id.eq.station_id_<wbr>u(n))<br>  end do<br>  print(station_id_u+"   "+nid)<span><br></span></span><span><span><span></span></span></span></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 15, 2018 at 8:14 AM, Ehsan Taghizadeh <span dir="ltr"><<a href="mailto:ehsantaghizadeh@yahoo.com" target="_blank">ehsantaghizadeh@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:bookman old style,new york,times,serif;font-size:16px"><div style="font-family:bookman old style,new york,times,serif;font-size:16px"><div style="font-family:bookman old style,new york,times,serif;font-size:16px"><span><div style="font-family:"bookman old style","new york",times,serif;font-size:16px">Hi,</div><div style="font-family:"bookman old style","new york",times,serif;font-size:16px">I use attached 'ncl' file to read attached '.csv' file. I use "<span style="background-color:rgb(173,215,115)">get_unique_values</span>" to obtain unique value of "station_id" and "<span style="background-color:rgb(173,215,115)">count_unique_values</span>" <span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">to count the number of unique values</span>.</div><div style="font-family:"bookman old style","new york",times,serif;font-size:16px">However I want to count the number of repetition of each unique values. Is there any function in 'ncl' for this aim? I mean I want to know the number of repetition of "station_id" using a prepared function in ncl.</div><div style="font-family:"bookman old style","new york",times,serif;font-size:16px">I'll be thankful for any help.</div><div style="font-family:"bookman old style","new york",times,serif;font-size:16px"><br></div><div style="font-family:"bookman old style","new york",times,serif;font-size:16px">Note: Some rows doesn't have any values for "sum", so reading file causes following massage:</div><div style="font-family:"bookman old style","new york",times,serif;font-size:16px"><span style="background-color:rgb(253,248,105)">warning:tofloat: A bad value was passed to (string) tofloat, input strings must contain numeric digits, replacing with missing value</span><br></div><div style="font-family:"bookman old style","new york",times,serif;font-size:16px"><br></div><div style="font-family:"bookman old style","new york",times,serif;font-size:16px"><br></div><div style="font-family:"bookman old style","new york",times,serif;font-size:16px">Sincerely</div><span class="HOEnZb"><font color="#888888"><div style="font-family:"bookman old style","new york",times,serif;font-size:16px">Ehsan</div></font></span></span></div></div></div></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>