boutproject / xBOUT

Collects BOUT++ data from parallelized simulations into xarray.
https://xbout.readthedocs.io/en/latest/
Apache License 2.0
21 stars 8 forks source link

xarray cacheing NetCDF files #277

Open bendudson opened 1 year ago

bendudson commented 1 year ago

When reading data xarray uses a cache. This can cause problems because xarray doesn't check if the file has changed on disk. The result is either reading out-of-date data, or errors about array sizes not matching.

There is some discussion here: https://github.com/pydata/xarray/issues/4240

From that discussion: Closing datasets with the ds.close() method may work. Clear the file cache with: xarray.backends.file_manager.FILE_CACHE.clear()

mikekryjak commented 1 year ago

Thanks @bendudson, it's good to know this has been seen elsewehere!

I have tried this in Jupyter. The command executes, but then when I try to read in a case I get a kernel crash with very little verbosity. Will need to dig a bit deeper.

I get the below message: The Kernel crashed while executing code in the the current cell or a previous cell. Please review the code in the cell(s) to identify a possible cause of the failure. Click here for more info. View Jupyter log for further details.

Jupyter log:

error 10:30:07.495: Disposing session as kernel process died ExitCode: undefined, Reason: /ssd_scratch/anaconda3/lib/python3.9/site-packages/traitlets/traitlets.py:2544: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
  warn(
/ssd_scratch/anaconda3/lib/python3.9/site-packages/traitlets/traitlets.py:2495: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '2146a369-82ca-44ef-97ac-b08b8f5339c3' instead of 'b"2146a369-82ca-44ef-97ac-b08b8f5339c3"'.
  warn(

info 10:30:07.496: Dispose Kernel process 1195168.
error 10:30:07.498: Raw kernel process exited code: undefined