[ncl-talk] dim_median_n

jbuzan jbuzan at purdue.edu
Sat Sep 19 19:57:28 MDT 2015


Hello NCL-Talk,

I am confused by the dim_median_n function:

apples = (/4,3,3,5/)
    apples_median = dim_median_n(apples,0)
    print(apples)
    print(apples_median)

Variable: apples
Type: integer
Total Size: 16 bytes
            4 values
Number of Dimensions: 1
Dimensions and sizes:   [4]
Coordinates: 
(0)     4
(1)     3
(2)     3
(3)     5

Variable: apples_median
Type: float
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:   [1]
Coordinates: 
Number Of Attributes: 1
  _FillValue :  9.96921e+36
(0)     3.5

I thought the median would be 3, not 3.5, since 3.5 is not in the dataset.

-Jonathan




More information about the ncl-talk mailing list