Unidata/netcdf4-python — pull request #303 by cpaulik (2014-11-04 10:47:45+00:00)
Title: Vectorized DateFromJulianDay and JulianDayFromDate

This should mitigate Issue #296 by vectorizing DateFromJulianDay and JulianDayFromDate.

For the vecorization of JulianDayFromDate I had to implement a case for netcdf.datetime and one for regular datetime. Since properties are used the calls to the lambda functions were very expensive when getting the information out of the netcdftime.datetime object.
I now use the _ attributes directly if a netcdf.datetime object is given.

I also tried to change the netcdf.datetime class to not use properties but to enforce the immutability by overwriting the __ setattr __ method but this slowed down the num2date case when netcdf.datetime objects had to be created.

Issue #75 also caused some minor problems. I fixed it by adding half a second to the julian date when getting the day part and the fractional day. This works but I am not sure that we should actually go to the next day if the jd is not >= 0.5?

My development environment also runs autopep automatically so I hope you don't mind all the small added spaces around stuff.