function head=CDROM_bin_read_head(fid);
% Read of header of INTERMAGNET CDROM bin-file
%
%               head=CDROM_bin_read_head(fid);
%
% as structure
%             'ObsCode'
%             'Year'
%             'DayNum'
%             'CoLatitude'
%             'Longitude'
%             'Elevation'
%             'Orientation'
%             'Organization'
%             'DConversion'
%             'DataQuality'
%             'Instrumentation'
%             'K9'
%             'Sampling'
%             'Sensor_orientation'
%             'Publ_Date'
%             'IAF_ver'

% 19.02.2005, S.Khomutov
% 04.06.2005, read two new parameters (Sampling and Sensor_orientation)
% 23.07.2005, read D Conversion instead H_mean
% 23.03.2010  new format IAF ver2.00 (Publ_Date, IAF_ver)

Obs=char(fread(fid,4,'uchar')');    % IMO code, eg ' NVS'
tmp=fread(fid,1,'int32');           % tmp=YYYYDDDD
Year=fix(tmp/1000);                 % Year
Daynum=fix(rem(tmp,1000));          % day of year
CoLat=fread(fid,1,'int32')/1000;    % co-latitude (in degrees)
Lon=fread(fid,1,'int32')/1000;      % East longitude (in degrees)
Elev=fread(fid,1,'int32');          % elevation in meters above sea level
Orient=char(fread(fid,4,'uchar')'); % Orientation, XYZF = HEX(58 59 5A 46) (or HDZF)
Org=char(fread(fid,4,'uchar')');    % Source, eg. DMI = HEX(20 44 4D 49)
D_conv=fread(fid,1,'int32');         % D conversion, H/3438*10000 where H=annual mean of H
Hmean=D_conv/10000*3438;   % Hmean
DQ=char(fread(fid,4,'uchar')');     % Data Quality, reserved for future use = 0
Instr=char(fread(fid,4,'uchar')');  % Instrumentation, eg: LC(Linear Core) = HEX(20 20 4C 43) 
                                    % (or RC(Ring Core))
K9=fread(fid,1,'int32');            % K9 value
Sampling=fread(fid,1,'int32');      % Sampling rate in milliseconds
Sensor_Orientation=char(fread(fid,4,'uchar')'); % Orientation of sensor
% Publ_Date=fread(fid,1,'int32');     % date of file preparing
Publ_Date=char(fread(fid,4,'uchar')'); % date of file preparing
IAF_ver=fread(fid,1,'int32');       % IAF version
tmp=fread(fid,1,'int32');           % head(16) - reserved, =0

head=struct('ObsCode', Obs,...
            'Year', Year,...
            'DayNum', Daynum,...
            'CoLatitude', CoLat,...
            'Longitude', Lon,...
            'Elevation', Elev,...
            'Orientation', Orient,...
            'Organization', Org,...
            'DConversion', D_conv,...
            'DataQuality', DQ,...
            'Instrumentation',Instr,...
            'K9', K9,...
            'Sampling', Sampling,...
            'Sensor_Orientation', Sensor_Orientation,...
            'Publ_Date', Publ_Date,...
            'IAF_ver', IAF_ver);
