[ncl-talk] how to allocate output variables for stat_medrng?

Jian Zheng jzheng8606 at gmail.com
Thu Apr 6 19:32:49 MDT 2017


Hi Rick,

Your method works well. Thanks.

Jian

On Thu, Apr 6, 2017 at 11:43 PM, Rick Brownrigg <brownrig at ucar.edu> wrote:

> Hi Jian,
>
> I believe you may have found a bug in the case for this function when the
> output values should be a scalar.  I need to confirm with my colleagues,
> and I'll file a ticket if so.  In the mean time, a work around is to make
> the a,b,c,d variables the same dimension, and only use the 1st element of
> each on return from the function:
>
> x = fspan(1,10,100)
> a = x
> b = x
> c = x
> d = floattoint(x)
> d(0) = 1
> ;; Note that a,b,c,d are the same dimension, and effectively contain
> garbage values
> stat_medrng(x,a,b,c,d)
> print("median = " + a(0))
> print("mid-value = " + b(0))
> print("range = " + d(0))
>
>
> Hope that helps...
> Rick
>
> On Thu, Apr 6, 2017 at 8:40 AM, Jian Zheng <jzheng8606 at gmail.com> wrote:
>
>> Hi all,
>>
>> When I use procedure stat_medrng, I get some errors. Below are some
>> simple testing code
>>
>> ncl 0> x=fspan(1,10,100)
>> ncl 1> a=0.
>> ncl 2> b=0.
>> ncl 3> c=0.
>> ncl 4> d=0
>> ncl 5> stat2(x,a,b,d)
>> ncl 6> stat_medrng(x,a,b,c,d)
>> fatal:stat_medrng: The dimensions of xmedian, xrange, xmrange, and
>> nptused must be the same as the left-most dimensions of x
>> fatal:["Execute.c":8565]:Execute: Error occurred at or near line 6
>> ncl 8> stat4(x,a,b,c,c,d)
>>
>> You can see it works well with stat2 or stat4, but not stat_medrng. How
>> to define the output variables with stat_medrng for one-dimensional input?
>>
>> Thanks,
>> Jian
>>
>> _______________________________________________
>> 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/20170407/54c25621/attachment.html 


More information about the ncl-talk mailing list