I am writing an astronomy observation simulation. I have a data array which is 1 measurement per 24 hours:
data = [0,1,2,3,4]
And I have a array which is the minutes of cloud/rain in a 24 hour period, rounded to the nearest hour:
weather = [0,60,120,180,0]
I want to use a masked array to hide the values in the data array based off the values in the weather array. Masking is important (instead of deleting) for plotting and data analysis further down the line.
So if I want to only show data points where there was < 120 mins of downtime I do:
downtime = 120
data_masked = np.ma.masked_where(weather < downtime, data)
This should result in:
data_masked = [0, 1, ---, ---, 4]
But my data_masked seems to be doing the opposite. If I plot both my data and weather on the same axis. I am masking the points where the weather downtime is below my threshold.
I've tried inverting the operator which just seems to keep everything in. Any ideas or am I missing the point of numpy.ma?
Thanks!