def _add_turbine_marker(self, turbine, coords, wind_direction): a = Coordinate(coords.x, coords.y - turbine.rotor_radius) b = Coordinate(coords.x, coords.y + turbine.rotor_radius) a.rotate_z(turbine.yaw_angle - wind_direction, coords.as_tuple()) b.rotate_z(turbine.yaw_angle - wind_direction, coords.as_tuple()) plt.plot([a.xprime, b.xprime], [a.yprime, b.yprime], 'k', linewidth=1)
def test_rotation_on_z(): """ Coordinate at 1, 1 rotated 90 degrees around z axis should result in 1,-1 """ test_class = CoordinateTest() coordinate = Coordinate(test_class.x, test_class.y) coordinate.rotate_z(np.pi / 2.0) assert pytest.approx(coordinate.xprime) == -1.0 and pytest.approx( coordinate.yprime) == 1.0