I'm using xarray.DataArray for loading data. One of the variables 'mtime' in the data looks like:
xarray.DataArray 'mtime' (mtimedim: 3)
array([149, 13, 0])
Coordinates: time datetime64[ns] 2009-05-29T13:00:00
lon float64 -150.0
lat float64 11.25
LBC float64 ...
Dimensions without coordinates: mtimedim
Attributes: long_name: model times (day, hour, minute)
units: day, hour, minute
I wish to fetch the first element 149 in the DataArray. I would like to fetch it as an individual element and not as xarray. I'm currently doing it as
data.mtime.to_series()[0]
And my output is 149. Is this the right way to do it or is there a better approach? Appreciate your help. Thanks.