[Git][debian-gis-team/cftime][upstream] New upstream version 1.0.2.1

Bas Couwenberg gitlab at salsa.debian.org
Sat Oct 27 18:15:56 BST 2018


Bas Couwenberg pushed to branch upstream at Debian GIS Project / cftime


Commits:
8854d584 by Bas Couwenberg at 2018-10-27T17:05:47Z
New upstream version 1.0.2.1
- - - - -


2 changed files:

- cftime/_cftime.pyx
- test/test_cftime.py


Changes:

=====================================
cftime/_cftime.pyx
=====================================
@@ -38,7 +38,7 @@ cdef int[12] _dpm_360  = [30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]
 cdef int[13] _spm_365day = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365]
 cdef int[13] _spm_366day = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366]
 
-__version__ = '1.0.2'
+__version__ = '1.0.2.1'
 
 # Adapted from http://delete.me.uk/2005/03/iso8601.html
 # Note: This regex ensures that all ISO8601 timezone formats are accepted - but, due to legacy support for other timestrings, not all incorrect formats can be rejected.
@@ -397,7 +397,7 @@ def JulianDayFromDate(date, calendar='standard'):
     minute = year.copy()
     second = year.copy()
     microsecond = year.copy()
-    jd = np.empty(year.shape, np.float128)
+    jd = np.empty(year.shape, np.longdouble)
     cdef long double[:] jd_view = jd
     cdef Py_ssize_t i_max = len(date)
     cdef Py_ssize_t i
@@ -422,7 +422,7 @@ def JulianDayFromDate(date, calendar='standard'):
     # This is about 45 microseconds in 2000 for Julian date starting -4712.
     # (pull request #433).
     if calendar not in ['all_leap','no_leap','360_day','365_day','366_day']:
-        eps = np.array(np.finfo(np.float64).eps,np.float128)
+        eps = np.array(np.finfo(np.float64).eps,np.longdouble)
         eps = np.maximum(eps*jd, eps)
         jd += eps
 
@@ -453,13 +453,13 @@ def DateFromJulianDay(JD, calendar='standard', only_use_cftime_datetimes=False,
     objects are used, which are actually instances of cftime.datetime.
     """
 
-    julian = np.array(JD, dtype=np.float128)
+    julian = np.array(JD, dtype=np.longdouble)
 
     # get the day (Z) and the fraction of the day (F)
     # use 'round half up' rounding instead of numpy's even rounding
     # so that 0.5 is rounded to 1.0, not 0 (cftime issue #49)
     Z = np.atleast_1d(np.int32(_round_half_up(julian)))
-    F = np.atleast_1d(julian + 0.5 - Z).astype(np.float128)
+    F = np.atleast_1d(julian + 0.5 - Z).astype(np.longdouble)
 
     cdef Py_ssize_t i_max = len(Z)
     year = np.empty(i_max, dtype=np.int32)
@@ -486,7 +486,7 @@ def DateFromJulianDay(JD, calendar='standard', only_use_cftime_datetimes=False,
     microsecond = (second % 1)*1.e6
     # remove the offset from the microsecond calculation.
     if calendar not in ['all_leap','no_leap','360_day','365_day','366_day']:
-        eps = np.array(np.finfo(np.float64).eps,np.float128)
+        eps = np.array(np.finfo(np.float64).eps,np.longdouble)
         eps = np.maximum(eps*julian, eps)
         microsecond = np.clip(microsecond - eps*86400.*1e6, 0, 999999)
 
@@ -723,7 +723,7 @@ units to datetime objects.
             if self.origin.year == 0:
                 msg='zero not allowed as a reference year, does not exist in Julian or Gregorian calendars'
                 raise ValueError(msg)
-        self.tzoffset = np.array(tzoffset,dtype=np.float128)  # time zone offset in minutes
+        self.tzoffset = np.array(tzoffset,dtype=np.longdouble)  # time zone offset in minutes
         self.units = units
         self.unit_string = unit_string
         if self.calendar in ['noleap', '365_day'] and self.origin.month == 2 and self.origin.day == 29:


=====================================
test/test_cftime.py
=====================================
@@ -337,8 +337,13 @@ class cftimeTestCase(unittest.TestCase):
         dateref = datetime(2015,2,28,12)
         ntimes = 1001
         verbose = True # print out max error diagnostics
+        precis = np.finfo(np.longdouble).precision
+        if precis < 18:
+            fact = 10
+        else:
+            fact = 1.
         for calendar in calendars:
-            eps = 10.
+            eps = 10.*fact
             units = 'microseconds since 2000-01-30 01:01:01'
             microsecs1 = date2num(dateref,units,calendar=calendar)
             maxerr = 0
@@ -355,7 +360,7 @@ class cftimeTestCase(unittest.TestCase):
                 print('calender = %s max abs err (microsecs) = %s eps = %s' % \
                      (calendar,maxerr,eps))
             units = 'milliseconds since 1800-01-30 01:01:01'
-            eps = 0.01
+            eps = 0.01*fact
             millisecs1 = date2num(dateref,units,calendar=calendar)
             maxerr = 0.
             for n in range(ntimes):
@@ -370,7 +375,7 @@ class cftimeTestCase(unittest.TestCase):
             if verbose:
                 print('calender = %s max abs err (millisecs) = %s eps = %s' % \
                      (calendar,maxerr,eps))
-            eps = 1.e-4
+            eps = 1.e-4*fact
             units = 'seconds since 0001-01-30 01:01:01'
             secs1 = date2num(dateref,units,calendar=calendar)
             maxerr = 0.
@@ -386,7 +391,7 @@ class cftimeTestCase(unittest.TestCase):
             if verbose:
                 print('calender = %s max abs err (secs) = %s eps = %s' % \
                      (calendar,maxerr,eps))
-            eps = 1.e-6
+            eps = 1.e-6*fact
             units = 'minutes since 0001-01-30 01:01:01'
             mins1 = date2num(dateref,units,calendar=calendar)
             maxerr = 0.
@@ -402,7 +407,7 @@ class cftimeTestCase(unittest.TestCase):
             if verbose:
                 print('calender = %s max abs err (mins) = %s eps = %s' % \
                      (calendar,maxerr,eps))
-            eps = 1.e-7
+            eps = 1.e-7*fact
             units = 'hours since 0001-01-30 01:01:01'
             hrs1 = date2num(dateref,units,calendar=calendar)
             maxerr = 0.
@@ -418,7 +423,7 @@ class cftimeTestCase(unittest.TestCase):
             if verbose:
                 print('calender = %s max abs err (hours) = %s eps = %s' % \
                      (calendar,maxerr,eps))
-            eps = 1.e-9
+            eps = 1.e-9*fact
             units = 'days since 0001-01-30 01:01:01'
             days1 = date2num(dateref,units,calendar=calendar)
             maxerr = 0.



View it on GitLab: https://salsa.debian.org/debian-gis-team/cftime/commit/8854d5844619274c81f832d6ab7ad7bb8422cdbe

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/cftime/commit/8854d5844619274c81f832d6ab7ad7bb8422cdbe
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20181027/034f5b58/attachment-0001.html>


More information about the Pkg-grass-devel mailing list