From fa84c5d55b15e026ae752c0cec45828489a108a4 Mon Sep 17 00:00:00 2001 From: tvo Date: Thu, 10 Oct 2024 15:39:44 -0600 Subject: [PATCH 1/2] Use keyword argument for nan=0 --- fundamentals/03.1_computation_with_xarray.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fundamentals/03.1_computation_with_xarray.ipynb b/fundamentals/03.1_computation_with_xarray.ipynb index 9dbaadd0..7f4b2184 100644 --- a/fundamentals/03.1_computation_with_xarray.ipynb +++ b/fundamentals/03.1_computation_with_xarray.ipynb @@ -149,7 +149,7 @@ }, "outputs": [], "source": [ - "np.nan_to_num(ds.sst, 0)" + "np.nan_to_num(ds.sst, nan=0)" ] }, { From 7e64ac7865a450bc6247526dbc4e0fc130842187 Mon Sep 17 00:00:00 2001 From: tvo Date: Thu, 10 Oct 2024 15:51:57 -0600 Subject: [PATCH 2/2] Also explicitly set nan keyword here --- fundamentals/03.1_computation_with_xarray.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fundamentals/03.1_computation_with_xarray.ipynb b/fundamentals/03.1_computation_with_xarray.ipynb index 7f4b2184..b72d93e9 100644 --- a/fundamentals/03.1_computation_with_xarray.ipynb +++ b/fundamentals/03.1_computation_with_xarray.ipynb @@ -167,7 +167,7 @@ "metadata": {}, "outputs": [], "source": [ - "xr.apply_ufunc(np.nan_to_num, ds.sst, 0)" + "xr.apply_ufunc(np.nan_to_num, ds.sst, kwargs={\"nan\": 0})" ] }, {