The call to brick() in .stopWriteCDF() may result in an attempt to open the CDF file already opened in .stopWriteCDF() before the call to brick(). This results in an error with hdf5 1.12.1 on Windows due to file locking, which on Windows is no longer a no-op from hdf5 1.12.1. This patch avoids this situation by closing the file, first.
The problem can be reproduced using magclass package. This example fails without this change:
using the attached file (rx.zip, after unzipping).
For testing, one can also disable hdf5 file locking by setting environment variable HDF5_USE_FILE_LOCKING=FALSE. That makes the examples succeed even without the patch.
The call to brick() in .stopWriteCDF() may result in an attempt to open the CDF file already opened in .stopWriteCDF() before the call to brick(). This results in an error with hdf5 1.12.1 on Windows due to file locking, which on Windows is no longer a no-op from hdf5 1.12.1. This patch avoids this situation by closing the file, first.
The problem can be reproduced using magclass package. This example fails without this change:
The example is extracted from magclass package tests, which also fail on Windows with Rtools 5863 (hdf5 1.12.1).
One can also reproduce directly using raster via
using the attached file (rx.zip, after unzipping).
For testing, one can also disable hdf5 file locking by setting environment variable
HDF5_USE_FILE_LOCKING=FALSE
. That makes the examples succeed even without the patch.