radian angle to degrees function radToDeg(angleRad) { return (180.0 * angleRad / Math.PI); }//*********************************************************************/// Convert degree angle to radians function degToRad(angleDeg) { return (Math.PI * angleDeg / 180.0); }//*********************************************************************///***********************************************************************///* Name: calcDayOfYear *///* Type: Function *///* Purpose: Finds numerical day-of-year from mn, day and lp year info *///* Arguments: *///* month: January = 1 *///* day : 1 - 31 *///* lpyr : 1 if leap year, 0 if not *///* Return value: *///* The numerical day of year *///***********************************************************************/ function calcDayOfYear(mn, dy, lpyr) { var k = (lpyr ? 1 : 2); var doy = Math.floor((275 * mn)/9) - k * Math.floor((mn + 9)/12) + dy -30; return doy; }//***********************************************************************///* Name: calcDayOfWeek *///* Type: Function *///* Purpose: Derives weekday from Julian Day *///* Arguments: *///* juld : Julian Day *///* Return value: *///* String containing name of weekday *///***********************************************************************/ function calcDayOfWeek(juld) { var A = (juld + 1.5) % 7; var DOW = (A==0)?"Sunday":(A==1)?"Monday":(A==2)?"Tuesday":(A==3)?"Wednesday":(A==4)?"Thursday":(A==5)?"Friday":"Saturday"; return DOW; }//***********************************************************************///* Name: calcJD *///* Type: Function *///* Purpose: Julian day from calendar day *///* Arguments: *///* year : 4 digit year *///* month: January = 1 *///* day : 1 - 31 *///* Return value: *///* The Julian day corresponding to the date *///* Note: *///* Number is returned for start of day. Fractional days should be *///* added later. *///***********************************************************************/ function calcJD(year, month, day) { if (month <= 2) { year -= 1; month += 12; } var A = Math.floor(year/100); var B = 2 - A + Math.floor(A/4); var JD = Math.floor(365.25*(year + 4716)) + Math.floor(30.6001*(month+1)) + day + B - 1524.5; return JD; }//***********************************************************************///* Name: calcDateFromJD *///* Type: Function *///* Purpose: Calendar date from Julian Day *///* Arguments: *///* jd : Julian Day *///* Return value: *///* String date in the form DD-MONTHNAME-YYYY *///* Note: *///***********************************************************************/ function calcDateFromJD(jd) { var z = Math.floor(jd + 0.5); var f = (jd + 0.5) - z; if (z < 2299161) { var A = z; } else { alpha = Math.floor((z - 1867216.25)/36524.25); var A = z + 1 + alpha - Math.floor(alpha/4); } var B = A + 1524; var C = Math.floor((B - 122.1)/365.25); var D = Math.floor(365.25 * C); var E = Math.floor((B - D)/30.6001); var day = B - D - Math.floor(30.6001 * E) + f; var month = (E < 14) ? E - 1 : E - 13; var year = (month > 2) ? C - 4716 : C - 4715; // alert ("date: " + day + "-" + monthList[month-1].name + "-" + year); return (day + "-" + monthList[month-1].name + "-" + year); }//***********************************************************************///* Name: calcDayFromJD *///* Type: Function *///* Purpose: Calendar day (minus year) from Julian Day *///* Arguments: *///* jd : Julian Day *///* Return value: *///* String date in the form DD-MONTH *///***********************************************************************/ function calcDayFromJD(jd) { var z = Math.floor(jd + 0.5); var f = (jd + 0.5) - z; if (z < 2299161) { var A = z; } else { alpha = Math.floor((z - 1867216.25)/36524.25); var A = z + 1 + alpha - Math.floor(alpha/4); } var B = A + 1524;