Hi 

I think there is a bug in the conversion routines jul2num() and num2jul(). I 
tried to define a date axis for satellite data. The time is measured in a 
modified Julian Date (JD). So reading in the data and then doing

mp = julian2num(jd)
dates = num2date(mp)

resulted in an error "year out of range" (or so). I looked at the values and 
they were way to high. Inspection of the source date.py showed for the 
conversion routines

julian2num: j + 1721425.5
num2julian: j - 1721425.5

Since the JD measures days from 4713 BC - earlier than the matplotlib 
zeropoint -  the conversion should be the other way round, i.e. for julian2num 
we should subtract. 

After correcting this, I could still not reconcile my measurement dates with 
the result of num2date(). In the source it is stated that counting starts at   
0001-01-01 00:00:00 UTC (JD 1721423.5), which BTW does not match the number 
used in the routines. The only way to correct this was to use an offset of JD 
1721424.5 (January 2nd, 0001, 00:00:00). 

So the correct formulae should be

julian2num: j - 1721424.5
num2julian: j + 1721424.5

or am I missing something?

VERSION INFO: matplotlib V. 0.99.1.1/python 2.6.2

on opensuse 11.2/x86_64


Cheers
gl

-- 
Günter Lichtenberg


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to