function OK = arcgridwrite_test
%arcgridwrite_test
%
% http://en.wikipedia.org/wiki/Esri_grid
%
%See also: arcgridwrite_test

%% sticks

D0.x=[ 25    75   125   175];
D0.y=[ 25    75   125   175   225   275];
D0.z=[ 13     5     1   NaN
      88    75    27     9
      32    42    50     6
       3     8    35    10
     NaN    20   100    36
     NaN   NaN     5     2];


arcgridwrite('arcgridwrite0_test.asc',D0.x,D0.y,D0.z)

[D.x,D.y,D.z,D.meta] = arc_asc_read('arcgridwrite0_test.asc')

OK(1) = isequalwithequalnans(D.x,D0.x);
OK(2) = isequalwithequalnans(D.y,D0.y);
OK(3) = isequalwithequalnans(D.z,D0.z);

subplot(1,2,1)
pcolorcorcen(center2corner1(D.x),center2corner1(D.y),D.z);
axis equal;
axis tight

%% 2D

[D2.x,D2.y]=meshgrid(D0.x,D0.y);

arcgridwrite('arcgridwrite2_test.asc',D2.x,D2.y,D0.z)

[D.x,D.y,D.z,D.meta] = arc_asc_read('arcgridwrite2_test.asc')

OK(1) = isequalwithequalnans(D.x,D0.x);
OK(2) = isequalwithequalnans(D.y,D0.y);
OK(3) = isequalwithequalnans(D.z,D0.z);

subplot(1,2,2)
D
pcolorcorcen(center2corner1(D.x),center2corner1(D.y),D.z);
axis equal;
axis tight

%%

OK = all(OK);