Documentation‎ > ‎FAQ‎ > ‎

Exporting templatematch results in CIAS format.

posted Jul 9, 2014, 4:05 AM by Aslak Grinsted   [ updated Jul 11, 2014, 1:05 AM ]
You can use the output of templatematch with Ice Tools if you save the results in CIAS format. The following piece of code shows how the ImGRAFT output of the Batura example can be saved in CIAS format. The variables we need to save are: uvA, dxy, and C in addition to some derived quantities.


demobatura % run the batura example

%We want to export uvA, dxy, and C but converted to utm coords.

%convert pixel displacement to utm coordinates.
geoxa=interp1(1:length(x),x,uvA(:,1));
geoya=interp1(1:length(y),y,uvA(:,2));
geoxb=interp1(1:length(x),x,uvA(:,1)+dxy(:,1));
geoyb=interp1(1:length(y),y,uvA(:,2)+dxy(:,2));
dgeo=[geoxb geoyb]-[geoxa geoya]; 

% --- Construct output matrix. --- 
ciasoutputformat=[geoxa,geoya,dgeo,sqrt(sum(dgeo.^2,2)),atan2(dgeo(:,1),dgeo(:,2))*180/pi,C];
ciasoutputformat(any(isnan(ciasoutputformat),2),:)=[];

% --- save the output matrix and header. ---
fid=fopen('baturaout.dat','w')
fprintf(fid,'X,Y,dx,dy,length,direction,max_corrcoeff,avg_corrcoeff\n');
fprintf(fid,'%16.4f,%16.4f,%16.4f,%16.4f,%16.4f,%16.4f,%16.4f,%16.4f\n',ciasoutputformat')
fclose(fid)

For more complicated coordinate systems you may have to use interp2 instead of interp1.  

How does it look in Ice Tools + Google Earth

James Turrin (developer of Ice Tools) sent me a KML file generated with Ice Tools using this ImGRAFT output. This is a screenshot from google earth of that KML.



ċ
Batura.kml
(267k)
Aslak Grinsted,
Jul 11, 2014, 12:42 AM
ą
Aslak Grinsted,
Jul 11, 2014, 12:30 AM
ċ
baturaout.dat
(187k)
Aslak Grinsted,
Jul 11, 2014, 12:46 AM