Works well. Agreed with others that some bounds on inputs, while perhaps obscuring internal code, make implementation into other code more cumbersome.
for instance, in this snippet, ea(1) must be in 0->360.
Alowing ea(1) = -10 degrees is easier.
Perhaps a switch to turn of bounds checking?