function [header,grid_lon,grid_lat]=parseHeader(head);
% parseHeader parses the ascii header from wera data files
% after it has been read by fread head=fread(fid,512,'char');
% this also makes a grid based on header.lat header.lon and header.dgt
% this makes the header readable
head=char(head');
header.nser=head(1:4);
header.day=head(16:17);
header.month=head(19:21);
header.year=head(81:84);
header.hh=head(26:28);
header.mm=head(29:30);
header.time_base=head(32:34);
header.site_name=head(37:48);
header.mode=head(49:54);
header.freq=head(65:71);
header.range_width=head(97:104);
header.nord=head(118:120);
header.delta_t=head(132:139);
header.nrob=head(151:153);
header.lon_grad=head(170:172);
header.lon_min=head(174:175);
header.lon_sec=head(177:178);
header.east_or_west=head(180);
header.lat_grad=head(188:190);
header.lat_min=head(192:193);
header.lat_sec=head(195:196);
header.north_or_south=head(198);
header.window=head(218);
header.nx=head(223:225);
header.ny=head(230:232);
header.ran_off=head(241:244);
header.grid_name=head(245:269);
header.comment=head(289:315);
header.lat=head(471:479);
header.lon=head(485:495);
header.dgt=head(503:510);

% make grid
nx=str2num(header.nx);
ny=str2num(header.ny);
dgt=str2num(header.dgt);
%lat_grad=str2num(header.lat_grad);
%lat_min=str2num(header.lat_min);
%lon_grad=str2num(header.lon_grad);
%lon_min=str2num(header.lon_min);
% hrz=km2deg(dgt);
lat0=str2num(header.lat);
lon0=str2num(header.lon);
% following kwg make_grid code...
% 1.852 km = 1 nm
delta_lat=dgt/1.852;
lat_bg=(pi/180.0)*(lat0);
dlat=(pi/180.0)*(delta_lat/60);
% calculate mercator correction
korr=cos(lat_bg-0.5*double(ny-1)*dlat);
lon_bg=(pi/180.0)*(lon0);
dlon=(pi/180)*(dgt/(1.852*korr))/60;
for i=1:nx
for j=1:ny
grid_lat(i,j)=(180.0/pi)*(lat_bg-dlat*(j-1));
grid_lon(i,j)=(180.0/pi)*(lon_bg+dlon*(i-1));
end
end