How to mask a narray in python?

Viewed 20
1 Answers

Define Cb as the center of the big circle and Cs as the center of the small circle. Similarly Rb and Rs as the radii.

For each data point, compute the distances Db and Ds as the distances (using the Pythagorean theorem) from Cb and Cs. If Db <= Rb and Ds > Rs, the point is between the two circles.

As an optimization, note that points whose X or Y coordinate is less than (Cb - Rb) or greater than (Cb + Rb) do not need to be checked.

Related