- Timestamp:
- Sep 19, 2015, 4:59:59 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing_tools.py
r638 r645 2055 2055 mon = firstTvec[1] 2056 2056 day = firstTvec[2] 2057 2057 2058 Iunits = np.mod(hour,Nunits) 2058 2059 if np.sum(firstTvec[2:5]) > 0: 2059 2060 firstTdt = dt.datetime(yr, mon, day+1, 0, 0, 0) 2060 2061 datev = dt.datetime(yr, mon, day+1, 0, 0, 0) 2062 elif Iunits != 0: 2063 nNunits = int(day/Nunits) 2064 firstTdt = dt.datetime(yr, mon, nNunits*Nunits, 0, 0, 0) 2065 datev = dt.datetime(yr, mon, nNunits*Nunits, 0, 0, 0) 2061 2066 else: 2062 2067 firstTdt = dt.datetime(yr, mon, day, 0, 0, 0) … … 2076 2081 hour = firstTvec[3] 2077 2082 2078 if np.sum(firstTvec[4:5]) > 0 or np.mod(hour,Nunits) != 0: 2083 Iunits = np.mod(hour,Nunits) 2084 if np.sum(firstTvec[4:5]) > 0 or Iunits != 0: 2079 2085 tadvance = 2*Nunits 2080 2086 if tadvance >= 24: … … 2082 2088 datev = dt.datetime(yr, mon, day+1, 0, 0, 0) 2083 2089 else: 2084 firstTdt = dt.datetime(yr, mon, day, Nunits, 0, 0) 2085 datev = dt.datetime(yr, mon, day, Nunits, 0, 0) 2090 nNunits = int(hour/Nunits) 2091 firstTdt = dt.datetime(yr, mon, day, nNunits*Nunits, 0, 0) 2092 datev = dt.datetime(yr, mon, day, nNunits*Nunits, 0, 0) 2086 2093 else: 2087 2094 firstTdt = dt.datetime(yr, mon, day, hour, 0, 0) … … 2101 2108 minu = firstTvec[4] 2102 2109 2103 if firstTvec[5] > 0 or np.mod(minu,Nunits) != 0: 2110 Iunits = np.mod(minu,Nunits) 2111 if firstTvec[5] > 0 or Iunits != 0: 2104 2112 tadvance = 2*Nunits 2105 2113 if tadvance >= 60: … … 2107 2115 datev = dt.datetime(yr, mon, day, hour, 0, 0) 2108 2116 else: 2109 firstTdt = dt.datetime(yr, mon, day, hour, Nunits, 0) 2110 datev = dt.datetime(yr, mon, day, hour, Nunits, 0) 2117 nNunits = int(minu/Nunits) 2118 firstTdt = dt.datetime(yr, mon, day, hour, nNunits*Nunits, 0) 2119 datev = dt.datetime(yr, mon, day, hour, nNunits*Nunits, 0) 2111 2120 else: 2112 2121 firstTdt = dt.datetime(yr, mon, day, hour, minu, 0) … … 2119 2128 elif tu == 's': 2120 2129 datev=firstTdt 2130 yr = firstTvec[0] 2131 mon = firstTvec[1] 2132 day = firstTvec[2] 2133 hour = firstTvec[3] 2134 min = firstTvec[4] 2135 secu = firstTvec[5] 2136 2137 Iunits = np.mod(secu,Nunits) 2138 if firstTvec[5] > 0 or Iunits != 0: 2139 tadvance = 2*Nunits 2140 if tadvance >= 60: 2141 firstTdt = dt.datetime(yr, mon, day, hour, min, 0) 2142 datev = dt.datetime(yr, mon, day, hour, min, 0) 2143 else: 2144 nNunits = int(minu/Nunits) 2145 firstTdt = dt.datetime(yr, mon, day, hour, min, nNunits*Nunits) 2146 datev = dt.datetime(yr, mon, day, hour, min, nNunits*Nunits) 2147 else: 2148 firstTdt = dt.datetime(yr, mon, day, hour, min, secu) 2149 datev = dt.datetime(yr, mon, day, hour, min, secu) 2121 2150 it=0 2122 2151 while datev <= lastTdt: 2123 datev = firstTdt + dt.timedelta(seconds=Nunits )2152 datev = firstTdt + dt.timedelta(seconds=Nunits*it) 2124 2153 timeout.append(datev) 2125 2154 it = it + 1
Note: See TracChangeset
for help on using the changeset viewer.