[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: netCDF and HDF



Hi Lloyd,

> Hi Russ and Mike.  I've run into an interesting problem.  A researcher
> using Data Explorer has gotten a hold of data set that she wants to
> analyze.  She has been told that the data are in HDF but can't seem to use
> it.  So the problem has been passed on to me.  When I looked at the file,
> it appears to be an HDF containing a netCDF, at least from what I could
> tell.  As you may know Data Explorer supports direct utilization of data
> in netCDF and HDF SDS, among others.  However, DX does not recognize the
> file as being valid for either structure.  Certainly, the former is easily
> verified since ncdump does not recognize it.  This researcher had a
> version of ncdump that did work on the file.  As to the latter, I can get
> tools like hdfls or hdfed to access it, but the HDF browser in Mosaic
> chokes.  We are at the current releases of both netCDF and HDF software,
> but not any of the versions still being tested.

The HDF software includes a version of ncdump in the mfhdf directory that
reads HDF-encoded netCDF files.

> From what I recall about the discussion of the interface between netCDF and
> HDF is that one can:
> 1) use the netCDF interface to access HDF, presumably SDSs
> 2) use the HDF SDS interface to access data in netCDF
> Is this in fact the case?

Yes, that's my understanding also, although I don't know if the term "SDS"
is still used for HDF-encoded netCDF data, since this might cause some
confusion with the old SDS interface.

>                            If so, are "special" versions of the respective
> libraries required or are these capabilities now built into the standard
> versions of the libraries (i.e., the mfhdf library)?

The HDF3.3r3 version I am looking at includes the mfhdf library, which
should be all that is needed to support these capabilities.  I know there is
a 3.3r4 version, but I don't think it changes any of this.

>                                                       So, if we have to
> relink to a special library will this affect compatibility with other
> netCDFs or HDFs?

I assume Data Explorer only reads HDF and netCDF datasets, but never writes
them.  In that case, the mfhdf library from HDF provides the necessary
capabilities to read both XDR-encoded and HDF-encoded netCDF data.

>                   Are there naming conflicts involved because our code
> links to both the netCDF and HDF libraries?

Yes, there would be if you try to use both libraries.  But so long as you
just read the data, linking to only the mfhdf library won't involve any name
clashes.

>                                              If there are no compatibility
> issues then shouldn't this be the default?

If I understand your question correctly, yes I think if you want to read
both HDF-encoded and XDR-encoded netCDF files, then you should only link to
the HDF mfhdf library that supports importing both kinds of data with the
same interface.

> For the interim do you know of any utilities that can convert a data file
> like this to a "normal" SDS or netCDF so that it can be directly utilized by
> the version of DX that this researcher has?

No sorry.  Because of the name clash problem, I believe it would actually
take some effort to write a translator from HDF-encoded netCDF to
XDR-encoded netCDF, but going the other direction would be fairly trivial
since the mfhdf software reads either type of file but always writes
HDF-encoded files.

I hope Mike will correct me if I've made any misstatements.  You might also
want to send your questions to address@hidden (Shiming Xu).  I've
taken the liberty of CC:ng Shiming on this reply.

--Russ

______________________________________________________________________________

Russ Rew                                                UCAR Unidata Program
address@hidden                                          P.O. Box 3000
http://www.unidata.ucar.edu/                          Boulder, CO 80307-3000
______________________________________________________________________________