@@ -1268,6 +1268,78 @@ def close(self: Any) -> None:
12681268 self ._file_obj .close ()
12691269 self ._file_obj = None
12701270
1271+ def isnull (self , keep_attrs : bool = None ):
1272+ """Test each value in the array for whether it is a missing value.
1273+
1274+ Returns
1275+ -------
1276+ isnull : DataArray or Dataset
1277+ Same type and shape as object, but the dtype of the data is bool.
1278+
1279+ See Also
1280+ --------
1281+ pandas.isnull
1282+
1283+ Examples
1284+ --------
1285+ >>> array = xr.DataArray([1, np.nan, 3], dims="x")
1286+ >>> array
1287+ <xarray.DataArray (x: 3)>
1288+ array([ 1., nan, 3.])
1289+ Dimensions without coordinates: x
1290+ >>> array.isnull()
1291+ <xarray.DataArray (x: 3)>
1292+ array([False, True, False])
1293+ Dimensions without coordinates: x
1294+ """
1295+ from .computation import apply_ufunc
1296+
1297+ if keep_attrs is None :
1298+ keep_attrs = _get_keep_attrs (default = False )
1299+
1300+ return apply_ufunc (
1301+ duck_array_ops .isnull ,
1302+ self ,
1303+ dask = "allowed" ,
1304+ keep_attrs = keep_attrs ,
1305+ )
1306+
1307+ def notnull (self , keep_attrs : bool = None ):
1308+ """Test each value in the array for whether it is not a missing value.
1309+
1310+ Returns
1311+ -------
1312+ notnull : DataArray or Dataset
1313+ Same type and shape as object, but the dtype of the data is bool.
1314+
1315+ See Also
1316+ --------
1317+ pandas.notnull
1318+
1319+ Examples
1320+ --------
1321+ >>> array = xr.DataArray([1, np.nan, 3], dims="x")
1322+ >>> array
1323+ <xarray.DataArray (x: 3)>
1324+ array([ 1., nan, 3.])
1325+ Dimensions without coordinates: x
1326+ >>> array.notnull()
1327+ <xarray.DataArray (x: 3)>
1328+ array([ True, False, True])
1329+ Dimensions without coordinates: x
1330+ """
1331+ from .computation import apply_ufunc
1332+
1333+ if keep_attrs is None :
1334+ keep_attrs = _get_keep_attrs (default = False )
1335+
1336+ return apply_ufunc (
1337+ duck_array_ops .notnull ,
1338+ self ,
1339+ dask = "allowed" ,
1340+ keep_attrs = keep_attrs ,
1341+ )
1342+
12711343 def isin (self , test_elements ):
12721344 """Tests each value in the array for whether it is in test elements.
12731345
0 commit comments