(units: str)
| 944 | |
| 945 | |
| 946 | def _cleanup_netcdf_time_units(units: str) -> str: |
| 947 | time_units, ref_date = _unpack_netcdf_time_units(units) |
| 948 | time_units = time_units.lower() |
| 949 | if not time_units.endswith("s"): |
| 950 | time_units = f"{time_units}s" |
| 951 | # don't worry about reifying the units if they're out of bounds or |
| 952 | # formatted badly |
| 953 | with contextlib.suppress(OutOfBoundsDatetime, ValueError): |
| 954 | units = f"{time_units} since {format_timestamp(ref_date)}" |
| 955 | return units |
| 956 | |
| 957 | |
| 958 | def _encode_datetime_with_cftime(dates, units: str, calendar: str) -> np.ndarray: |
no test coverage detected
searching dependent graphs…