marcuspetschlies / cvc

3 stars 7 forks source link

hdf5 calls should check for existence of group names and datasets #7

Open kostrzewa opened 5 years ago

kostrzewa commented 5 years ago

There are a number of crashers which occur if a group name already exists and one attempts to recreate it. Similarly, if a dataset already exists it can be overwritten, but one has to check for that and then explicitly overwrite it.

I'm happy to work on the h5 interfacing by adding some helper routines to perform the checks. We just need to agree to freeze the h5 interface for a while so we don't work at cross purposes.

kostrzewa commented 5 years ago

I've implemented this in https://github.com/kostrzewa/cvc-1/commit/038d1df4f727f7122cbba521a03ce161e9fac843 and it seems to work. Should be called before group / dataset creation. No need to call it before dataset write though.

kostrzewa commented 5 years ago

Using this in contract_write_to_h5_file before dataset creation, see 083326dc68fcd7609aa522ecb43ef42dda689e94, allows cpff_invert_contract to complete successfully even if the dataset already exists, opening and overwriting it rather than creating and writing it. Alternatively, one could skip the writing at this point if desired.