Try finding the coordinates of Null Island (geodetic latitude 0, longitude 0, elevation 0) at noon on January 1, 2000 as per the following code:
[ecef_x, ecef_y, ecef_z] = geodetic2ecef(0, 0, 0)
J2K0 = datetime(2000, 1, 1, 12, 0, 'TimeZone', 'UTCLeapSeconds')
[eci_x, eci_y, eci_z] = ecef2eci(ecef_x, ecef_y, ecef_z, J2K0)
Then run the same code via pymap3d and you will see the difference:
[J2K0_whole, J2k0_fraction] = py.matlab_datenum_to_datetime(J2K0)
J2K0_for_pymap3d = J2K0_whole + J2K0_fraction
eci_vector = py.pymap3d.ecef2eci(ecef_x, ecef_y, ecef_z, J2K0_for_pymap3d )
where matlab_datenum_to_datetime explicitly transforms the date as follows:
function [whole_days, fractional_days] = matlab_datenum_to_datetime(matlab_decimal_datenum):
PYTHON_TO_MATLAB_CORRECTION_CONSTANT = td(days=366)
whole_days = [dt.fromordinal(int(date)) for date in matlab_decimal_datenum]
remainder_days = [number%1 for number in matlab_decimal_datenum]
fractional_days_uncorrected = [td(days=remainder) for remainder in remainder_days]
fractional_days = []
for day in range(len(fractional_days_uncorrected)):
next_fractional_uncorrected_day = fractional_days_uncorrected[day]
fractional_days.append(next_fractional_uncorrected_day - PYTHON_TO_MATLAB_CORRECTION_CONSTANT)
end
I cannot figure out where the error is coming from, so I resorted to calling pymap3d from MATLAB since it uses astropy. You might want to get rid of this repo and just recommend that route if you cannot fix the issue.
Try finding the coordinates of Null Island (geodetic latitude 0, longitude 0, elevation 0) at noon on January 1, 2000 as per the following code:
[ecef_x, ecef_y, ecef_z] = geodetic2ecef(0, 0, 0)J2K0 = datetime(2000, 1, 1, 12, 0, 'TimeZone', 'UTCLeapSeconds')[eci_x, eci_y, eci_z] = ecef2eci(ecef_x, ecef_y, ecef_z, J2K0)Then run the same code via
pymap3dand you will see the difference:[J2K0_whole, J2k0_fraction] = py.matlab_datenum_to_datetime(J2K0)J2K0_for_pymap3d = J2K0_whole + J2K0_fraction
eci_vector = py.pymap3d.ecef2eci(ecef_x, ecef_y, ecef_z, J2K0_for_pymap3d )where
matlab_datenum_to_datetimeexplicitly transforms the date as follows:I cannot figure out where the error is coming from, so I resorted to calling
pymap3dfrom MATLAB since it usesastropy.You might want to get rid of this repo and just recommend that route if you cannot fix the issue.