function md = convertYD2MD(y,yd)
%   Function: convetYD2MD
%   Author: Daniel O'Hara
%   Date: 12/6/2015
%   Description: Function to convert yearday (YD) to month,day (MD) format.

E = eomday(y,1:12);
s = size(yd);
m = zeros(s(1,1),1);
d = zeros(s(1,1),1);
hit = zeros(s(1,1),1);
for i = 1:12
    yd = yd-E(i);
    con = yd < 0;
    hc = ~hit.*con;
    m(hc==1,1) = i;
    d(hc==1,1) = yd(hc==1,1)+E(i);
    hit(hc==1,1) = 1;
end
md = [m,d];
end

