-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is PrePARE OK with leap years ? #325
Comments
The problem can be addressed by paying attention to the description of calendars at the end of http://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/cf-conventions.html#calendar . When a simulation spans a period crossing the date when the Gregorian Calendar was first adopted (i.e., 1582-10-15), you need to set calendar="proleptic_gregorian". Otherwise a 9-day discrepancy is found. By the way, according to this calendar, leap years occur in years evenly divisible by 4 except years evenly divisible by 100 and not evenly divisible by 400. By my reckoning, that gives us int((1850-1500)/4+1) - 3 (to account for century adjustments) = 85 leap years for years 1500 through 1850 (inclusive). So the number of days in that period should be: 351*365 + 85 = 128200, and the first time sample for year 1850 should be 128200 - 365 + 0.5 (for the middle of the day) = 127835.5. |
This issue was also noted in item 17c of global attributes section of https://goo.gl/neswPr . Is there a way to make that information more prominent? |
Thanks for this clear explanation. I had never dig that question, and didn't notice that the Python datetime library states that it is:
and that Xios , when instructed to use a gregorian calendar, actually behaves as if a proleptic_gregorian option was used |
And PrePARE duly decalres that the data is correct once the value of calendar_type is changed to proleptic_gregorian. |
this issue can be closed. |
Using two distinct libraries (python/datetime and Xios), it seems that gregorian calendar has 127835 days between 1500-01-01 and 1850-01-01
However, when PrePARE is fed with a file having the time variable dumped below, it complains in a way which implies that there is a 9 days discrepancy with its own calculation .
Which library is right ?
The text was updated successfully, but these errors were encountered: