diff --git a/utilities/earth.py b/utilities/earth.py new file mode 100644 index 0000000000000000000000000000000000000000..1b46a61c9a0a22979106b511ecdcfc1bf6ff44e4 --- /dev/null +++ b/utilities/earth.py @@ -0,0 +1,20 @@ +### 3D plot +fig = plt.figure(figsize=(9,9)) +ax = fig.add_subplot(1,1,1, projection='3d') +u, v = np.mgrid[0:2*np.pi:30j, 0:np.pi:30j] +# u = phi (longitude) +# v = theta (latitude) +# R = earth radius +x_earth = R*np.cos(u)*np.sin(v) +y_earth = R*np.sin(u)*np.sin(v) +z_earth = R*np.cos(v) +# R,u,v (spherical) -> x,y,z (cartesian) +# Plot the earth # +ax.plot_wireframe(x_earth, y_earth, z_earth,cmap='ocean', facecolor='none') +all_positions = np.array(all_positions) +# Plot positions # +ax.plot3D(all_positions[:,0],all_positions[:,1],all_positions[:,2],color='r') +# Set axes limits +ax.set_xlim3d(-R-5000000,R+5000000) +ax.set_ylim3d(-R-5000000,R+5000000) +ax.set_zlim3d(-R-5000000,R+5000000)