function [data, stat] = read_hdf(filename)
%
%
% NAME: read_hdf
%===============================================================================
%
% USAGE: [data, stat] = read_hdf(filename)
%
% DESCRIPTION:
% reads hdf format
% applicable to amsr data sets
%
% INPUT:
% filename = amsr filename of hdf format
% see www.seaice.de
%
% OUTPUT: data = ssmi ice concentration (%)
% stat = hdf status
%
%
% AUTHOR:
% Michael P. Schodlok, December 2003, Alfred Wegener Institute
% for Polar and Marine Research, Bremerhaven
%
%====================================================================================
%-------------
% CHECK INPUTS
%-------------
if nargin ~= 1
error('read_hdf.m: need a filename *hdf.')
end %if
%========
% BEGIN
%========
% disp(filename);
id= hdfsd( 'start', filename, 'rdonly' );
[ndata,n_attr,stat] = hdfsd('fileinfo',id);
% change to different hdf format ie more than one attribute
% =====
% for cnt = 0: n_attr-1 % hdf counts from 0 (sim 2 idl)
% cnt
% name = hdfsd('readattr', id, cnt)
% hdfsd( 'readattr', id, hdfsd('findattr',id,'name') )
% end
% =====
cnt = 0;
s_id = hdfsd( 'select', id, cnt );
[name, ndims, dims, type, atts, stat] = hdfsd('getinfo',s_id);
start = zeros(1,ndims);
stride = [];
edges = dims;
[data, stat] = hdfsd('readdata',s_id,start,stride,edges);
ender= hdfsd('end',id);
ender1= hdfsd('end',s_id);
% fclose(s_id)
% fclose(id)
return
%====================================================================================