Taylor,
More recent versions of netCDF-4 can access HDF5 data (and even HDF4
data) that was not written by netCDF-4, but not arbitrary HDF5 files.
Interoperability with HDF5 is documented here:
http://www.unidata.ucar.edu/netcdf/docs/interoperability_with_hdf5.html
and in these FAQs:
http://www.unidata.ucar.edu/netcdf/docs/faq.html#fv20
http://www.unidata.ucar.edu/netcdf/docs/faq.html#fv15
If netCDF-4 gets a segfault opening an HDF5 file, that's either a bug in
the legacy C++ library you're using or a bug in the accessing program.
I just tried this example C++ program with the C++ library in netCDF
version 4.1.3:
http://www.unidata.ucar.edu/netcdf/examples/programs/simple_xy_rd.cpp
changing the test file to a file that doesn't exist, and
it seemed to behave correctly:
$ ./simple_xy_rd
Couldn't open file!
What version of the netCDF C++ library are you using? Did you run "make
check" before installing it?
--Russ
> Hi Taylor:
>
> The netcdf library can not open arbitrary HDF files, only ones built with the
> netcdf4 library. If this file was not built with the netcdf4 library, then
> yes you will get an error.
>
> HTH,
>
> -Roy M.
> On Dec 17, 2012, at 8:14 AM, Taylor Binnington <tbinnington@xxxxxxxxx> wrote:
>
> > Hi all,
> >
> > This is my first time using the NetCDF C++ libraries, and I can't seem to g
> et started. I would like to open an HDF file from a program using NcFile, usi
> ng the following:
> >
> > NcFile dataFile("MERRA300.prod.assim.inst3_3d_asm_Cp.20120101.hdf", NcFile:
> :ReadOnly);
> >
> > However, gdb reveals a segfault at this line (yes, the file is stored in th
> e same directory as the test script). Interestingly, I also receive the same
> error when I intentionally attempt to open a file that does not exist, which
> I find strange (I would have expected a 'file not found' type of error), and
> it makes me think that I simply can not open an HDF file with these libraries
> . Is this true? How would I proceed? Thank you in advance,
> >
> > Taylor Binnington
> >
> > --
> > Taylor Binnington
> > e. tbinnington@xxxxxxxxx
> > c. 647 926 4144
> >
> > _______________________________________________
> > netcdfgroup mailing list
> > netcdfgroup@xxxxxxxxxxxxxxxx
> > For list information or to unsubscribe, visit: http://www.unidata.ucar.edu
> /mailing_lists/
>
> **********************
> "The contents of this message do not reflect any position of the U.S. Governm
> ent or NOAA."
> **********************
> Roy Mendelssohn
> Supervisory Operations Research Analyst
> NOAA/NMFS
> Environmental Research Division
> Southwest Fisheries Science Center
> 1352 Lighthouse Avenue
> Pacific Grove, CA 93950-2097
>
> e-mail: Roy.Mendelssohn@xxxxxxxx (Note new e-mail address)
> voice: (831)-648-9029
> fax: (831)-648-8440
> www: http://www.pfeg.noaa.gov/
>
> "Old age and treachery will overcome youth and skill."
> "From those who have been given much, much will be expected"
> "the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
>
> _______________________________________________
> netcdfgroup mailing list
> netcdfgroup@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/m
> ailing_lists/