The error from "dim_avg_n".

From: HUANG, Ping <ph0007_at_nyahnyahspammersnyahnyah>
Date: Wed Sep 29 2010 - 06:43:13 MDT

Hi all,

Here I report a error from the function "dim_avg_n".

In the online document http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_avg_n.shtml, dim_avg_n can perform average in multi-dimension as in example 4:

Example 4
Let z be defined as z(time,lev,lat,lon). Compute the time average at each latitude/longitude grid point.
    zAvg = dim_avg_n(z, (/0,1/)) ; ==> zAvg(nlat,nlon)

If metadata is desired use:
    zAvg = dim_avg_n_Wrap(z, (/0,1/)) ; ==> zAvg(nlat,nlon)

However, the error occurs when I try to use the multi-dimension average as above. And I test a simple example as following.

 NCAR Command Language Version 5.1.1
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
ncl 0> a = (/ (/1,2,3/),(/4,5,6/) /)
ncl 1> print(a)
Variable: a
Type: integer
Total Size: 24 bytes
            6 values
Number of Dimensions: 2
Dimensions and sizes: [2] x [3]
Coordinates:
(0,0) 1
(0,1) 2
(0,2) 3
(1,0) 4
(1,1) 5
(1,2) 6
ncl 2> temp = dim_avg_n( a , (/0,1/) )
fatal:NclReturnValue: Incomplete information to create return value from builtin function
fatal:Execute: Error occurred at or near line 2

ncl 3> print (dim_avg_n( a , 1 ))
(0) 2
(1) 5

What's the correct usage of multi-dimension average in dim_avg_n?

Best Regards,

Thanks

Huang Ping

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Sep 29 06:43:38 2010

This archive was generated by hypermail 2.1.8 : Mon Oct 04 2010 - 08:55:54 MDT