[ncl-talk] Q about wind_stats function

Li-Hao Young lhy at umich.edu
Mon Jun 7 07:39:21 MDT 2021


Hi All at NCL-talk:

My research requires me to obtain the standard deviation of wind direction.
And this has led me to NCL's wind_stats function. Therefore, I have
installed NCL 6.6.2 on my Mac Mojave (which took me many many hours...).
However, while running the Example 1 codes of wind_stats from
https://www.ncl.ucar.edu/Document/Functions/Contributed/wind_stats.shtml, I
was stopped by a fatal error message and could not continue on with that
example. The example codes are given at the bottom; the error occurred
while executing "x := *wind_stats*(wspd, wdir, 0, False)" as follow:

ncl 6>    x    := wind_stats(wspd, wdir, 0, False)  ; variable of type
'list'
fatal:Undefined identifier: (dim_avg_n_Wrap) is undefined, can't continue
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 1442 in
file /usr/local/ncl-6.6.2/lib/ncarg/nclscripts/csm/contributed.ncl

fatal:["Execute.c":8635]:Execute: Error occurred at or near line 6

I have tried the Getting Started, documentation, archieves, etc., but could
not resolve the problem as I have no experiences with NCL coding. I will
very much appreciate it if someone could give me some pointers.

Thanks,
Young

*Example 1*

   N     = 10
   u    := *random_normal*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/random_normal.shtml>(
 0, 2, N)   ; zonal wind 'noise'
   v    := *random_normal*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/random_normal.shtml>(-10,
2, N)   ; winds from the north
   wspd := *wind_speed*
<https://www.ncl.ucar.edu/Document/Functions/Contributed/wind_speed.shtml>(u,v)
   wdir := *wind_direction*
<https://www.ncl.ucar.edu/Document/Functions/Contributed/wind_direction.shtml>(u,v,0)
   *print* <https://www.ncl.ucar.edu/Document/Functions/Built-in/print.shtml>(*sprintf*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/sprintf.shtml>("%7.2f",
u)+*sprintf*("%7.2f", v)+*sprintf*("%7.2f", wspd)+*sprintf*("%7.2f",
wdir))

   x    := *wind_stats*(wspd, wdir, 0, False)  ; variable of type 'list'
                          ; extract variables from list for clarity
   wspd_avg = x[0]        ; average of 'wspd'
   wspd_std = x[1]        ; standard deviation of 'wspd'
   wdir_avg = x[2]        ; mean vector wind direction
   wdir_std = x[3]        ; standard deviation of the wind direction
   avgU     = x[4]        ; average zonal component
   avgV     = x[5]        ; average medidional wind component
   *delete* <https://www.ncl.ucar.edu/Document/Functions/Built-in/delete.shtml>(x)
       ; no longer needed

   *print* <https://www.ncl.ucar.edu/Document/Functions/Built-in/print.shtml>(*sprintf*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/sprintf.shtml>("%7.2f",
wspd_avg)+*sprintf*("%7.2f", wspd_std)  \
        +*sprintf*("%7.2f", wdir_avg)+*sprintf*("%7.2f", wdir_std)  \

        +*sprintf*("%7.2f", avgU )+*sprintf*("%7.2f", avgV ) )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210607/51401143/attachment.html>


More information about the ncl-talk mailing list