source: issm/oecreview/Archive/21724-22754/ISSM-22414-22415.diff@ 22755

Last change on this file since 22755 was 22755, checked in by Mathieu Morlighem, 7 years ago

CHG: added 21724-22754

File size: 1.2 KB
RevLine 
[22755]1Index: ../trunk-jpl/src/m/coordsystems/gdaltransform.m
2===================================================================
3--- ../trunk-jpl/src/m/coordsystems/gdaltransform.m (revision 22414)
4+++ ../trunk-jpl/src/m/coordsystems/gdaltransform.m (revision 22415)
5@@ -21,17 +21,22 @@
6 %
7 % To get proj.4 string from EPSG, use gdalsrsinfo. Example: gdalsrsinfo "EPSG:4326" | grep "PROJ.4"
8
9- %give ourselves a unique temporary directory:
10- temproot=tempname; mkdir(temproot);
11+ %give ourselves unique file names
12+ filename_in = tempname();
13+ filename_out = tempname();
14
15- fid=fopen([temproot '/.rand1234.txt'],'w');
16+ fid=fopen(filename_in,'w');
17 fprintf(fid,'%8g %8g\n',[x(:) y(:)]');
18 fclose(fid);
19
20- [s,r]=system(['gdaltransform -s_srs ',proj_in,' -t_srs ',proj_out,' < ' temproot '/.rand1234.txt > ' temproot '/.rand1235.txt']);
21+ [s,r]=system(['gdaltransform -s_srs ',proj_in,' -t_srs ',proj_out,' < ' filename_in ' > ' filename_out]);
22 if s~=0 | ~isempty(deblank(r)),
23 error(r);
24 end
25- A=load([temproot '/.rand1235.txt']);
26+ A=load(filename_out);
27 xout=A(:,1); xout=reshape(xout,size(x));
28 yout=A(:,2); yout=reshape(yout,size(y));
29+
30+ %clean up
31+ delete(filename_in);
32+ delete(filename_out);
Note: See TracBrowser for help on using the repository browser.