@@ -60,7 +60,7 @@ def eci2ecef(
6060 else :
6161 raise ImportError ("eci2ecef requires either Numpy or Astropy" )
6262
63- return xe . squeeze ()[()] , ye . squeeze ()[()] , ze . squeeze ()[()]
63+ return xe , ye , ze
6464
6565
6666def eci2ecef_astropy (
@@ -89,23 +89,15 @@ def eci2ecef_numpy(x, y, z, t: datetime) -> tuple:
8989 see eci2ecef() for description
9090 """
9191
92- x = np .atleast_1d (x )
93- y = np .atleast_1d (y )
94- z = np .atleast_1d (z )
95- gst = np .atleast_1d (greenwichsrt (juliandate (t )))
96- assert x .shape == y .shape == z .shape
97- if gst .size == 1 and x .size != 1 :
98- gst = np .broadcast_to (gst , x .shape [0 ])
99- assert x .size == gst .size
92+ gst = greenwichsrt (juliandate (t ))
10093
10194 c = np .cos (gst )
10295 s = np .sin (gst )
10396
104- x_ecef = (c * x .ravel () + s * y .ravel ()).reshape (x .shape )
105- y_ecef = (- s * x .ravel () + c * y .ravel ()).reshape (y .shape )
106- z_ecef = z .reshape (z .shape )
97+ x_ecef = c * x + s * y
98+ y_ecef = - s * x + c * y
10799
108- return x_ecef . squeeze ()[()] , y_ecef . squeeze ()[()], z_ecef . squeeze ()[()]
100+ return x_ecef , y_ecef , z
109101
110102
111103def ecef2eci (
@@ -168,21 +160,13 @@ def ecef2eci_numpy(x, y, z, t: datetime) -> tuple:
168160 """ecef2eci using Numpy
169161 see ecef2eci() for description
170162 """
171- x = np .atleast_1d (x )
172- y = np .atleast_1d (y )
173- z = np .atleast_1d (z )
174- gst = np .atleast_1d (greenwichsrt (juliandate (t )))
175163
176- assert x .shape == y .shape == z .shape
177- if gst .size == 1 and x .size != 1 :
178- gst = np .broadcast_to (gst , x .shape [0 ])
179- assert x .size == gst .size
164+ gst = greenwichsrt (juliandate (t ))
180165
181166 c = np .cos (gst )
182167 s = np .sin (gst )
183168
184- x_eci = (c * x .ravel () - s * y .ravel ()).reshape (x .shape )
185- y_eci = (s * x .ravel () + c * y .ravel ()).reshape (y .shape )
186- z_eci = z .reshape (z .shape )
169+ x_eci = c * x - s * y
170+ y_eci = s * x + c * y
187171
188- return x_eci . squeeze ()[()] , y_eci . squeeze ()[()], z_eci . squeeze ()[()]
172+ return x_eci , y_eci , z
0 commit comments