Skip to content

Commit

Permalink
Removed transform of XTIME because it doesn't conform to Xarray unit …
Browse files Browse the repository at this point in the history
…standards (#145)
  • Loading branch information
lpilz authored Nov 6, 2023
1 parent 0e6b929 commit 49cbcf8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
2 changes: 1 addition & 1 deletion tests/test_postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_decode_times(times):
@pytest.mark.parametrize(
'sample_dataset_with_kwargs,xtime_dtype',
[
(('mercator', {'decode_times': True}), np.timedelta64),
(('mercator', {'decode_times': True}), np.datetime64),
(('mercator', {'decode_times': False}), np.float32),
],
indirect=['sample_dataset_with_kwargs'],
Expand Down
9 changes: 0 additions & 9 deletions xwrf/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import warnings

import numpy as np
import pandas as pd
import xarray as xr

Expand All @@ -25,14 +24,6 @@ def _decode_times(ds: xr.Dataset) -> xr.Dataset:
)
ds = ds.assign_coords({'Time': _time})
ds.Time.attrs = {'long_name': 'Time', 'standard_name': 'time'}
# make XTIME be consistent with its description
if 'XTIME' in ds.variables and np.issubdtype(ds.XTIME.dtype, np.datetime64):
ds['XTIME'].data = (
ds.XTIME.data
- pd.to_datetime(
ds['XTIME'].description, format='minutes since %Y-%m-%d %H:%M:%S'
).to_datetime64()
)
return ds


Expand Down

0 comments on commit 49cbcf8

Please sign in to comment.