[Thread Prev][Thread Next][Index]

Re: HDF to netCDF



I needed to do this some time back and got the following perfect
suggestion from Paul Delst:

-------- Original Message --------
Subject: Re: hdf to netcdf
Date: Mon, 29 Jul 2002 09:59:13 -0400
From: Paul 
To: hengkek

hengkek wrote:
> 
> Hi Dr Van Delst
> 
> You recently said this on comp.lang.fortran:
> 
> > > formatting probably doesn't apply.
> >
> > ncdump outputs the CDL (Common Description Language) text representation of netCDF data
> > sets.
> >
> > OT but.... luckily, hdf file dumpers output in the same form so it's trivial (in unix at
> > least) to convert some hdf files to netCDF:
> >
> >   hdfdump blah.hdf | ncgen -b -o blah.nc
> 
> We have a need to do the above (convert hdf to netcdf).  Could you point
> me to where one can obtain 'hdfdump'?  I Googled but didn't come up with
> anything relevant.

Well, hdfdump is a bit of a misnomer on my part.

If you install the HDF libraries (v4..I haven't tried it with v5),
"ncdump" and "ncgen"
are included. These utilities, however, are not *the* ncdump and ncgen
that come with the
UCAR netCDF libraries - they are somewhat HDF specific. The HDF ncdump
(which I call
hdfdump) dumps HDF files (and netCDF files too) into ASCII CDL format,
just like the true
netCDF ncdump does to _only_ netCDF files. The HDF ncgen, however, does
not create netCDF
format files (at least running in default mode). So, to prevent me
getting mixed up I
renamed them hdfdump and hdfgen. Confusing, no? I blame the HDF folks.
:o)

To cut a long story short, to do what I did:

1) Install the HDF libraries and utilities
2) Rename the ncdump and ncgen from the HDF installation to hdfdump and
hdfgen
3) Install the UCAR netCDF libraries and utilities (including the "real"
ncdump and ncgen)
4) Make sure both hdfdump and ncgen are in your path
5) Type: hdfdump blah.hdf | ncgen -b -o blah.nc

Despite my monologue, I hope the above is somewhat helpful.

cheers,

paulv



D Shankar wrote:
-------- Original Message --------
Subject: HDF to netCDF
Date: Mon, 14 Oct 2002 16:37:24 +0530
From: D Shankar <shankar@darya.nio.org>
Reply-To: shankar@darya.nio.org
Organization: National Institute of Oceanography
To: Ferret users mailing list <ferret_users@ferret.wrc.noaa.gov>
> 
> Hello,
> 
> I have some data in HDF and want to view them in Ferret.  For some reason,
> these HDF files are not recognized by our (local) DODS server, though it has
> no problem with most other HDF files.  There may be something different about
> the way these files were created, but I have too little experience with HDF
> to guess what the problem could be.
> 
> I'd like to convert these data to netCDF for use with Ferret.  Is there some
> utility to do this?
> 
> With regards,
> Shankar.
> 
> --
> D. Shankar
> Physical Oceanography Division,
> National Institute of Oceanography,
> Dona Paula, Goa 403 004, India.
> Ph.:        +91-832-456700 * 4312 (off)
>              +91-832-453632 (res)
> FAX:      +91-832-456702/3
> e-mail: shankar@darya.nio.org, shankar@csnio.ren.nic.in


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement