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

[netCDF #BQS-573507]: HDF to NetCDF conversion assistance




  Hi Tiffany,

> I am writing as I am a contractor for NASA at the Atmospheric
> Science Data Center (ASDC) where one of our key focus areas is
> converting HDF4 to NetCDF. In my research I stumbled on some of your
> work that was focused on developing these conversions. The most
> recent information/briefing that I was able to locate from you
> referencing this topic was from May of 2011 titled " Mid-Course
> Review: NetCDF in the Current Proposal Period." I am hoping to see
> if there has been any additional research completed in the past two
> years and if so I would greatly appreciate your guidance in locating
> it.
> 
> Thanks so much for your time!

Our intention with netCDF-4 and HDF4 was not to provide a tool
specifically for converting HDF4 files to netCDF-4 files, but rather
to support access to HDF4 data through netCDF-4 APIs.  Considerable
progress has been made in achieving this goal, most of it by the
Unidata THREDDS group in implementing their Unidata Common Data Model
software in Java, for netCDF-Java.

Specifically, it's possible to open and read metadata and data from an
HDF4 file using the CDM interfaces, as if reading netCDF data, so that
programs that read netCDF data can read HDF4 data without change.
This was achieved by implementing read access to HDF4 files in 100%
Java, and that code is available as part of the netCDF-Java software.
It reads more than 20 other formats through the CDM interfaces as
well.  This is implemented as on-the-fly conversion, so it's not
necessary to convert a large HDF4 file to netCDF just to read a small
amount of data from it.

You can use the netCDF-Java nccopy utility, implemented over the
netCDF-Java library, to convert an HDF4 file to a netCDF-3 or netCDF-4
file, as documented here:

  
http://www.unidata.ucar.edu/software/netcdf-java/reference/manPages.html#nccopy

The netCDF C library has an independent implementation for reading
HDF4 files that requires and uses the HDF4 library from THG.  To build
a C netCDF-4 library that uses the THG HDF4 library, you need to
configure it with --enable-hdf4 and follow these instructions:

  http://www.unidata.ucar.edu/netcdf/docs/build_hdf4.html

That allows you to open and read HDF4 data as if it were netCDF data,
with on-the-fly conversion similar to what netCDF-Java does, but not
as comprehensive in terms of providing extra attributes that make the
resulting data look as if it complies to the CF conventions.

There is also another nccopy utility, implemented independently in C
to call the netCDF C library, that can be used to convert an HDF4 file
to a netCDF file, but it has not been extensively tested, and may not
work well on some kinds of HDF4 data.  It's documented here:

  http://www.unidata.ucar.edu/netcdf/docs/nccopy-man-1.html

The NCL software from NCAR also can read HDF4 files and write netCDF,
so it may be useful in a conversion effort, but I don't know much more
about its capabilities in this area:

  http://www.unidata.ucar.edu/netcdf/docs/software.html#NCL

You might find something else useful by searching for "HDF4" in that
file.

Let us know if you have success with either of these approaches ...

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: BQS-573507
Department: Support netCDF
Priority: Normal
Status: Closed