diff --git a/doc/io.rst b/doc/io.rst index e7d61328d0d..638a7ffc0db 100644 --- a/doc/io.rst +++ b/doc/io.rst @@ -423,7 +423,7 @@ library:: combined = xr.concat(dataset, dim) return combined - read_netcdfs('/all/my/files/*.nc', dim='time') + combined = read_netcdfs('/all/my/files/*.nc', dim='time') This function will work in many cases, but it's not very robust. First, it never closes files, which means it will fail one you need to load more than @@ -454,8 +454,8 @@ deficiencies:: # here we suppose we only care about the combined mean of each file; # you might also use indexing operations like .sel to subset datasets - read_netcdfs('/all/my/files/*.nc', dim='time', - transform_func=lambda ds: ds.mean()) + combined = read_netcdfs('/all/my/files/*.nc', dim='time', + transform_func=lambda ds: ds.mean()) This pattern works well and is very robust. We've used similar code to process tens of thousands of files constituting 100s of GB of data.