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

Function _netcdf_to_numpy_timeunit

xarray/coding/times.py:135–150  ·  view source on GitHub ↗
(units: str)

Source from the content-addressed store, hash-verified

133
134
135def _netcdf_to_numpy_timeunit(units: str) -> NPDatetimeUnitOptions:
136 units = units.lower()
137 if not units.endswith("s"):
138 units = f"{units}s"
139 return cast(
140 NPDatetimeUnitOptions,
141 {
142 "nanoseconds": "ns",
143 "microseconds": "us",
144 "milliseconds": "ms",
145 "seconds": "s",
146 "minutes": "m",
147 "hours": "h",
148 "days": "D",
149 }[units],
150 )
151
152
153def _numpy_to_netcdf_timeunit(units: NPDatetimeUnitOptions) -> str:

Calls 2

lowerMethod · 0.80
endswithMethod · 0.80

Used in the wild real call sites across dependent graphs

searching dependent graphs…