function [] = make_gdist_input(nx,ny,nd,ngd,xsep_index,dir)
    %%% Quick code to generate different sediment classes for foredune and back
    %%% dune regions in Xbeach.  Right now just two separate sediment classes
    %%% that are unmixed.  Could make this a function later but quick and dirty
    %%% for now.
    %% JWL - USGS  12/1/2010

%     nx = 620;  %# of x locations
%     ny = 3;  %# of y locations
%     nd = 20;  %# of sediment layers
%     ngd = 2;  %# of sediment classes
% 
%     xsep_index = 260;   % x location of the separation between classes (approximate dune location)
    currentdir = cd;
    % sed1 is the mobile sediment seaward of the dune
    sed1(1:xsep_index,1:ny,1:nd) = 1;   % ALL of the sediment seaward of dune is sediment class 1 (i.e. value of 1 = 100%))
    sed1(xsep_index+1:nx,1:ny,1:nd) = 0;

    % sed2 is the immobile sediment landward of the dune
    sed2(1:xsep_index,1:ny,1:nd) = 0;   % ALL of the sediment landward of dune is sediment class 1 (i.e. value of 1 = 100%))
    sed2(xsep_index+1:nx,1:ny,1:nd) = 1;

    % format for saving and reading in by xbeach
    temp1 = cat(1,sed1(:,:,1),sed1(:,:,2));
    temp2 = cat(1,sed2(:,:,1),sed2(:,:,2));
    for i = 3:nd
        temp1 = cat(1,temp1,sed1(:,:,i));
        temp2 = cat(1,temp2,sed2(:,:,i));
    end
    temp1 = temp1(:);
    temp2 = temp2(:);
    cd(dir)
    save gdist1.inp temp1 -ascii
    save gdist2.inp temp2 -ascii
    cd(currentdir)
end
