IF (inyr.EQ.jdofmhr(monid-1)+dtcouple) THEN !do this block month start
IF (inyr.EQ.jdofmhr(monid)) THEN !do block if month-end
IF (inyr .EQ. jdofmhr(12)) THEN ! do this block at year-end
INTEGER inyr ! hours into the current year, end of coupled period
inyr = mod(iloop*dtcouple, 365*24)
IF (inyr .EQ. 0) inyr=jdofmhr(12)
IF ((inyr.GT.jdofmhr(mn-1)).AND.(inyr.LE.jdofmhr(mn))) monid=mn
dayid= int((inyr-dtcouple-jdofmhr(monid-1))/24.0) +1
IF (inyr.EQ.dtcouple) THEN !do this block at start of new year