Changeset 9895
- Timestamp:
- 09/22/11 16:17:31 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/solutions/flaim_sol.m
r9894 r9895 34 34 [pathstr,name,ext,versn] = fileparts(md.flaim.tracks); 35 35 fm_tracks=fullfile('',[name ext versn]); 36 %system(['cp -p ' md.flaim.tracks ' ' options.fmdir]); 37 system(['ln -s ' md.flaim.tracks ' ' [options.fmdir filesep fm_tracks]]); 36 system(['cp -p ' md.flaim.tracks ' ' options.fmdir]); 38 37 39 38 if ~isempty(md.flaim.targets) … … 42 41 ext='.kml'; 43 42 end 44 fm_targets=fullfile( pathstr,[name ext versn]);43 fm_targets=fullfile('',[name ext versn]); 45 44 ext='.log'; 46 filelog=fullfile( pathstr,[name ext versn]);45 filelog=fullfile('',[name ext versn]); 47 46 else 48 47 fm_targets='fm_targets.kml'; … … 50 49 end 51 50 md.flaim.targets=fm_targets; 51 52 52 if ~isempty(md.flaim.solution) 53 53 [pathstr,name,ext,versn] = fileparts(md.flaim.solution); … … 57 57 end 58 58 59 % copy target file if it exists 60 61 if any(isnan(md.flaim.criterion)) || isempty(md.flaim.criterion) 62 display('Copying existing target file.'); 63 system(['cp -p ' md.flaim.targets ' ' options.fmdir]); 64 cd(options.fmdir) 65 59 66 % calculate latitude and longitude, if necessary 60 67 61 if isempty(md.mesh.lat) || ((numel(md.mesh.lat) == 1) && isnan(md.mesh.lat)) || ... 62 isempty(md.mesh.long) || ((numel(md.mesh.long) == 1) && isnan(md.mesh.long)) 63 if ~isfield(options,'latsgn') 64 error(['Missing ''latsgn'' parameter to calculate missing lat/long values.']); 65 elseif (abs(options.latsgn) ~= 1) 66 error(['Incorrect latsgn=' num2str(options.latsgn) ' parameter to calculate missing lat/long values.']); 67 else 68 display('Converting x/y values to lat/long values.'); 69 [md.mesh.lat,md.mesh.long]=xy2ll(md.mesh.x,md.mesh.y,options.latsgn); 68 else 69 if isempty(md.mesh.lat) || ((numel(md.mesh.lat) == 1) && isnan(md.mesh.lat)) || ... 70 isempty(md.mesh.long) || ((numel(md.mesh.long) == 1) && isnan(md.mesh.long)) 71 if ~isfield(options,'latsgn') 72 error(['Missing ''latsgn'' parameter to calculate missing lat/long values.']); 73 elseif (abs(options.latsgn) ~= 1) 74 error(['Incorrect latsgn=' num2str(options.latsgn) ' parameter to calculate missing lat/long values.']); 75 else 76 display('Converting x/y values to lat/long values.'); 77 [md.mesh.lat,md.mesh.long]=xy2ll(md.mesh.x,md.mesh.y,options.latsgn); 78 end 70 79 end 71 end72 80 73 81 % colormap command operates on a figure, so create an invisible one 74 82 % (could also directly call colormaps, e.g. jet(64), but risky) 75 83 76 if ~isempty(md.flaim.criterion) 77 hfig=figure('Visible','off'); 78 if isfield(options,'cmap') && ~isempty(options.cmap) 79 colormap(options.cmap) 84 if ~isempty(md.flaim.criterion) 85 hfig=figure('Visible','off'); 86 if isfield(options,'cmap') && ~isempty(options.cmap) 87 colormap(options.cmap) 88 end 89 options.cmap=colormap; 90 close(hfig) 80 91 end 81 options.cmap=colormap; 82 close(hfig) 83 end 84 if ~isfield(options,'cmap') 85 options.cmap=[]; 86 end 92 if ~isfield(options,'cmap') 93 options.cmap=[]; 94 end 87 95 88 96 % write the target kml file 89 97 90 cd(options.fmdir)91 display('Calling KMLMeshWrite.');92 KMLMeshWrite(md.miscellaneous.name,md.miscellaneous.notes,md.mesh.elements,md.mesh.vertexconnectivity,md.mesh.lat,md.mesh.long,md.qmu.partition,md.flaim.criterion,options.cmap,fm_targets);98 cd(options.fmdir) 99 display('Calling KMLMeshWrite.'); 100 KMLMeshWrite(md.miscellaneous.name,md.miscellaneous.notes,md.mesh.elements,md.mesh.vertexconnectivity,md.mesh.lat,md.mesh.long,md.qmu.partition,md.flaim.criterion,options.cmap,fm_targets); 93 101 % for testing 94 %fm_targets='issm-split-geikie1-targets.kml'; 102 % fm_targets='issm-split-geikie1-targets.kml'; 103 end 95 104 96 105 % call flaim … … 112 121 113 122 display(['Post-processing the flaim output in the ''' options.fmdir ''' sub-directory.']); 123 114 124 if exist('solution_best.kml','file') 115 125 if ~strcmp(filesol,'solution_best') … … 119 129 md.results.FlaimSolution.solution=[filesol]; 120 130 else 121 md.results.FlaimSolution.solution=[options.fmdir '/'filesol];131 md.results.FlaimSolution.solution=[options.fmdir filesep filesol]; 122 132 end 123 133 else 124 134 md.results.FlaimSolution.solution=''; 125 135 end 136 126 137 if exist(filelog,'file') 127 138 [status,fline]=system(['grep -i quality ' filelog]); … … 155 166 cd .. 156 167 if ~strncmpi(options.keep,'y',1) 157 system(['mv ' options.fmdir '/' filesol '.kml .']); 158 system(['mv ' options.fmdir '/' filesol '.log .']); 168 system(['mv ' options.fmdir filesep fm_targets ' .']); 169 system(['mv ' options.fmdir filesep filesol '.kml .']); 170 system(['mv ' options.fmdir filesep filesol '.log .']); 159 171 system(['rm -rf ' options.fmdir]); 160 172 end
Note:
See TracChangeset
for help on using the changeset viewer.