[ncl-talk] count of repetition of unique values
Dennis Shea
shea at ucar.edu
Mon Jun 18 08:19:47 MDT 2018
re: "I mean I want to know the number of repetition of "station_id" *using
a prepared function* in ncl"
There can't be a function for everything.
station_id_u = get_unique_values(station_id)
nidu = dimsizes(station_id_u)
station_id_uc = count_unique_values(station_id)
print("nid="+nid+" station_id_uc="+station_id_uc) ; the same
print("----------")
; *"*count the number of repetition of each unique value*"*
nid = new(nidu,typeof(station_id_u))
do n=0,nidu-1
nid(n) = num(station_id.eq.station_id_u(n))
end do
print(station_id_u+" "+nid)
On Fri, Jun 15, 2018 at 8:14 AM, Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com
> wrote:
> Hi,
> I use attached 'ncl' file to read attached '.csv' file. I use "
> get_unique_values" to obtain unique value of "station_id" and "
> count_unique_values" to count the number of unique values.
> 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.
> I'll be thankful for any help.
>
> Note: Some rows doesn't have any values for "sum", so reading file causes
> following massage:
> warning:tofloat: A bad value was passed to (string) tofloat, input strings
> must contain numeric digits, replacing with missing value
>
>
> Sincerely
> Ehsan
>
> _______________________________________________
> 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/20180618/f691e30f/attachment.html>
More information about the ncl-talk
mailing list