% This subroutine assigns Parameter values for the grid
% which is used to calculate a Max Z value map.
% dx, dy is the grid spacing in degrees.
% For each one of the grid points, Ni events are counted.
%

report_this_filefun(mfilename('fullpath'));

% initial values
%
dx = 1.00;
dy = 1.00 ;
dz = 10.00 ;
ni = 100;

%
% make the interface
%
figure_w_normalized_uicontrolunits(...
    'Name','Grid Input Parameter',...
    'NumberTitle','off', ...
    'MenuBar','none', ...
    'NextPlot','new', ...
    'units','points',...
    'Visible','off', ...
    'Position',[ wex+200 wey-200 450 250]);
axis off

% creates a dialog box to input grid parameters
%
freq_field=uicontrol('Style','edit',...
    'Position',[.60 .50 .22 .10],...
    'Units','normalized','String',num2str(ni),...
    'Callback','ni=str2double(get(freq_field,''String'')); set(freq_field,''String'',num2str(ni));');

freq_field2=uicontrol('Style','edit',...
    'Position',[.60 .40 .22 .10],...
    'Units','normalized','String',num2str(dx),...
    'Callback','dx=str2double(get(freq_field2,''String'')); set(freq_field2,''String'',num2str(dx));');

freq_field3=uicontrol('Style','edit',...
    'Position',[.60 .30 .22 .10],...
    'Units','normalized','String',num2str(dy),...
    'Callback','dy=str2double(get(freq_field3,''String'')); set(freq_field3,''String'',num2str(dy));');

freq_field6=uicontrol('Style','edit',...
    'Position',[.60 .20 .22 .10],...
    'Units','normalized','String',num2str(par1),...
    'Callback','par1=str2double(get(freq_field6,''String'')); set(freq_field6,''String'',num2str(par1));');

freq_field7=uicontrol('Style','edit',...
    'Position',[.60 .60 .22 .10],...
    'Units','normalized','String',num2str(dz),...
    'Callback','dz=str2double(get(freq_field7,''String'')); set(freq_field7,''String'',num2str(dz));');

uicontrol('Units','normal','Position',[.1 .90 .15 .12],'String','LoadGrid', 'Callback','close;loadgrid')

close_button=uicontrol('Style','Pushbutton',...
    'Position',[.60 .05 .15 .12 ],...
    'Units','normalized','Callback','close;done','String','Cancel');

go_button1=uicontrol('Style','Pushbutton',...
    'Position',[.20 .05 .15 .12 ],...
    'Units','normalized',...
    'Callback',' gomakegr',...
    'String','ZmapGrid');

go_button2=uicontrol('Style','Pushbutton',...
    'Position',[.40 .05 .15 .12 ],...
    'Units','normalized',...
    'Callback','close;think; genascum',...
    'String','GenasGrid');


txt3 = text(...
    'Color',[0 0 0 ],...
    'EraseMode','normal',...
    'Position',[0.30 0.94 0 ],...
    'Rotation',0 ,...
    'FontSize',ZmapGlobal.Data.fontsz.l ,...
    'FontWeight','bold',...
    'String',' Grid Parameter ');


txt5 = text(...
    'Color',[0 0 0 ],...
    'EraseMode','normal',...
    'Position',[0. 0.42 0 ],...
    'Rotation',0 ,...
    'FontSize',ZmapGlobal.Data.fontsz.m ,...
    'FontWeight','bold',...
    'String','Spacing in x (dx) in deg:');

txt6 = text(...
    'Color',[0 0 0 ],...
    'EraseMode','normal',...
    'Position',[0. 0.32 0 ],...
    'Rotation',0 ,...
    'FontSize',ZmapGlobal.Data.fontsz.m ,...
    'FontWeight','bold',...
    'String','Spacing in y (dy) in deg:');

text(...
    'Color',[0 0 0 ],...
    'EraseMode','normal',...
    'Position',[0. 0.20 0 ],...
    'Rotation',0 ,...
    'FontSize',ZmapGlobal.Data.fontsz.m ,...
    'FontWeight','bold',...
    'String','Time steps in days:');


txt1 = text(...
    'Color',[0 0 0 ],...
    'EraseMode','normal',...
    'Position',[0. 0.53 0 ],...
    'Rotation',0 ,...
    'FontSize',ZmapGlobal.Data.fontsz.m,...
    'FontWeight','bold',...
    'String','Number of Events (Ni):');

text(...
    'Color',[0 0 0 ],...
    'EraseMode','normal',...
    'Position',[0. 0.63 0 ],...
    'Rotation',0 ,...
    'FontSize',ZmapGlobal.Data.fontsz.m,...
    'FontWeight','bold',...
    'String','Depth increment in (km) :');



set(gcf,'visible','on');
watchoff
