From madrigal at kundor.org Fri Dec 11 00:30:07 2009 From: madrigal at kundor.org (Nick Matteo) Date: Fri, 11 Dec 2009 00:30:07 -0500 Subject: [OpenMadrigal-users] strangeness in getFyear Message-ID: Hello, I was comparing various time parameters available from Madrigal. So I computed the fractional year from the 'year', 'dayno', 'hour', 'min', and 'sec' parameters: fyear = year + (dayno - 1 + (hour + (min + sec/60)/60)/24)/366 (this was for 2008, hence 366.) I kept seeing a .0015 discrepancy, which is about 13 hours. I thought I'd check the source to see if fractional year is defined in a different way. The relevant computation seems to be in source/madc/madrec/madDeriveMethods.c, getFyear. I found these lines: fyear = (double)iyr; daysNow = ((double)(dayOfYear - 1)); daysNow += ((double)(24 * hour + min))/(24.0*60.0); daysNow += ((double)ics)/ (100.0*3600.0*24.0); fyear += daysNow / ((double)daysInYear); (24*hour + min)/(24*60), or in other words hour/60 + min/(24*60), doesn't seem right. Surely it should be hour/24 + min/(24*60)? Or, equivalently, (hour + min/60)/24? Thanks, Nick From brideout at haystack.mit.edu Wed Dec 23 09:19:48 2009 From: brideout at haystack.mit.edu (Bill Rideout) Date: Wed, 23 Dec 2009 09:19:48 -0500 Subject: [OpenMadrigal-users] strangeness in getFyear In-Reply-To: References: Message-ID: <1721A43B-A535-4381-AA39-B2F797EEAD49@haystack.mit.edu> Nick, You are correct. I've patched our Madrigal server here at Millstone Hill, but the bug will still appear at the other Madrigal sites until the next release. Thanks for pointing out the problem, and tracing it all the way into the C code! Bill Rideout On Dec 11, 2009, at 12:30 AM, Nick Matteo wrote: > Hello, > I was comparing various time parameters available from Madrigal. So I > computed the fractional year from the 'year', 'dayno', 'hour', 'min', > and 'sec' parameters: > fyear = year + (dayno - 1 + (hour + (min + sec/60)/60)/24)/366 > (this was for 2008, hence 366.) > I kept seeing a .0015 discrepancy, which is about 13 hours. I thought > I'd check the source to see if fractional year is defined in a > different way. > The relevant computation seems to be in > source/madc/madrec/madDeriveMethods.c, getFyear. > I found these lines: > > fyear = (double)iyr; > daysNow = ((double)(dayOfYear - 1)); > daysNow += ((double)(24 * hour + min))/(24.0*60.0); > daysNow += ((double)ics)/ (100.0*3600.0*24.0); > fyear += daysNow / ((double)daysInYear); > > (24*hour + min)/(24*60), or in other words hour/60 + min/(24*60), > doesn't seem right. Surely it should be hour/24 + min/(24*60)? Or, > equivalently, (hour + min/60)/24? > > Thanks, > Nick > _______________________________________________ > OpenMadrigal-users mailing list > OpenMadrigal-users at openmadrigal.org > http://www.openmadrigal.org/mailman/listinfo/openmadrigal-users > > !DSPAM:4b321fd032161687619800! >