[ncl-talk] "sum" and "avg" functions without ignoring missing values

Rashed Mahmood rashidcomsis at gmail.com
Thu Nov 23 22:28:31 MST 2017


Hi Richard,
No, that is not my question. The question is that when one value is missing
and the other one is not missing then the "sum" or avg function would
return a valid number but I wonder if they could return a missing instead.
the print statement in previous email summarizes this where c has all
missing when the values simply added while same thing using function would
return valid numbers, since function is supposed to ignore missing value.
This I think would require changes to the code but just thought may be
there is a work around.

thanks for the email, anyway.
Rashed


On Thu, Nov 23, 2017 at 8:59 PM, music piano <musicpianoljy at gmail.com>
wrote:

> Hi, Rashed
>
> I am not sure I understand your question.
>
> You can assign a at _FillValue to a different value, then the function will
> recognize -9.0
>
> Best
> Richard
>
> On Thu, Nov 23, 2017 at 7:49 PM, Rashed Mahmood <rashidcomsis at gmail.com>
> wrote:
>
>> Hello all,
>> I am just wondering if there is an easy way to tell the "sum" and "avg"
>> functions NOT ignore the missing values. Below lines clarify my question
>> where I would like to see same values for c and d:
>>
>> ncl 0> a = (/(/-9.,2,-9./),(/1,-9.,2./)/)
>> ncl 1> a at _FillValue = -9.
>> ncl 2> c = (a(0,:)+a(1,:))
>> ncl 3> d = dim_sum_n(a,0)
>> ncl 4> print("  "+c+ " ... "+d)
>> (0)       -9 ... 1
>> (1)       -9 ... 2
>> (2)       -9 ... 2
>>
>> Thanks,
>> Rashed
>>
>>
>> _______________________________________________
>> 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/20171123/f2a3f8c1/attachment.html>


More information about the ncl-talk mailing list