-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
With xarray 0.7.2, following this basic example from the docs, but with a modification in the last line to use pd.Period
instead of pd.Timestamp
:
import numpy as np
import xarray as xr
temp = 15 + 8 * np.random.randn(2, 2, 3)
precip = 10 * np.random.rand(2, 2, 3)
lon = [[-99.83, -99.32], [-99.79, -99.23]]
lat = [[42.25, 42.21], [42.63, 42.59]]
ds = xr.Dataset({'temperature': (['x', 'y', 'time'], temp),
'precipitation': (['x', 'y', 'time'], precip)},
coords={'lon': (['x', 'y'], lon),
'lat': (['x', 'y'], lat),
'time': pd.date_range('2014-09-06', periods=3),
'reference_time': pd.Period('2014')})
This raises:
ValueError: dimensions ('reference_time',) must have the same length as the number of data dimensions, ndim=0
I noticed (#645) that there are other issues stemming from pandas' PeriodIndex & company, so if this is not a straightforward fix I will understand!