In [4]:
import xarray as xr
import numpy as np
In [47]:
arr = xr.DataArray(np.arange(16).reshape(4, 4),[('x', ['a', 'b', 'c', 'd']), ('y', [10, 20, 30, 40])],name='sample')
In [48]:
arr.name
Out[48]:
In [55]:
arr
Out[55]:
In [59]:
arr.mean(['x','y'])
Out[59]:
In [26]:
arr+10
Out[26]:
In [45]:
nan_arr = xr.DataArray([[0, 1, np.nan, np.nan, 2],[0, 1, np.nan, np.nan, 2]], dims=(['x', 'y']), name='1D_with_nan')
In [46]:
nan_arr
Out[46]:
In [33]:
nan_arr.isnull()
Out[33]:
In [35]:
nan_arr.notnull()
Out[35]:
In [36]:
nan_arr.count()
Out[36]:
In [39]:
nan_arr.dropna(dim='x')
Out[39]:
In [42]:
nan_arr.fillna('a')
Out[42]:
In [ ]: