[Nexus] Migration from nexus API to hdf5 API

Peterson, Peter petersonpf at ornl.gov
Fri Sep 8 20:34:50 BST 2023


That was the sort of information I was hoping for. I'll probably have follow-up questions once I dig in properly.

From: NeXus <nexus-bounces at shadow.nd.rl.ac.uk> On Behalf Of Koennecke Mark via NeXus
Sent: Friday, September 8, 2023 3:13 AM
To: Discussion forum for the NeXus data format <nexus at shadow.nd.rl.ac.uk>
Cc: Koennecke Mark <mark.koennecke at psi.ch>
Subject: [EXTERNAL] Re: [Nexus] Migration from nexus API to hdf5 API

Peter,



Am 07.09.2023 um 21:53 schrieb Peterson, Peter via NeXus <nexus at shadow.nd.rl.ac.uk<mailto: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<https://urldefense.us/v2/url?u=https-3A__lists.nexusformat.org_mailman_listinfo_nexus&d=DwMGaQ&c=v4IIwRuZAmwupIjowmMWUmLasxPEgYsgNI-O7C4ViYc&r=ei3ul-fXT5Ohr6jy1MpF0q1f9i5NBrSMpid9V_N6yXU&m=twpVKH-M4DVPvoLQmSbfWUa6uZRZnDdwPKi7z0N_Cc-6zVSS49WrIyye2NX9gIya&s=WKgU5TOHN0-BMECv2CaZ-8f7WJdE86DxKI40YGnIDvk&e=>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.nexusformat.org/pipermail/nexus/attachments/20230908/a0ad46b1/attachment.htm>


More information about the NeXus mailing list