;+
; hdf2fts3.pro
;
; Convert an HDF file [dfsd]  to FITS format.
;
; hdf2fts, 'pb.hdf'
;
; Andrew L. Stanger   HAO/NCAR   1 Oct 2004
;-
PRO hdf2fts3, hdf_file

dotpos = STRPOS (hdf_file, '.hdf')
;basename = hdf_file [0:dotpos-1]
basename = STRMID (hdf_file, 0, dotpos)

hdf_dfsd_getinfo, hdf_file, dims=dims

hdf_dfsd_dimget, 0, scale=radius
hdf_dfsd_dimget, 1, scale=azimuth

hdf_dfsd_getdata, hdf_file, img

fits_file    = basename + '.fts'
radius_file  = basename + '.r.fts'
azimuth_file = basename + '.a.fts'

print, 'fits_file:    ', fits_file
print, 'radius_file:  ', radius_file
print, 'azimuth_file: ', azimuth_file

writefits, fits_file, img
writefits, radius_file, radius
writefits, azimuth_file, azimuth

END