%
% test resize_byN
%

[img head]=loadsir('green.sir'); % lambert
%[img head]=loadsir('../../sir2cetb/queh-a-E2T04-10-10.sir'); % ease2

myfigure(1)
showsir(img,head)

LLx=-40;
LLy=70;
[x, y] = latlon2pix1(LLx,LLy,head);
[lon,lat]=pix2latlon(x,y,head);
fprintf("%f %f  %f %f  %f %f\n",LLx,LLy,lon,lat,x,y);

[imgout, headout]=resize_byN(img, 2, head); % expand by 2

[x, y] = latlon2pix1(LLx,LLy,headout);
[lon,lat]=pix2latlon(x,y,headout);
fprintf("%f %f  %f %f  %f %f\n",LLx,LLy,lon,lat,x,y);

writesir('junk.sir',imgout,headout);

myfigure(3)
showsir(imgout,headout)

disp('pausing...');pause

[x, y] = latlon2pix1(LLx,LLy,head);
[lon,lat]=pix2latlon(x,y,head);
fprintf("%f %f  %f %f  %f %f\n",LLx,LLy,lon,lat,x,y);

[imgout, headout]=resize_byN(img, -2, head); % shrink by 2

[x, y] = latlon2pix1(LLx,LLy,headout);
[lon,lat]=pix2latlon(x,y,headout);
fprintf("%f %f  %f %f  %f %f\n",LLx,LLy,lon,lat,x,y);

writesir('junk.sir',imgout,headout);

myfigure(4)
showsir(imgout,headout)
