def ymd2JD (year, month, day, hour=0.0, minute=0.0, second=0.0):
  """
  Converts a calender date (year, month, day) to a Julian date, number of days and fraction
  """
  julian_day = ((1461*(year + 4800 + ((month - 14)/12.)))/4.) \
             + ((367*(month - 2 - 12*((month - 14)/12.)))/12.) \
             - ((3*((year + 4900 + ((month - 14)/12.))/100.))/4.) \
             + day - 32074.5 # 0h based
  julian_hour = (hour*3600. + minute*60. + second)/3600./24.
  julian_date = julian_day + julian_hour
  return julian_date