[ncl-talk] weight option for taylor_stats

Dennis Shea shea at ucar.edu
Fri Jul 28 14:36:02 MDT 2017


Hi Yohei,

I see the issue.

Internally, with the 'taylor_stats' function contains:

[snip]
  else                                                       ; CURVILINEAR
GRID: w[*][*]
       tmean   = wgt_areaave2(t, w, 1)      ; area weighted means
       rmean   = wgt_areaave2(r, w, 1)
[snip]

The last argument of the 'wgt_areaave2' function ' 'opt' ] should be set to
0 not 1

>From 'wgt_areaave2' documentation:

*opt*

If *opt* = 0, the area average is calculated using available non-missing
data. If *opt* = 1, then if *any* point in *q* is missing, the area average
is not computed. In this case, it will be set to the missing value, which
is indicated by *q*@_FillValue
<http://www.ncl.ucar.edu/Document/Language/fillval.shtml>, or the default
missing value if *q*@_FillValue is not set.

=====

I made the simple change and have attached the code. You can load directly:

load "./taylor_stats.ncl"

[your code]

Please let ncl-talk know if this fixes the problem.
=====

Cheers
Dennis

On Fri, Jul 28, 2017 at 9:44 AM, Yohei Takano <yohei.takano at mpimet.mpg.de>
wrote:

> Dear NCL users,
>
>   I am trying to use "taylor_stats" function to calculate pattern
> correlation, ratio, and bias.
> https://www.ncl.ucar.edu/Document/Functions/Contributed/taylor_stats.shtml
>
>   The two ocean data (test array and reference array) are both
> curve-linear grid and contains missing values for land. Reading the
> descriptions in NCL document, I think I need to apply spatial weights to
> the data so I prepared two-dimensional area data as a weight based on
> curve-linear grid information.
>
>   Then I tried
>
> $ tay_stats = taylor_stats(test,reference,area,0)
> : again test, reference, and area are two dimensional curve-linear grid
> data)
>
>   but I have an error:
> $ fatal:The result of the conditional expression yields a missing value.
> NCL can not determine branch, see ismissing function
>
>   The function works when I try
> $ tay_stats = taylor_stats(test,reference,1.0,0)
> (for no weighting)
>
>   so I am pretty sure it is about the weighting problem.
> Are we not allowed to include missing values in "area" for taylor_stats
> option? Since this is an ocean data, the area also contains missing
> values for land so I was wondering how I can deal with this issue.
>
>   I could not attach the sample data (since it was a bit too big for the
> mailing list so I canceled it) but I could share it in some other way if
> necessary.
>
>   If you could give me any suggestions, point out what I am missing or
> mistaking that will be great. Thank you for your help in advance.
>
> Yohei Takano
>
> --
> Yohei Takano Ph.D
> Max Planck Institute for Meteorology
> Bundesstraße 53, Room 207
> 20146 Hamburg, Germany
> Tel: +49 (0)40 41173 - 150
> Email: yohei.takano at mpimet.mpg.de
> _______________________________________________
> 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/20170728/76a59d22/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: taylor_stats.ncl
Type: application/octet-stream
Size: 5216 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170728/76a59d22/attachment.obj 


More information about the ncl-talk mailing list