-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathget_mjd.m
32 lines (28 loc) · 1003 Bytes
/
get_mjd.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function dmjd = get_mjd(year, doy, meanUTC);
% inputs are year, day of year, and decimal hours (meanUTC)
% Note: hours are actually in GPS time, so they will be off by
% 15-20 seconds or so
% returns modified julian date
% wrote this to avoid using mjuliandate, which is in the aerospace toolbox
% kristine m. larson
% for goofy times
if meanUTC > 24
fprintf(1,'Bad UTC value %7.2f Setting to zero \n', meanUTC);
meanUTC = 0;
end
if meanUTC < 0
fprintf(1,'Bad UTC value %7.2f Setting to zero \n', meanUTC);
meanUTC = 0;
end
% get month and day;
[yy,mm,dd] = daynum(year, doy);
hh=floor(meanUTC);
minutesD = 60*(meanUTC - hh); % decimal minutes
minutes = floor(60*(meanUTC - hh));
seconds = round(60*(minutesD - minutes));
%modified julian date, mostly for tide people
%this is in the aerospace toolbox, thus not accessible
%replacing with something i found online.
%dmjd = mjuliandate(year,mm,dd, hh, minutes, seconds);
dmjd = my_mjd(year,mm,dd, hh, minutes, seconds);
end