sunchaoatmo / netcdf4-python

Automatically exported from code.google.com/p/netcdf4-python
0 stars 0 forks source link

julian calendar issue #192

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

import netcdftime as cdftime

print("Using netcdftime version %s" % cdftime.__version__)

day = range(12)
calendar = 'julian'
units = "days since 1900-02-20"

# Convert to dates
date = cdftime.num2date( day, units, calendar )
# Convert back from dates
day2 = cdftime.date2num( date, units, calendar )
# Print
for i in range(len(day)):
  print(day[i],day2[i],date[i].year,date[i].month,date[i].day)

What is the expected output? What do you see instead?

In the Julian calendar, 1900 is a leap year. The dates created above should 
include 1900-2-29. Instead they include 1900-3-1 twice:

Using netcdftime version 1.0
(0, 0.0, 1900, 2, 20)
(1, 1.0, 1900, 2, 21)
(2, 2.0, 1900, 2, 22)
(3, 3.0, 1900, 2, 23)
(4, 4.0, 1900, 2, 24)
(5, 5.0, 1900, 2, 25)
(6, 6.0, 1900, 2, 26)
(7, 7.0, 1900, 2, 27)
(8, 8.0, 1900, 2, 28)
(9, 10.0, 1900, 3, 1)
(10, 10.0, 1900, 3, 1)
(11, 11.0, 1900, 3, 2)

What version of the product are you using? On what operating system?

1.0.4 on Linux.

Please provide any additional information below.

Original issue reported on code.google.com by chris.go...@gmail.com on 25 Jul 2013 at 6:13

GoogleCodeExporter commented 8 years ago

Original comment by whitaker.jeffrey@gmail.com on 26 Feb 2014 at 2:04