1 |
%VIZICQ4 Visualization GUI for QUODDY4 hot-start files. |
---|
2 |
% VIZICQ4 is an interactive MATLAB program to help |
---|
3 |
% quickly visualize a hot-start file output from QUODDY4. |
---|
4 |
% Horizontal and vertical slices can be computed on (almost) |
---|
5 |
% any of the variables defined in the .icq4 standard. |
---|
6 |
% |
---|
7 |
% VIZICQ4 can take two input arguments on startup; |
---|
8 |
% 1) the gridname defining the domain on which |
---|
9 |
% the .icq4 file was computed. This is the name |
---|
10 |
% of the domain. |
---|
11 |
% 2) the name, including the absolute or relative path, |
---|
12 |
% to the .icq4 file under consideration. This is |
---|
13 |
% is the NAME of the file, not the fem_icq4_struct |
---|
14 |
% itself. |
---|
15 |
% |
---|
16 |
% This is version 1.2 |
---|
17 |
% |
---|
18 |
% CALL as: >> vizicq4 |
---|
19 |
% or >> vizicq4(gridname) |
---|
20 |
% or >> vizicq4(gridname,icq4name) |
---|
21 |
% |
---|
22 |
% Written by: |
---|
23 |
% Brian O. Blanton |
---|
24 |
% Department of Marine Sciences |
---|
25 |
% Ocean Processes Numerical Modeling Laboratory |
---|
26 |
% 15-1A Venable Hall |
---|
27 |
% CB# 3300 |
---|
28 |
% Uni. of North Carolina |
---|
29 |
% Chapel Hill, NC |
---|
30 |
% 27599-3300 |
---|
31 |
% |
---|
32 |
% 919-962-4466 |
---|
33 |
% blanton@marine.unc.edu |
---|
34 |
% |
---|
35 |
% Version 1.2 (M5.2.0) April 1999 |
---|
36 |
% |
---|
37 |
function retval=vizicq4(gridname,icq4name) |
---|
38 |
|
---|
39 |
% make sure this is atleast MATLAB version 5.2.0 |
---|
40 |
% |
---|
41 |
vers=version; |
---|
42 |
vers=vers(1:5); |
---|
43 |
if sum(vers<'5.2.0') |
---|
44 |
disp(' '); |
---|
45 |
disp('VIZICQ4_1.2 REQUIRES MATLAB version 5.2 or later.'); |
---|
46 |
return |
---|
47 |
end |
---|
48 |
|
---|
49 |
|
---|
50 |
% Check for other instances of VIZICQ4 |
---|
51 |
VIZICQ4_Figure=findobj(0,'Type','figure','Tag','VIZICQ4_Figure'); |
---|
52 |
if ~isempty(VIZICQ4_Figure) |
---|
53 |
VIZICQ4_Slicer_Fig=findobj(0,'Type','figure','Tag','VIZICQ4_Slicer_Fig'); |
---|
54 |
VIZICQ4_Icq4_Info_Fig=findobj(0,'Type','figure','Tag','VIZICQ4_Icq4_Info_Fig'); |
---|
55 |
delete([VIZICQ4_Figure VIZICQ4_Slicer_Fig VIZICQ4_Icq4_Info_Fig]) |
---|
56 |
end |
---|
57 |
|
---|
58 |
%if ~isempty(VIZICQ4_Figure) |
---|
59 |
% disp('Two instances of VIZICQ4 cannot run under the') |
---|
60 |
% disp('same instance of MATLAB.') |
---|
61 |
% return |
---|
62 |
%end |
---|
63 |
|
---|
64 |
|
---|
65 |
% This function sets up VIZICQ4, and verifies arguments on the |
---|
66 |
% first call. The guts of VIZICQ4 are in the private function |
---|
67 |
% vizicq4_guts.m |
---|
68 |
|
---|
69 |
nargchk(0,2,nargin); |
---|
70 |
|
---|
71 |
if nargin==0 |
---|
72 |
gridname=[]; |
---|
73 |
icq4name=[]; |
---|
74 |
else |
---|
75 |
% check first arg to make sure it's a fem_grid_struct |
---|
76 |
if ~isstr(gridname) |
---|
77 |
error('First argument to VIZICQ4 must be a gridname (string)') |
---|
78 |
end |
---|
79 |
end |
---|
80 |
|
---|
81 |
% if narg==2 |
---|
82 |
if nargin==2 |
---|
83 |
if ~isstr(icq4name) |
---|
84 |
error(' Second argument to VIZICQ4 must be a string.') |
---|
85 |
end |
---|
86 |
option='no opt'; |
---|
87 |
[fpath,fname,fext,fver] = fileparts(icq4name); |
---|
88 |
if ~strcmp(fext,'.icq4') |
---|
89 |
error('icq4name passed to VIZICQ4 does not end in ''.icq4''') |
---|
90 |
end |
---|
91 |
if ~exist(icq4name) |
---|
92 |
disp('.icq4 file passed to VIZICQ4 does not exist.') |
---|
93 |
% Find out why |
---|
94 |
% Check path existence |
---|
95 |
if ~isempty(fpath) |
---|
96 |
if exist(fpath)~=7 |
---|
97 |
disp([fpath ' not a directory']) |
---|
98 |
end |
---|
99 |
end |
---|
100 |
if ~isempty(fname) |
---|
101 |
if exist(fname)~=2 |
---|
102 |
disp([fname ' not a file']) |
---|
103 |
end |
---|
104 |
end |
---|
105 |
end |
---|
106 |
else |
---|
107 |
icq4name=[]; |
---|
108 |
end |
---|
109 |
|
---|
110 |
|
---|
111 |
% Check for the existence of map_scalar_mex5.mex<arch> |
---|
112 |
global MAP_SCALAR_EXIST |
---|
113 |
if ~(exist('map_scalar_mex5')==3) |
---|
114 |
disp('The mapping function map_scalar_mex5 cannot be located.') |
---|
115 |
disp('The volume section is disabled. To compile the mex file') |
---|
116 |
disp('map_scalar_mex5.c, cd in MATLAB to the VIZICQ4_1.2 directory') |
---|
117 |
disp('and type "mex map_scalar_mex5.c". You will then need to ') |
---|
118 |
disp('restart MATLAB.') |
---|
119 |
MAP_SCALAR_EXIST=0; |
---|
120 |
else |
---|
121 |
MAP_SCALAR_EXIST=1; |
---|
122 |
end |
---|
123 |
|
---|
124 |
% At this point, input arguments are valid, and time |
---|
125 |
% to set up the VIZICQ4 GUI. We will not return to this |
---|
126 |
% function; |
---|
127 |
disp('building vizicq4 gui') |
---|
128 |
vizicq4_gui; |
---|
129 |
get_VIZICQ4_handles; |
---|
130 |
|
---|
131 |
if ~isempty(gridname) |
---|
132 |
set(VIZICQ4_Current_Domain,'String',gridname) |
---|
133 |
vizicq4_guts('Load_Grid') |
---|
134 |
end |
---|
135 |
|
---|
136 |
if ~isempty(icq4name) |
---|
137 |
set(VIZICQ4_Current_Icq4_Name,'String',icq4name) |
---|
138 |
vizicq4_guts('Load_Icq4','Name') |
---|
139 |
end |
---|
140 |
|
---|
141 |
% Last, set Info line if MAP_SCALAR_EXIST==0 |
---|