|
def transform(self, time, pos, sysaxesIn, sysaxesOut): |
If I do the following:
X = np.random.randn(100, 3)
coords.transform(
datetime(2026, 4, 14, 14, 0, 0, tzinfo=timezone.utc),
X,
"GEO",
"GSE",
)
print("Done coordinate transformation")
I get the following error
File ~/SWVO/.venv/lib/python3.11/site-packages/IRBEM/IRBEM.py:1063, in Coords.transform(self, time, pos, sysaxesIn, sysaxesOut)
1061 for nT in range(pos.shape[0]):
1062 for nX in range(pos.shape[1]):
-> 1063 posInArr[nT][nX] = ctypes.c_double(pos[nT, nX])
1065 self._irbem_obj.coord_trans_vec1_(ctypes.byref(nTime), ctypes.byref(sysIn),
1066 ctypes.byref(sysOut), ctypes.byref(iyear), ctypes.byref(idoy),
1067 ctypes.byref(ut), ctypes.byref(posInArr), ctypes.byref(posOutArr))
1068 return np.array(posOutArr[:])
TypeError: only 0-dimensional arrays can be converted to Python scalars
However if I do;
X = np.random.randn(100, 3)
coords.transform(
[datetime(2026, 4, 14, 14, 0, 0, tzinfo=timezone.utc)] * 100,
X,
"GEO",
"GSE",
)
print("Done coordinate transformation")
It works fine.
The reason for this I can think of is that when passing a (N,3) coordinates, it expects the time to be list as well. However in my workflow, each time step corresponds to (N,3) array. I am not sure if this is the intended behavior or a bug
IRBEM/python/IRBEM/IRBEM.py
Line 1012 in e7cecb0
If I do the following:
I get the following error
However if I do;
It works fine.
The reason for this I can think of is that when passing a (N,3) coordinates, it expects the time to be list as well. However in my workflow, each time step corresponds to (N,3) array. I am not sure if this is the intended behavior or a bug