From e245a6b82ffdd203cfe468b55ea061877267012a Mon Sep 17 00:00:00 2001
From: Florian Bury <florian.bury@uclouvain.be>
Date: Wed, 1 Dec 2021 08:37:24 +0000
Subject: [PATCH] Earth 3D plot example

---
 utilities/earth.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 utilities/earth.py

diff --git a/utilities/earth.py b/utilities/earth.py
new file mode 100644
index 0000000..1b46a61
--- /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)
-- 
GitLab