X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 20 Apr 2015 10:09 AM by  anon
mean with DIMENSION and NAN keywords broken
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
20 Apr 2015 10:09 AM
    It seems that the mean() function with the DIMENSION and NAN keywords set is broken: IDL> a = reform(findgen(64), 64, 1) IDL> help, a A FLOAT = Array[64, 1] IDL> mean(a, dimension=2) 0.0000000 1.0000000 2.0000000 3.0000000 4.0000000 5.0000000 6.0000000 7.0000000 8.0000000 9.0000000 10.000000 11.000000 12.000000 13.000000 14.000000 15.000000 16.000000 17.000000 18.000000 19.000000 20.000000 21.000000 22.000000 23.000000 24.000000 25.000000 26.000000 27.000000 28.000000 29.000000 30.000000 31.000000 32.000000 33.000000 34.000000 35.000000 36.000000 37.000000 38.000000 39.000000 40.000000 41.000000 42.000000 43.000000 44.000000 45.000000 46.000000 47.000000 48.000000 49.000000 50.000000 51.000000 52.000000 53.000000 54.000000 55.000000 56.000000 57.000000 58.000000 59.000000 60.000000 61.000000 62.000000 63.000000 IDL> mean(a, dimension=2, /nan) % TOTAL: For input argument , Dimension must be 1. % Execution halted at: $MAIN$ I think this is easily fixed by wrapping the call to FINITE() in REFORM() on line 67 of mean.pro (e.g., REFORM(FINITE(x), xdims)).

    Zachary Norman



    Basic Member


    Posts:173
    Basic Member


    --
    20 Apr 2015 11:41 AM
    It looks like your error is coming from your specification of "dimension = 2", when there is only one. Everything should work properly if you either remove the "dimension = 2" portion, don't specify dimension altogether, or correct your reform statement to specify two rows. Something like this should work just fine: a = reform(findgen(5),5,1) mean(a,dimension = 1) mean(a,dimension = 1,/nan) Alternatively, if you just leave "a" defined as a = findgen(5), then it is akin to a 5 by 1 array and you don't need to use reform.
    You are not authorized to post a reply.