<div dir="ltr">Seems like the obvious solution is for netCDF to write some (additional) hidden attribute in the HDF5 file. Ward and Dennis must decide on that approach.<div><br></div><div>As for existing data, you should look for the use of some hidden attributes that netCDF-4 writes in the file. While it is possible to produce a netcdf file without dimensions, it is not usual. And if netCDF was used to create dimensions in the HDF5 file, then there will be some attributes written in the file which will be hidden from the netCDF API, but will be visible to the HDF5 layer.</div><div><br></div><div>Ed</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 21, 2016 at 1:44 PM, Miller, Mark C. <span dir="ltr"><<a href="mailto:miller86@llnl.gov" target="_blank">miller86@llnl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<div>I'll admit to not having time to read this whole email in detail. But, I've read enough and wanted to make just a few remarks.</div>
<div><br>
</div>
<ol>
<li>Silo *does* know whether a given HDF5 file was produced by Silo. It does so by storing some key datasets in the HDF5 file that are, in all likelihood, unique to Silo. That isn't to say that some other workflow somewhere in the world might generate similarly
named, shaped and typed datasets with similar contents. But, its unlikely enough situation that I claim Silo knows with certainty when it is given an HDF5 file whether the file was indeed produced with Silo.</li><li>IMHO, this issue is totally analgous to global symbol name space in C applications. Every now and then, you encounter situations in linking together upty-umpt C libraries that two libraries export the same public symbol and the link fails. The best practice
is to avoid using *common* symbol names like 'temp', 'lib', 'status', etc in the public symbol space. For example, we all prepend some 3 or 4 letter moniker to library function names (e.g. MPI_). It works, obviously when everyone in the community observes
the best practice. Why can't the same approach be taken for HDF5 files? The HDF Group could advocate for and we, the community, coud adopt the best practice of associating say a string valued attribute with the root group in the file. The attributes name could
be shared or it could be unique. Unique maybe a bit better but not required. What is required is the same best practice that the contents of that attribute be designed to be unique to the upper level API that is using it.</li><li>I am not sure I appreciate nor agree with attempting to distinguish the difference others are trying to make between "Upper Level API" and a "pure HDF5 compatable format". Any thing written with HDF5 can be read with HDF5 (without the upper level API).
Of course, there may be conventions that the upper level API utilizes that the HDF5 API itself may be ignorant of. So what? We do this quite frequently with Silo and Python. Silo writes HDF5 files and some users write Python scripts to read it. Those users
understand the conventional ways in which Silo is using HDF5 and those conventions become codified in the Python they write to read HDF5 directly (e.g. without Silo). Its sometimes a pain because Silo does actually try very hard to obscure the details of how
its using HDF5. But, it is nonetheless possible and so I see this distinction as rather moot.</li><li>I think (not really sure) HDF5 may have some low level features to insert a magick byte sequence into the boot block or other parts of the file header *and* such data can be queried back into the application. If so, that solution might even be better as
it avoids stuffing anything into the file's "HDF5 Object Global Namespace"</li><li>We still have a bazillion legacy files out there. Can't fix those and so still need some hueristics to facilitate workflows using them.</li></ol>
<div><br>
</div>
<div>Mark</div>
<div><br>
</div>
<div><br>
</div>
<span>
<div style="font-family:Calibri;font-size:11pt;text-align:left;color:black;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt">
<span style="font-weight:bold">From: </span>Pedro Vicente <<a href="mailto:pedro.vicente@space-research.org" target="_blank">pedro.vicente@space-research.org</a>><br>
<span style="font-weight:bold">Date: </span>Thursday, April 21, 2016 8:33 AM<br>
<span style="font-weight:bold">To: </span>HDF Users Discussion List <<a href="mailto:hdf-forum@lists.hdfgroup.org" target="_blank">hdf-forum@lists.hdfgroup.org</a>>, "<a href="mailto:cf-metadata@cgd.ucar.edu" target="_blank">cf-metadata@cgd.ucar.edu</a>" <<a href="mailto:cf-metadata@cgd.ucar.edu" target="_blank">cf-metadata@cgd.ucar.edu</a>>,
Discussion forum for the NeXus data format <<a href="mailto:nexus@nexusformat.org" target="_blank">nexus@nexusformat.org</a>>, "<a href="mailto:netcdfgroup@unidata.ucar.edu" target="_blank">netcdfgroup@unidata.ucar.edu</a>" <<a href="mailto:netcdfgroup@unidata.ucar.edu" target="_blank">netcdfgroup@unidata.ucar.edu</a>><br>
<span style="font-weight:bold">Cc: </span>"Miller, Mark C." <<a href="mailto:miller86@llnl.gov" target="_blank">miller86@llnl.gov</a>>, "Marinelli, Daniel J. (GSFC-5810)" <<a href="mailto:daniel.j.marinelli@nasa.gov" target="_blank">daniel.j.marinelli@nasa.gov</a>>, "<a href="mailto:Richard.E.Ullman@nasa.gov" target="_blank">Richard.E.Ullman@nasa.gov</a>"
<<a href="mailto:Richard.E.Ullman@nasa.gov" target="_blank">Richard.E.Ullman@nasa.gov</a>>, "<a href="mailto:Christopher.S.Lynnes@nasa.gov" target="_blank">Christopher.S.Lynnes@nasa.gov</a>" <<a href="mailto:Christopher.S.Lynnes@nasa.gov" target="_blank">Christopher.S.Lynnes@nasa.gov</a>>, Kent Yang <<a href="mailto:myang6@hdfgroup.org" target="_blank">myang6@hdfgroup.org</a>>,
John Shalf <<a href="mailto:jshalf@lbl.gov" target="_blank">jshalf@lbl.gov</a>>, "<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>" <<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>>, Ward Fisher <<a href="mailto:wfisher@ucar.edu" target="_blank">wfisher@ucar.edu</a>>, Ed Hartnett <<a href="mailto:edwardjameshartnett@gmail.com" target="_blank">edwardjameshartnett@gmail.com</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [Hdf-forum] Detecting netCDF versus HDF5 -- PROPOSED SOLUTIONS --REQUEST FOR COMMENTS
<br>
</div><div><div class="h5">
<div><br>
</div>
<blockquote style="BORDER-LEFT:#b5c4df 5 solid;PADDING:0 0 0 5;MARGIN:0 0 0 5">
<div>
<div style="WORD-WRAP:break-word;FONT-SIZE:14px;FONT-FAMILY:Calibri,sans-serif;COLOR:rgb(0,0,0)" bgcolor="#ffffff">
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">DETECTING HDF5 VERSUS NETCDF GENERATED FILES<br>
REQUEST FOR COMMENTS </font></div>
<div> </div>
<div><font size="2" face="Arial">AUTHOR: Pedro Vicente</font></div>
<div> </div>
<font size="2" face="Arial">
<div><br>
AUDIENCE: <br>
1) HDF, netcdf developers, </div>
<div> </div>
<div>Ed Hartnett <br>
Kent Yang</div>
<div> </div>
<div>2) HDF, netcdf users, that replied to this thread</div>
<div> </div>
<div>Miller, Mark C. </div>
<div>John Shalf </div>
<div> </div>
<div>3 ) netcdf tools developers</div>
<div> </div>
<div>Mary Haley , NCL</div>
<div> </div>
<div>4) HDF, netcdf managers and sponsors</div>
<div> </div>
<div>David Pearah , CEO HDF Group<br>
Ward Fisher, UCAR<br>
Marinelli, Daniel J. , Richard Ullmman, Christopher Lynnes, NASA</div>
<div> </div>
<div> </div>
<div>5)<br>
[CF-metadata] list</div>
<div> </div>
<div>After this thread started 2 months ago, there was an annoucement on the [CF-metadata] mail list<br>
about<br>
"a meeting to discuss current and future netCDF-CF efforts and directions. <br>
The meeting will be held on 24-26 May 2016 in Boulder, CO, USA at the UCAR Center Green facility."</div>
<div> </div>
<div>This would be a good topic to put on the agenda, maybe?</div>
<div> </div>
<div> </div>
<div>THE PROBLEM:</div>
<div> </div>
<div>Currently it is impossible to detect if an HDF5 file was generated by the HDF5 API or by the netCDF API.</div>
<div>See previous email about the reasons why.</div>
<div> </div>
<div>WHY THIS MATTERS:</div>
<div> </div>
<div>Software applications that need to handle both netCDF and HDF5 files cannot decide which API to use.<br>
This includes popular visualization tools like IDL, Matlab, NCL, HDF Explorer.</div>
<div> </div>
<div>SOLUTIONS PROPOSED: 2</div>
<div> </div>
<div>SOLUTION 1: Add a flag to HDF5 source </div>
<div> </div>
<div>The hdf5 format specification, listed here</div>
<div> </div>
<div><a href="https://secure-web.cisco.com/10WllRNMv7Cf_PosL959Mbsygr6CpMM45KnvTONP6jx97fWvsvC10H9DS106gC-6O9BkN9sohf_QOYGlODmXFI1KQLkliXk0cZNwrY0tFjrXcIk2Zohje7KImMGcFyupYxpzbMgrELQuc9DVsvYOcCS6QIYztbPNCl4IFf0eGSsX7-OIgT2ptpe3Inuxm13VC3Ydw86ELUiQDJMVxvPE4wk6m6b2mwEWyA7F9PWEnmqzB6ZihhKbqzBn9GwC7VRnFDLFCFlcMQrqAaFHVa9uylHoWHm-KHv58o05PcuuXc2xWhZPLdz6K4UMwRVU9Q2-vzrO7Wb6uMzogIuXY3CPnQFkcmmBtAIKyRGpm-yLCN3M/https%3A%2F%2Fwww.hdfgroup.org%2FHDF5%2Fdoc%2FH5.format.html" target="_blank">https://www.hdfgroup.org/HDF5/doc/H5.format.html</a></div>
<div> </div>
<div>describes a sequence of bytes in the file layout that have special meaning for the HDF5 API. It is common practice, when designing a data format,
<br>
so leave some fields "reserved for future use".</div>
<div> </div>
<div>This solution makes use of one of these empty "reserved for future use" spaces to save a byte (for example) that describes an enumerator<br>
of "HDF5 compatible formats".</div>
<div> </div>
<div>An "HDF5 compatible format" is a data format that uses the HDF5 API at a lower level (usually hidden from the user of the upper API),<br>
and providing its own API.</div>
<div> </div>
<div>This category can still be divide in 2 formats:<br>
1) A "pure HDF5 compatible format". Example, NeXus</div>
<div> </div>
<div><a href="http://www.nexusformat.org/" target="_blank">http://www.nexusformat.org/</a></div>
<div> </div>
<div>NeXus just writes some metadata (attributes) on top of the HDF5 API, that has some special meaning for the NeXus community</div>
<div> </div>
<div>2) A "non pure HDF5 compatible format". Example, netCDF</div>
<div> </div>
<div>Here, the format adds some extra feature besides HDF5. In the case of netCDF, these are shared dimensions between variables.</div>
<div> </div>
<div>This sub-division between 1) and 2) is irrelevant for the problem and solution in question</div>
<div> </div>
<div>The solution consists of writing a different enumerator value on the "reserved for future use" space. For example</div>
<div> </div>
<div>Value decimal 0 (current value): This file was generated by the HDF5 API (meaning the HDF5 only API)<br>
Value decimal 1: This file was generated by the netCDF API (using HDF5) <br>
Value decimal 2: This file was generated by <put here another HDF5 based format><br>
and so on</div>
<div> </div>
<div>The advantage of this solution is that this process involves 2 parties: the HDF Group and the other format's organization.</div>
<div> </div>
<div>This allows the HDF Group to "keep track" of new HDF5 based formats. It allows to make the other format "HDF5 certified" .</div>
<div> </div>
<div> </div>
<div>SOLUTION 2: Add some metadata to the other API on top of HDF5</div>
<div> </div>
<div>This is what Nexus uses. <br>
A Nexus file on creation writes several attributes on the root group, like "NeXus_version" and other numeric data.
<br>
This is done using the public HDF5 API calls.</div>
<div> </div>
<div>The solution for netCDF consists of the same approach, just write some specific attributes, and a special netCDF API to write/read them.</div>
<div> </div>
<div>This solutions just requires the work of one party (the netCDF group)</div>
<div> </div>
<div>END OF RFC</div>
<div> </div>
<div> </div>
<div> </div>
<div>In reply to people that commented in the thread</div>
<div> </div>
<div>@John Shalf </div>
<div> </div>
<div>>>Perhaps NetCDF (and other higher-level APIs that are built on top of HDF5) should include an attribute attached
<br>
>>to the root group that identifies the name and version of the API that created the file? (adopt this as a convention)</div>
<div> </div>
<div>yes, that's one way to do it, Solution 2 above</div>
<div> </div>
<div>@Mark Miller</div>
<div> </div>
<div>>>>Hmmm. Is there any big reason NOT to try to read a netCDF produced HDF5 file with the native HDF5 library if someone so chooses?</div>
<div> </div>
<div>It's possible to read a netCDF file using HDF5, yes. <br>
There are 2 things that you will miss doing this:<br>
</div>
<div>1) the ability to inquire about shared netCDF dimensions. <br>
2) the ability to read remotely with openDAP. <br>
Reading with HDF5 also exposes metadata that is supposed to be private to netCDF. See below</div>
<div> </div>
<div>>>>> And, attempting to read an HDF5 file produced by Silo using just the HDF5 library (e.g. w/o Silo) is a major pain.</div>
<div> </div>
<div>This I don't understand. Why not read the Silo file with the Silo API?</div>
<div> </div>
<div>That's the all purpose of this issue, each higher level API on top of HDF5 should be able to detect "itself".<br>
I am not familiar with Silo, but if Silo cannot do this, then you have the same design flaw that netCDF has.</div>
<div> </div>
<div><br>
>>> In a cursory look over the libsrc4 sources in netCDF distro, I see a few things that might give a hint a file was created with netCDF. . .<br>
>>>> First, in NC_CLASSIC_MODEL, an attribute gets attached to the root group named "_nc3_strict". So, the existence of an attribute on the root group by that name would suggest the HDF5 file was generated by netCDF.</div>
<div> </div>
<div>I think this is done only by the "old" netCDF3 format. </div>
<div> </div>
<div>>>>>> Also, I tested a simple case of nc_open, nc_def_dim, etc. nc_close to see what it produced.<br>
>>>> It appears to produce datasets for each 'dimension' defined with two attributes named "CLASS" and "NAME".
</div>
<div> </div>
<div>This is because netCDF uses the HDF5 Dimension Scales API internally to keep track of shared dimensions. These are internal attributes
<br>
of Dimension Scales. This approach would not work because an HDF5 only file with Dimension Scales would have the same attributes.</div>
<div> </div>
<div><br>
>>>> I like John's suggestion here.<br>
>>>>>But, any code you add to any applications now will work *only* for files that were produced post-adoption of this convention.</div>
<div> </div>
<div>yes. there are 2 actions to take here. <br>
1) fix the issue for the future<br>
2) try to retroactively have some workaround that makes possible now to differentiate a HDF5/netCDF files made before the adopted convention<br>
see below </div>
<div> </div>
<div><br>
>>>> In VisIt, we support >140 format readers. Over 20 of those are different variants of HDF5 files (H5part, Xdmf, Pixie, Silo, Samrai, netCDF, Flash, Enzo, Chombo, etc., etc.)
<br>
>>>>When opening a file, how does VisIt figure out which plugin to use? In particular, how do we avoid one poorly written reader plugin (which may be the wrong one for a given file) from preventing the correct one from being found. Its kinda a hard problem.</div>
<div> </div>
<div><br>
Yes, that's the problem we are trying to solve. I have to say, that is quick a list of HDF5 based formats there.
</div>
<div> </div>
<div>>>>> Some of our discussion is captured here. . .<br>
<a href="http://www.visitusers.org/index.php?title=Database_Format_Detection" target="_blank">http://www.visitusers.org/index.php?title=Database_Format_Detection</a></div>
<div> </div>
<div>I"ll check it out, thank you for the suggestions</div>
<div> </div>
<div>@Ed Hartnett </div>
<div> </div>
<div> </div>
<div>>>>I must admit that when putting netCDF-4 together I never considered that someone might want to tell the difference between a "native" HDF5 file and a netCDF-4/HDF5 file.
</div>
<div>>>>>>Well, you can't think of everything.</div>
<div> </div>
<div>This is a major design flaw.<br>
If you are in the business of designing data file formats, one of the things you have to do is how to make it possible to identify it from the other formats.</div>
<div> </div>
<div><br>
>>> I agree that it is not possible to canonically tell the difference. The netCDF-4 API does use some special attributes to track named dimensions,
<br>
>>>>and to tell whether classic mode should be enforced. But it can easily produce files without any named dimensions, etc.
<br>
>>>So I don't think there is any easy way to tell.</div>
<div> </div>
<div>I remember you wrote that code together with Kent Yang from the HDF Group. <br>
At the time I was with the HDF Group but unfortunately I did follow closely what you were doing.<br>
I don't remember any design document being circulated that explains the internals of the "how to" make the netCDF (classic) model of shared dimensions<br>
use the hierarchical group model of HDF5.<br>
I know this was done using the HDF5 Dimension Scales (that I wrote), but is there any design document that explains it?</div>
<div> </div>
<div>Maybe just some internal email exchange between you and Kent Yang?<br>
Kent, how are you? <br>
Do you remember having any design document that explains this?<br>
Maybe something like a unique private attribute that is written somewhere in the netCDF file?</div>
<div> </div>
<div><br>
@Mary Haley, NCL</div>
<div> </div>
<div>NCL is a widely used tool that handles both netCDF and HDF5</div>
<div> </div>
<div>Mary, how are you?<br>
How does NCL deal with the case of reading both pure HDF5 files and netCDF files that use HDF5?<br>
Would you be interested in joining a community based effort to deal with this, in case this is an issue for you?</div>
<div> </div>
<div><br>
@David Pearah , CEO HDF Group</div>
<div> </div>
<div>I volunteer to participate in the effort of this RFC together with the HDF Group (and netCDF Group).
</div>
<div>Maybe we could make a "task force" between HDF Group, netCDF Group and any volunteer (such as tools developers that happen to be in these mail lists)?</div>
<div> </div>
<div>The "task force" would have 2 tasks: </div>
<div>1) make a HDF5 based convention for the future and </div>
<div>2) try to retroactively salvage the current design issue of netCDF<br>
My phone is <a href="tel:217-898-9356" value="+12178989356" target="_blank">217-898-9356</a>, you are welcome to call in anytime.</div>
<div> </div>
</font>
<div><font size="2" face="Arial"></font><font size="2" face="Arial">----------------------<br>
Pedro Vicente<br>
<a href="mailto:pedro.vicente@space-research.org" target="_blank">pedro.vicente@space-research.org</a><br>
<a href="https://twitter.com/_pedro__vicente" target="_blank">https://twitter.com/_pedro__vicente</a><br>
<a href="http://www.space-research.org/" target="_blank">http://www.space-research.org/</a></font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial"></font> </div>
<blockquote style="PADDING-LEFT:5px;MARGIN-LEFT:5px;BORDER-LEFT:#000000 2px solid;PADDING-RIGHT:0px;MARGIN-RIGHT:0px">
<div style="FONT:10pt arial">----- Original Message ----- </div>
<div style="BACKGROUND:#e4e4e4;FONT:10pt arial"><b>From:</b><a title="miller86@llnl.gov" href="mailto:miller86@llnl.gov" target="_blank">Miller, Mark C.</a>
</div>
<div style="FONT:10pt arial"><b>To:</b> <a title="hdf-forum@lists.hdfgroup.org" href="mailto:hdf-forum@lists.hdfgroup.org" target="_blank">
HDF Users Discussion List</a> </div>
<div style="FONT:10pt arial"><b>Cc:</b> <a title="netcdfgroup@unidata.ucar.edu" href="mailto:netcdfgroup@unidata.ucar.edu" target="_blank">
netcdfgroup@unidata.ucar.edu</a> ; <a title="wfisher@ucar.edu" href="mailto:wfisher@ucar.edu" target="_blank">
Ward Fisher</a> </div>
<div style="FONT:10pt arial"><b>Sent:</b> Wednesday, March 02, 2016 7:07 PM</div>
<div style="FONT:10pt arial"><b>Subject:</b> Re: [Hdf-forum] Detecting netCDF versus HDF5</div>
<div><br>
</div>
<div>I like John's suggestion here.</div>
<div><br>
</div>
<div>But, any code you add to any applications now will work *only* for files that were produced post-adoption of this convention.</div>
<div><br>
</div>
<div>There are probably a bazillion files out there at this point that don't follow that convention and you probably still want your applications to be able to read them.</div>
<div><br>
</div>
<div>In VisIt, we support >140 format readers. Over 20 of those are different variants of HDF5 files (H5part, Xdmf, Pixie, Silo, Samrai, netCDF, Flash, Enzo, Chombo, etc., etc.) When opening a file, how does VisIt figure out which plugin to use? In particular,
how do we avoid one poorly written reader plugin (which may be the wrong one for a given file) from preventing the correct one from being found. Its kinda a hard problem.</div>
<div><br>
</div>
<div>Some of our discussion is captured here. . .</div>
<div><br>
</div>
<div><a href="http://www.visitusers.org/index.php?title=Database_Format_Detection" target="_blank">http://www.visitusers.org/index.php?title=Database_Format_Detection</a></div>
<div><br>
</div>
<div>Mark</div>
<div><br>
</div>
<div><br>
</div>
<span>
<div style="FONT-SIZE:11pt;BORDER-TOP:#b5c4df 1pt solid;FONT-FAMILY:Calibri;BORDER-RIGHT:medium none;BORDER-BOTTOM:medium none;COLOR:black;PADDING-BOTTOM:0in;TEXT-ALIGN:left;PADDING-TOP:3pt;PADDING-LEFT:0in;BORDER-LEFT:medium none;PADDING-RIGHT:0in">
<span style="FONT-WEIGHT:bold">From: </span>Hdf-forum <<a href="mailto:hdf-forum-bounces@lists.hdfgroup.org" target="_blank">hdf-forum-bounces@lists.hdfgroup.org</a>> on behalf of John Shalf <<a href="mailto:jshalf@lbl.gov" target="_blank">jshalf@lbl.gov</a>><br>
<span style="FONT-WEIGHT:bold">Reply-To: </span>HDF Users Discussion List <<a href="mailto:hdf-forum@lists.hdfgroup.org" target="_blank">hdf-forum@lists.hdfgroup.org</a>><br>
<span style="FONT-WEIGHT:bold">Date: </span>Wednesday, March 2, 2016 1:02 PM<br>
<span style="FONT-WEIGHT:bold">To: </span>HDF Users Discussion List <<a href="mailto:hdf-forum@lists.hdfgroup.org" target="_blank">hdf-forum@lists.hdfgroup.org</a>><br>
<span style="FONT-WEIGHT:bold">Cc: </span>"<a href="mailto:netcdfgroup@unidata.ucar.edu" target="_blank">netcdfgroup@unidata.ucar.edu</a>" <<a href="mailto:netcdfgroup@unidata.ucar.edu" target="_blank">netcdfgroup@unidata.ucar.edu</a>>, Ward Fisher <<a href="mailto:wfisher@ucar.edu" target="_blank">wfisher@ucar.edu</a>><br>
<span style="FONT-WEIGHT:bold">Subject: </span>Re: [Hdf-forum] Detecting netCDF versus HDF5<br>
</div>
<div><br>
</div>
<blockquote style="PADDING-BOTTOM:0px;PADDING-TOP:0px;PADDING-LEFT:5px;MARGIN:0px 0px 0px 5px;BORDER-LEFT:#b5c4df 5px solid;PADDING-RIGHT:0px">
<div>
<div>
<div>Perhaps NetCDF (and other higher-level APIs that are built on top of HDF5) should include an attribute attached to the root group that identifies the name and version of the API that created the file? (adopt this as a convention)</div>
<div><br>
</div>
<div>-john</div>
<div><br>
</div>
<blockquote style="PADDING-BOTTOM:0px;PADDING-TOP:0px;PADDING-LEFT:5px;MARGIN:0px 0px 0px 5px;BORDER-LEFT:#b5c4df 5px solid;PADDING-RIGHT:0px">
<div>On Mar 2, 2016, at 12:55 PM, Pedro Vicente <<a href="mailto:pedro.vicente@space-research.org" target="_blank">pedro.vicente@space-research.org</a>> wrote:</div>
<div></div>
<div></div>
<div>Hi Ward</div>
<div></div>
<div>As you know, Data Explorer is going to be a general purpose data reader for many formats, including HDF5 and netCDF.</div>
<div></div>
<div>Here</div>
<div></div>
<div><a href="http://www.space-research.org/" target="_blank">http://www.space-research.org/</a></div>
<div></div>
<div></div>
<div>Regarding the handling of both HDF5 and netCDF, it seems there is a potential issue, which is, how to tell if any HDF5 file was saved by the HDF5 API or by the netCDF API?</div>
<div></div>
<div>It seems to me that this is not possible. Is this correct?</div>
<div></div>
<div>netCDF uses an internal function NC_check_file_type to examine the first few bytes of a file, and for example for any HDF5 file the test is</div>
<div></div>
<div>/* Look at the magic number */</div>
<div> /* Ignore the first byte for HDF */</div>
<div> if(magic[1] == 'H' && magic[2] == 'D' && magic[3] == 'F') {</div>
<div> *filetype = FT_HDF;</div>
<div> *version = 5;</div>
<div></div>
<div>The problem is that this test works for any HDF5 file and for any netCDF file, which makes it impossible to tell which is which.</div>
<div></div>
<div>Which makes it impossible for any general purpose data reader to decide to use the netCDF API or the HDF5 API.</div>
<div></div>
<div>I have a possible solution for this , but before going any further, I would just like to confirm that</div>
<div></div>
<div>1) Is indeed not possible</div>
<div></div>
<div>2) See if you have a solid workaround for this, excluding the dumb ones, for example deciding on a extension .nc or .h5, or traversing the HDF5 file to see if it's non netCDF conforming one. Yes, to further complicate things, it is possible that the
above test says OK for a HDF5 file, but then the read by the netCDF API fails because the file is a HDF5 non netCDF conformant</div>
<div></div>
<div>Thanks</div>
<div></div>
<div>----------------------</div>
<div>Pedro Vicente</div>
<div><a href="mailto:pedro.vicente@space-research.org" target="_blank">pedro.vicente@space-research.org</a></div>
<div><a href="http://www.space-research.org/" target="_blank">http://www.space-research.org/</a> </div>
<div></div>
<div>_______________________________________________</div>
<div>Hdf-forum is for HDF software users discussion.</div>
<div><a href="mailto:Hdf-forum@lists.hdfgroup.org" target="_blank">Hdf-forum@lists.hdfgroup.org</a></div>
<div><a href="http://secure-web.cisco.com/1r-EJFFfg6rWlpQsvXstBNTjaHQaKT_NkYRN0Jj_f-Z3EK0-hs6IbYc8XUBRyPsH3mU3CS0iiY7_qnchCA0QxNzQt270d_2HikCwpAWFmuHdacin62eaODutktDSOULIJmVbVYqFVSKWPzoX7kdP0yN9wIzSFxZfTwfhU8ebsN409xRg1PsW_8cvNiWzxDNm9wv9yBf9yK6nkEm-bOx2S0kBLbg9WfIChWzZrkpE3AHU9I-c2ZRH_IN-UF4g_g0_Dh4qE1VETs7tZTfKd1ox1MtBmeyKf7EKUCd3ezR9EbI5tK4hCU5qW4v5WWOxOrD17e8yCVmob27xz84Lr3bCK5wIQdH5VzFRTtyaAhudpt9E/http%3A%2F%2Flists.hdfgroup.org%2Fmailman%2Flistinfo%2Fhdf-forum_lists.hdfgroup.org" target="_blank">http://secure-web.cisco.com/1r-EJFFfg6rWlpQsvXstBNTjaHQaKT_NkYRN0Jj_f-Z3EK0-hs6IbYc8XUBRyPsH3mU3CS0iiY7_qnchCA0QxNzQt270d_2HikCwpAWFmuHdacin62eaODutktDSOULIJmVbVYqFVSKWPzoX7kdP0yN9wIzSFxZfTwfhU8ebsN409xRg1PsW_8cvNiWzxDNm9wv9yBf9yK6nkEm-bOx2S0kBLbg9WfIChWzZrkpE3AHU9I-c2ZRH_IN-UF4g_g0_Dh4qE1VETs7tZTfKd1ox1MtBmeyKf7EKUCd3ezR9EbI5tK4hCU5qW4v5WWOxOrD17e8yCVmob27xz84Lr3bCK5wIQdH5VzFRTtyaAhudpt9E/http%3A%2F%2Flists.hdfgroup.org%2Fmailman%2Flistinfo%2Fhdf-forum_lists.hdfgroup.org</a></div>
<div>Twitter: <a href="https://twitter.com/hdf5" target="_blank">https://twitter.com/hdf5</a></div>
</blockquote>
<div><br>
</div>
<div><br>
</div>
<div>_______________________________________________</div>
<div>Hdf-forum is for HDF software users discussion.</div>
<div><a href="mailto:Hdf-forum@lists.hdfgroup.org" target="_blank">Hdf-forum@lists.hdfgroup.org</a></div>
<div><a href="http://secure-web.cisco.com/1r-EJFFfg6rWlpQsvXstBNTjaHQaKT_NkYRN0Jj_f-Z3EK0-hs6IbYc8XUBRyPsH3mU3CS0iiY7_qnchCA0QxNzQt270d_2HikCwpAWFmuHdacin62eaODutktDSOULIJmVbVYqFVSKWPzoX7kdP0yN9wIzSFxZfTwfhU8ebsN409xRg1PsW_8cvNiWzxDNm9wv9yBf9yK6nkEm-bOx2S0kBLbg9WfIChWzZrkpE3AHU9I-c2ZRH_IN-UF4g_g0_Dh4qE1VETs7tZTfKd1ox1MtBmeyKf7EKUCd3ezR9EbI5tK4hCU5qW4v5WWOxOrD17e8yCVmob27xz84Lr3bCK5wIQdH5VzFRTtyaAhudpt9E/http%3A%2F%2Flists.hdfgroup.org%2Fmailman%2Flistinfo%2Fhdf-forum_lists.hdfgroup.org" target="_blank">http://secure-web.cisco.com/1r-EJFFfg6rWlpQsvXstBNTjaHQaKT_NkYRN0Jj_f-Z3EK0-hs6IbYc8XUBRyPsH3mU3CS0iiY7_qnchCA0QxNzQt270d_2HikCwpAWFmuHdacin62eaODutktDSOULIJmVbVYqFVSKWPzoX7kdP0yN9wIzSFxZfTwfhU8ebsN409xRg1PsW_8cvNiWzxDNm9wv9yBf9yK6nkEm-bOx2S0kBLbg9WfIChWzZrkpE3AHU9I-c2ZRH_IN-UF4g_g0_Dh4qE1VETs7tZTfKd1ox1MtBmeyKf7EKUCd3ezR9EbI5tK4hCU5qW4v5WWOxOrD17e8yCVmob27xz84Lr3bCK5wIQdH5VzFRTtyaAhudpt9E/http%3A%2F%2Flists.hdfgroup.org%2Fmailman%2Flistinfo%2Fhdf-forum_lists.hdfgroup.org</a></div>
<div>Twitter: <a href="https://twitter.com/hdf5" target="_blank">https://twitter.com/hdf5</a></div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
</blockquote>
</span>
<p></p>
<hr>
<p></p>
_______________________________________________<br>
Hdf-forum is for HDF software users discussion.<br>
<a href="mailto:Hdf-forum@lists.hdfgroup.org" target="_blank">Hdf-forum@lists.hdfgroup.org</a><br>
<a href="http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org" target="_blank">http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org</a><br>
Twitter: <a href="https://twitter.com/hdf5" target="_blank">https://twitter.com/hdf5</a></blockquote>
</div>
</div>
</blockquote>
</div></div></span>
</div>
</blockquote></div><br></div>