I have a problem that puzzles me a lot the last days. I want to average different masked arrays but it seems I cannot because my mapped arrays do not have the same map pattern.
For example. I have three arrays:
[ -- -- --]
[ 1. 2. --]
[ 2. 3. --]
[ -- -- --]
[ -- 2. 2.]
[ -- 2. 3.]
[ -- -- --]
[ -- -- --]
[ 2 1. --]
[ 1 1. --]
[ -- -- --]
[ -- -- --]
I want the result to be the average of these arrays, but the averaging of a masked element with a valid element should not take account the masked elements. That means in the (0,0) position I have two masked elements and 1 valid ( value =2 ), so the final result should calculate only the average of the valid elements.
[ 2 1.5 2]
[ 1 2 3]
[ 2 -- --]
[ -- -- --]
I have 28 arrays like them that I want to combine and so far I have to do complicated loops and actions to achieve the expected results. Is there any efficient way to do it?
a.mean(axis=0)doesn't work?