[Nexus] Migration from nexus API to hdf5 API
Koennecke Mark
mark.koennecke at psi.ch
Fri Sep 8 08:13:20 BST 2023
Peter,
Am 07.09.2023 um 21:53 schrieb Peterson, Peter via NeXus <nexus at shadow.nd.rl.ac.uk>:
I am looking to migrate a code from using the nexus API to directly using hdf5. Changing everything all at once is a ton of work. The ideas I’ve had so far for a more gradual migration:
1. Is there a way to check an NXhandle that it is to an hdf5 file and then use a member of the NXhandle directly with the hdf5 api?
2. Can one open the same file with hdf5 and nexus and carry around both handles at the same time? This would probably require using “reopen” and being careful about access to make it work.
3. Any other ideas?
This may indeed by possible. But I would be cautious to complete operations either in direct H5 or NAPI in sequence
and not in any order. And make sure that you close all HDF5 handles you use in your direct H5 calls before continuing
with NAPI. That is one thing NAPI does for you: keeping track of and closing all the handles required by H5.
Now, the NXhandle you get from an NXopen() really points to a NexusFile structure as defined in napi_internal.h.
The first most member of this structure is another handle pointing to a NexusFile5 structure as defined at the top
of napi5.c. And this NexusFile5 structure contains the FID, the HDF5 file ID, you are looking for. You probably want
to modify your NAPI somewhat in order to make yourself a helper function which retrieves the FID for you.
Is that enough to get you going?
Best Regards,
Mark Koennecke
P^2
_______________________________________________
NeXus mailing list
NeXus at nexusformat.org<mailto:NeXus at nexusformat.org>
https://lists.nexusformat.org/mailman/listinfo/nexus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.nexusformat.org/pipermail/nexus/attachments/20230908/a731b8a2/attachment-0001.htm>
More information about the NeXus
mailing list