[ncl-talk] Q about wind_stats function

Dennis Shea shea at ucar.edu
Mon Jun 7 09:44:30 MDT 2021


The *dim_avg_n_Wrap*
<http://www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_n_Wrap.shtml>
should be in the *contributed.ncl* library.
---
I have attached the function. You can explicitly load this function

load "dim_avg_n_Wrap"

You can add the path to where the function resides if not in the same
directory as your script.





On Mon, Jun 7, 2021 at 7:39 AM Li-Hao Young via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> 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 ) )
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210607/9c153ede/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dim_avg_n_Wrap.ncl
Type: application/octet-stream
Size: 833 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210607/9c153ede/attachment.obj>


More information about the ncl-talk mailing list