MCPcopy
hub / github.com/pydata/xarray / _check_higher_resolution

Function _check_higher_resolution

xarray/coding/times.py:458–469  ·  view source on GitHub ↗

Iterate until fitting resolution found.

(
    flat_num_dates: np.ndarray,
    time_unit: PDDatetimeUnitOptions,
)

Source from the content-addressed store, hash-verified

456
457
458def _check_higher_resolution(
459 flat_num_dates: np.ndarray,
460 time_unit: PDDatetimeUnitOptions,
461) -> tuple[np.ndarray, PDDatetimeUnitOptions]:
462 """Iterate until fitting resolution found."""
463 index = _ORDERED_PANDAS_TIME_RESOLUTIONS.index(time_unit)
464 new_units = _ORDERED_PANDAS_TIME_RESOLUTIONS[index:]
465 for new_time_unit in new_units:
466 if not ((np.unique(flat_num_dates % 1) > 0).any() and new_time_unit != "ns"):
467 break
468 flat_num_dates *= 1000
469 return flat_num_dates, new_time_unit
470
471
472def _decode_datetime_with_pandas(

Callers 1

_numbers_to_timedeltaFunction · 0.85

Calls 2

indexMethod · 0.45
anyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…