Skip to content
Snippets Groups Projects
Commit 865ff516 authored by leprob001's avatar leprob001
Browse files

Added conversion functions for converting julian day to rafos julian day.

parent f895fb52
No related branches found
No related tags found
No related merge requests found
function rjul = dmy2rd(day,mon,yr)
%
%function rjul = dmy2rd(day,month,yr)
%
% converts (day, month, year) to RAFOS JULIAN day (rjul)
% RAFOS JULIAN day = julian day (ref. to 24 nov 4713BC) - 2440000
%
% translated from dates.c from GSO RAFOS processing code
% which was taken from Collected Algorithms from ACM, #199
% "astronomically correct"
% and converted to RAFOS JULIAN day 20.03.91 kst
% This routine is valid forever ....
%
% NOTE: this RAFOS JULIAN day = old ARGOS day - 6718 + 1
if (nargin == 1)
d = day;
day = d(:,1);
mon = d(:,2);
yr = d(:,3);
end
day = day(:); mon = mon(:); yr = yr(:);
gttwo = find( mon > 2 );
letwo = find( mon < 3 );
mon(gttwo) = mon(gttwo) - 3;
mon(letwo) = mon(letwo) + 9;
yr(letwo) = yr(letwo) - 1;
ic = floor( yr / 100 );
iy = yr - 100*ic;
rjul = floor((146097*ic)/4) + floor((1461*iy)/4) + floor((153*mon+2)/5) ...
+ day + 1721119;
% rjul = rjul - 2440000;
% OB redefined rafos day, to shorten numbers
rjul = rjul - 2451545;
\ No newline at end of file
function rd=hms2rd(h,m,s)
%HMS2RD Convert hours minutes seconds into rafos day
% sz=size(hms);
% if sz(2)~=3
% hms=hms';
% end
hours=h*60*60;
minutes=m*60;
seconds=s;
dayins=24*60*60;
rd=(hours+minutes+seconds)/dayins;
% end hms2rd
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment