RKuttruff commented on code in PR #73:
URL:
https://github.com/apache/incubator-sdap-ingester/pull/73#discussion_r1165855221
##########
granule_ingester/granule_ingester/processors/reading_processors/TileReadingProcessor.py:
##########
@@ -86,5 +86,12 @@ def _convert_spec_to_slices(spec):
def _convert_to_timestamp(times: xr.DataArray) -> xr.DataArray:
if times.dtype == np.float32:
return times
+ elif times.dtype.type == np.timedelta64: # If time is an array of
offsets from a fixed reference
+ reference = times.time.item() / 1e9 # Get the base time in
seconds
+
+ times = (times / 1e9).astype(int) # Convert offset array to
seconds
+ times = times.where(times != -9223372036854775808) # Replace NaT
values with NaN
Review Comment:
For reference to the big number here:
```python
>>> import numpy as np
>>>
>>> np.datetime64('NaT').astype(int)
-9223372036854775808
>>>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]