Skip to content

Commit 43e8c4b

Browse files
committed
👽 Mute xarray.open_mfdataset deprecation warning
Was getting some deprecation warnings with xarray being upgraded from 0.12.1 to 0.12.3. Specifically, the open_mfdatset used in deepbedmap.get_image_with_bounds warns of an upcoming functional change in 0.13. Warning is silenced by setting a `combine="nested"` argument that replicates the old behaviour. See also pydata/xarray#3091.
1 parent 1776b4c commit 43e8c4b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

deepbedmap.ipynb

+3-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@
8080
" but the window_bound extents will be correct\n",
8181
" \"\"\"\n",
8282
"\n",
83-
" with xr.open_mfdataset(paths=filepaths, concat_dim=None) as dataset:\n",
83+
" with xr.open_mfdataset(\n",
84+
" paths=filepaths, combine=\"nested\", concat_dim=None\n",
85+
" ) as dataset:\n",
8486
" # Retrieve dataarray from NetCDF datasets\n",
8587
" dataarray = dataset.z.isel(indexers=indexers)\n",
8688
"\n",

deepbedmap.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ def get_image_with_bounds(filepaths: list, indexers: dict = None) -> xr.DataArra
6969
but the window_bound extents will be correct
7070
"""
7171

72-
with xr.open_mfdataset(paths=filepaths, concat_dim=None) as dataset:
72+
with xr.open_mfdataset(
73+
paths=filepaths, combine="nested", concat_dim=None
74+
) as dataset:
7375
# Retrieve dataarray from NetCDF datasets
7476
dataarray = dataset.z.isel(indexers=indexers)
7577

0 commit comments

Comments
 (0)