MCPcopy Index your code
hub / github.com/pydata/xarray / _next_higher_resolution

Method _next_higher_resolution

xarray/coding/cftime_offsets.py:203–215  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

201 # analogous https://github.com/pandas-dev/pandas/blob/ccb25ab1d24c4fb9691270706a59c8d319750870/pandas/_libs/tslibs/offsets.pyx#L806
202
203 def _next_higher_resolution(self) -> Tick:
204 self_type = type(self)
205 if self_type is Day:
206 return Hour(self.n * 24)
207 if self_type is Hour:
208 return Minute(self.n * 60)
209 if self_type is Minute:
210 return Second(self.n * 60)
211 if self_type is Second:
212 return Millisecond(self.n * 1000)
213 if self_type is Millisecond:
214 return Microsecond(self.n * 1000)
215 raise ValueError("Could not convert to integer offset at any resolution")
216
217 def __mul__(self, other: int | float) -> Tick:
218 if not isinstance(other, int | float):

Callers 1

__mul__Method · 0.95

Calls 6

typeFunction · 0.85
HourClass · 0.85
MinuteClass · 0.85
SecondClass · 0.85
MillisecondClass · 0.85
MicrosecondClass · 0.85

Tested by

no test coverage detected