<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:379062538;
mso-list-template-ids:-504730266;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">That was the sort of information I was hoping for. I’ll probably have follow-up questions once I dig in properly.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> NeXus <nexus-bounces@shadow.nd.rl.ac.uk> <b>On Behalf Of
</b>Koennecke Mark via NeXus<br>
<b>Sent:</b> Friday, September 8, 2023 3:13 AM<br>
<b>To:</b> Discussion forum for the NeXus data format <nexus@shadow.nd.rl.ac.uk><br>
<b>Cc:</b> Koennecke Mark <mark.koennecke@psi.ch><br>
<b>Subject:</b> [EXTERNAL] Re: [Nexus] Migration from nexus API to hdf5 API<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Peter, <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">Am 07.09.2023 um 21:53 schrieb Peterson, Peter via NeXus <<a href="mailto:nexus@shadow.nd.rl.ac.uk">nexus@shadow.nd.rl.ac.uk</a>>:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">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:<o:p></o:p></p>
</div>
<ol style="margin-top:0in" start="1" type="1">
<li class="MsoListParagraph" style="margin-top:0in;margin-bottom:0in;mso-list:l0 level1 lfo1">
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?<o:p></o:p></li><li class="MsoListParagraph" style="margin-top:0in;margin-bottom:0in;mso-list:l0 level1 lfo1">
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.<o:p></o:p></li><li class="MsoListParagraph" style="margin-top:0in;margin-bottom:0in;mso-list:l0 level1 lfo1">
Any other ideas?<o:p></o:p></li></ol>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">This may indeed by possible. But I would be cautious to complete operations either in direct H5 or NAPI in sequence <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">and not in any order. And make sure that you close all HDF5 handles you use in your direct H5 calls before continuing <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">with NAPI. That is one thing NAPI does for you: keeping track of and closing all the handles required by H5. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Now, the NXhandle you get from an NXopen() really points to a NexusFile structure as defined in napi_internal.h.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">The first most member of this structure is another handle pointing to a NexusFile5 structure as defined at the top <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">of napi5.c. And this NexusFile5 structure contains the FID, the HDF5 file ID, you are looking for. You probably want <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">to modify your NAPI somewhat in order to make yourself a helper function which retrieves the FID for you. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Is that enough to get you going?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Best Regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"> Mark Koennecke<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal">P^2<o:p></o:p></p>
</div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif">_______________________________________________<br>
NeXus mailing list<br>
</span><a href="mailto:NeXus@nexusformat.org"><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif">NeXus@nexusformat.org</span></a><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif"><br>
</span><a href="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="><span style="font-size:10.5pt;font-family:"Helvetica",sans-serif">https://lists.nexusformat.org/mailman/listinfo/nexus</span></a><o:p></o:p></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>