[25834] | 1 | Index: ../trunk-jpl/src/m/contrib/larour/mdanalysis.m
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/m/contrib/larour/mdanalysis.m (nonexistent)
|
---|
| 4 | +++ ../trunk-jpl/src/m/contrib/larour/mdanalysis.m (revision 24880)
|
---|
| 5 | @@ -0,0 +1,1683 @@
|
---|
| 6 | +function varargout = mdanalysis(varargin)
|
---|
| 7 | +% MDANALYSIS MATLAB code for mdanalysis.fig {{{
|
---|
| 8 | +% MDANALYSIS, by itself, creates a new MDANALYSIS or raises the existing
|
---|
| 9 | +% singleton*.
|
---|
| 10 | +%
|
---|
| 11 | +% H = MDANALYSIS returns the handle to a new MDANALYSIS or the handle to
|
---|
| 12 | +% the existing singleton*.
|
---|
| 13 | +%
|
---|
| 14 | +% MDANALYSIS('CALLBACK',hObject,eventData,handles,...) calls the local
|
---|
| 15 | +% function named CALLBACK in MDANALYSIS.M with the given input arguments.
|
---|
| 16 | +%
|
---|
| 17 | +% MDANALYSIS('Property','Value',...) creates a new MDANALYSIS or raises the
|
---|
| 18 | +% existing singleton*. Starting from the left, property value pairs are
|
---|
| 19 | +% applied to the GUI before mdanalysis_OpeningFcn gets called. An
|
---|
| 20 | +% unrecognized property name or invalid value makes property application
|
---|
| 21 | +% stop. All inputs are passed to mdanalysis_OpeningFcn via varargin.
|
---|
| 22 | +%
|
---|
| 23 | +% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
|
---|
| 24 | +% instance to run (singleton)".
|
---|
| 25 | +%
|
---|
| 26 | +% See also: GUIDE, GUIDATA, GUIHANDLES
|
---|
| 27 | +%variables: }}}
|
---|
| 28 | +%global variables: %{{{
|
---|
| 29 | +global md modelname
|
---|
| 30 | +if strcmpi(class(varargin{1}),'model') | strcmpi(class(varargin{1}),'sealevelmodel'),
|
---|
| 31 | + md=varargin{1};
|
---|
| 32 | + modelname=inputname(1);
|
---|
| 33 | +end
|
---|
| 34 | +
|
---|
| 35 | +global logvalue
|
---|
| 36 | +global solutiontype
|
---|
| 37 | +global comparison
|
---|
| 38 | +global reload
|
---|
| 39 | +global earth
|
---|
| 40 | +global whores
|
---|
| 41 | +%}}}
|
---|
| 42 | +%Initialization code{{{
|
---|
| 43 | +% Begin initialization code - DO NOT EDIT
|
---|
| 44 | +gui_Singleton = 1;
|
---|
| 45 | +gui_State = struct('gui_Name', mfilename, ...
|
---|
| 46 | + 'gui_Singleton', gui_Singleton, ...
|
---|
| 47 | + 'gui_OpeningFcn', @mdanalysis_OpeningFcn, ...
|
---|
| 48 | + 'gui_OutputFcn', @mdanalysis_OutputFcn, ...
|
---|
| 49 | + 'gui_LayoutFcn', [] , ...
|
---|
| 50 | + 'gui_Callback', []);
|
---|
| 51 | +if nargin && ischar(varargin{1})
|
---|
| 52 | + gui_State.gui_Callback = str2func(varargin{1});
|
---|
| 53 | +end
|
---|
| 54 | +
|
---|
| 55 | +if nargout
|
---|
| 56 | + [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
|
---|
| 57 | +else
|
---|
| 58 | + gui_mainfcn(gui_State, varargin{:});
|
---|
| 59 | +end
|
---|
| 60 | +% End initialization code - DO NOT EDIT
|
---|
| 61 | +
|
---|
| 62 | +
|
---|
| 63 | +% --- Executes just before mdanalysis is made visible.
|
---|
| 64 | +function mdanalysis_OpeningFcn(hObject, eventdata, handles, varargin)
|
---|
| 65 | +global md comparison logvalue solutiontype
|
---|
| 66 | +% This function has no output args, see OutputFcn.
|
---|
| 67 | +% hObject handle to figure
|
---|
| 68 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 69 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 70 | +% varargin command line arguments to mdanalysis (see VARARGIN)
|
---|
| 71 | +
|
---|
| 72 | +% Choose default command line output for mdanalysis
|
---|
| 73 | +handles.output = hObject;
|
---|
| 74 | +
|
---|
| 75 | +% Update handles structure
|
---|
| 76 | +guidata(hObject, handles);
|
---|
| 77 | +
|
---|
| 78 | +% This sets up the initial plot - only do when we are invisible
|
---|
| 79 | +% so window can get raised using mdanalysis.
|
---|
| 80 | +if strcmp(get(hObject,'Visible'),'off')
|
---|
| 81 | + comparison=0;
|
---|
| 82 | + logvalue=0;
|
---|
| 83 | + reload=0;
|
---|
| 84 | + plotm();
|
---|
| 85 | +end
|
---|
| 86 | +
|
---|
| 87 | +% UIWAIT makes mdanalysis wait for user response (see UIRESUME)
|
---|
| 88 | +% uiwait(handles.figure1);
|
---|
| 89 | +
|
---|
| 90 | +
|
---|
| 91 | +% --- Outputs from this function are returned to the command line.
|
---|
| 92 | +function varargout = mdanalysis_OutputFcn(hObject, eventdata, handles)
|
---|
| 93 | +% varargout cell array for returning output args (see VARARGOUT);
|
---|
| 94 | +% hObject handle to figure
|
---|
| 95 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 96 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 97 | +
|
---|
| 98 | +% Get default command line output from handles structure
|
---|
| 99 | +varargout{1} = handles.output;
|
---|
| 100 | +%}}}
|
---|
| 101 | +%Interp faceting {{{
|
---|
| 102 | +% --- Executes on button press in Interp.
|
---|
| 103 | +function Interp_Callback(hObject, eventdata, handles)
|
---|
| 104 | +% hObject handle to Interp (see GCBO)
|
---|
| 105 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 106 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 107 | +plotm();
|
---|
| 108 | +% Hint: get(hObject,'Value') returns toggle state of Interp
|
---|
| 109 | +
|
---|
| 110 | +% --- If Enable == 'on', executes on mouse press in 5 pixel border.
|
---|
| 111 | +% --- Otherwise, executes on mouse press in 5 pixel border or over Interp.
|
---|
| 112 | +function Interp_ButtonDownFcn(hObject, eventdata, handles)
|
---|
| 113 | +% hObject handle to Interp (see GCBO)
|
---|
| 114 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 115 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 116 | +% }}}
|
---|
| 117 | +%Faceted facting {{{
|
---|
| 118 | +% --- Executes on button press in Faceted.
|
---|
| 119 | +function Faceted_Callback(hObject, eventdata, handles)
|
---|
| 120 | +% hObject handle to Faceted (see GCBO)
|
---|
| 121 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 122 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 123 | +plotm();
|
---|
| 124 | +% Hint: get(hObject,'Value') returns toggle state of Faceted
|
---|
| 125 | +
|
---|
| 126 | +% --- If Enable == 'on', executes on mouse press in 5 pixel border.
|
---|
| 127 | +% --- Otherwise, executes on mouse press in 5 pixel border or over Faceted.
|
---|
| 128 | +function Faceted_ButtonDownFcn(hObject, eventdata, handles)
|
---|
| 129 | +% hObject handle to Faceted (see GCBO)
|
---|
| 130 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 131 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 132 | +%}}}
|
---|
| 133 | +%Flat faceting {{{
|
---|
| 134 | +% --- Executes on button press in Flat.
|
---|
| 135 | +function Flat_Callback(hObject, eventdata, handles)
|
---|
| 136 | +% hObject handle to Flat (see GCBO)
|
---|
| 137 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 138 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 139 | +plotm();
|
---|
| 140 | +% Hint: get(hObject,'Value') returns toggle state of Flat
|
---|
| 141 | +
|
---|
| 142 | +% --- If Enable == 'on', executes on mouse press in 5 pixel border.
|
---|
| 143 | +% --- Otherwise, executes on mouse press in 5 pixel border or over Flat.
|
---|
| 144 | +function Flat_ButtonDownFcn(hObject, eventdata, handles)
|
---|
| 145 | +% hObject handle to Flat (see GCBO)
|
---|
| 146 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 147 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 148 | +%}}}
|
---|
| 149 | +%Step {{{
|
---|
| 150 | +% --- Executes on selection change in Step.
|
---|
| 151 | +function Step_Callback(hObject, eventdata, handles)
|
---|
| 152 | +global grounded ice logvalue
|
---|
| 153 | +% hObject handle to Step (see GCBO)
|
---|
| 154 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 155 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 156 | +plotm();
|
---|
| 157 | +
|
---|
| 158 | +% Hints: contents = cellstr(get(hObject,'String')) returns Step contents as cell array
|
---|
| 159 | +% contents{get(hObject,'Value')} returns selected item from Step
|
---|
| 160 | +
|
---|
| 161 | +% --- Executes during object creation, after setting all properties.
|
---|
| 162 | +function Step_CreateFcn(hObject, eventdata, handles)
|
---|
| 163 | +global md grounded ice logvalue
|
---|
| 164 | +% hObject handle to Step (see GCBO)
|
---|
| 165 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 166 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 167 | +if issealevel(), if isearth, results=md.earth.results; else results=md.icecaps{1}.results; end; else results=md.results; end;
|
---|
| 168 | +if isfield(results,'TransientSolution'),
|
---|
| 169 | + strings=cell(length(results.TransientSolution),1);
|
---|
| 170 | + for i=1:length(results.TransientSolution),
|
---|
| 171 | + strings{i}=sprintf('%4.2f (%i)',results.TransientSolution(i).time,i);
|
---|
| 172 | + end
|
---|
| 173 | + if length(strings)>40,
|
---|
| 174 | + %too many strings, reduce!
|
---|
| 175 | + lt=length(strings);
|
---|
| 176 | + modlt=floor(lt/40);
|
---|
| 177 | + strings=strings(1:modlt:end);
|
---|
| 178 | + end
|
---|
| 179 | + set(hObject,'String',strings);
|
---|
| 180 | + set(hObject,'Value',1);
|
---|
| 181 | +else
|
---|
| 182 | + set(hObject,'String',{});
|
---|
| 183 | + set(hObject,'Value',1);
|
---|
| 184 | +end
|
---|
| 185 | +% Hint: popupmenu controls usually have a white background on Windows.
|
---|
| 186 | +% See ISPC and COMPUTER.
|
---|
| 187 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 188 | + set(hObject,'BackgroundColor','white');
|
---|
| 189 | +end
|
---|
| 190 | +%}}}
|
---|
| 191 | +%Log {{{
|
---|
| 192 | +% --- Executes on button press in Log.
|
---|
| 193 | +function Log_Callback(hObject, eventdata, handles)
|
---|
| 194 | +global grounded ice logvalue
|
---|
| 195 | +% hObject handle to Log (see GCBO)
|
---|
| 196 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 197 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 198 | +plotm();
|
---|
| 199 | +% Hint: get(hObject,'Value') returns toggle state of Log
|
---|
| 200 | +
|
---|
| 201 | +% --- Executes on button press in Lock.
|
---|
| 202 | +function Lock_Callback(hObject, eventdata, handles)
|
---|
| 203 | +% hObject handle to Lock (see GCBO)
|
---|
| 204 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 205 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 206 | +plotm();
|
---|
| 207 | +% Hint: get(hObject,'Value') returns toggle state of Lock
|
---|
| 208 | +% }}}
|
---|
| 209 | +%Collock: not sure whether that one is working anymore: {{{
|
---|
| 210 | +% --- Executes on button press in Collock.
|
---|
| 211 | +function Collock_Callback(hObject, eventdata, handles)
|
---|
| 212 | +% hObject handle to Collock (see GCBO)
|
---|
| 213 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 214 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 215 | +plotm();
|
---|
| 216 | +% Hint: get(hObject,'Value') returns toggle state of Collock
|
---|
| 217 | +% }}}
|
---|
| 218 | +%Field {{{
|
---|
| 219 | +% --- Executes on selection change in Field.
|
---|
| 220 | +function Field_Callback(hObject, eventdata, handles)
|
---|
| 221 | +global md
|
---|
| 222 | +% hObject handle to Field (see GCBO)
|
---|
| 223 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 224 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 225 | +
|
---|
| 226 | +strings=get(hObject,'String'); value=get(hObject,'Value');
|
---|
| 227 | +string=strings(value);
|
---|
| 228 | +
|
---|
| 229 | +if strcmpi(string,'IceVolume') | strcmpi(string,'IceVolumeAboveFloatation'),
|
---|
| 230 | + plotv();
|
---|
| 231 | +elseif strcmpi(string,'SealevelRSLEustatic'),
|
---|
| 232 | + %display directly:
|
---|
| 233 | + displayscalar();
|
---|
| 234 | +else
|
---|
| 235 | + plotm();
|
---|
| 236 | +end
|
---|
| 237 | +
|
---|
| 238 | +
|
---|
| 239 | +
|
---|
| 240 | +% Hints: contents = cellstr(get(hObject,'String')) returns Field contents as cell array
|
---|
| 241 | +% contents{get(hObject,'Value')} returns selected item from Field
|
---|
| 242 | +
|
---|
| 243 | +% --- Executes during object creation, after setting all properties.
|
---|
| 244 | +function Field_CreateFcn(hObject, eventdata, handles)
|
---|
| 245 | +global md
|
---|
| 246 | +% hObject handle to Field (see GCBO)
|
---|
| 247 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 248 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 249 | +if issealevel(), if isearth, results=md.earth.results; else results=md.icecaps{1}.results; end; else results=md.results; end;
|
---|
| 250 | +if isfield(results,'TransientSolution'),
|
---|
| 251 | + fields=listfields(results,'TransientSolution');
|
---|
| 252 | + set(hObject,'String',fields);
|
---|
| 253 | + for i=1:length(fields),
|
---|
| 254 | + if ~issealevel & strcmpi(fields{i},'Vel'),
|
---|
| 255 | + set(hObject,'Value',i);
|
---|
| 256 | + break;
|
---|
| 257 | + end
|
---|
| 258 | + if issealevel & isearth & strcmpi(fields{i},'Sealevel'),
|
---|
| 259 | + set(hObject,'Value',i);
|
---|
| 260 | + break;
|
---|
| 261 | + end
|
---|
| 262 | + end
|
---|
| 263 | +else
|
---|
| 264 | + set(hObject,'String',{});
|
---|
| 265 | + set(hObject,'Value',0);
|
---|
| 266 | +end
|
---|
| 267 | +
|
---|
| 268 | +% Hint: popupmenu controls usually have a white background on Windows.
|
---|
| 269 | +% See ISPC and COMPUTER.
|
---|
| 270 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 271 | + set(hObject,'BackgroundColor','white');
|
---|
| 272 | +end
|
---|
| 273 | +%}}}
|
---|
| 274 | +%Model Loading {{{
|
---|
| 275 | +% --- Executes on selection change in ModelChoice.
|
---|
| 276 | +function ModelChoice_Callback(hObject, eventdata, handles)
|
---|
| 277 | + % hObject handle to ModelChoice (see GCBO)
|
---|
| 278 | + % eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 279 | + % handles structure with handles and user data (see GUIDATA)
|
---|
| 280 | +
|
---|
| 281 | + % Hints: contents = cellstr(get(hObject,'String')) returns ModelChoice contents as cell array
|
---|
| 282 | + % contents{get(hObject,'Value')} returns selected item from ModelChoice
|
---|
| 283 | + global modelname md whores
|
---|
| 284 | +
|
---|
| 285 | + %figure out which model is being loaded:
|
---|
| 286 | + strings=cellstr(get(hObject,'String'));
|
---|
| 287 | + counter=get(hObject,'Value');
|
---|
| 288 | + string=strings{counter};
|
---|
| 289 | + counter=findstr(string,'(');
|
---|
| 290 | + newmodelname=string(1:counter-2);
|
---|
| 291 | +
|
---|
| 292 | + %load model from base workspace:
|
---|
| 293 | + md= evalin('base', newmodelname);
|
---|
| 294 | +
|
---|
| 295 | + %replot:
|
---|
| 296 | + h = findobj('Tag','Field');
|
---|
| 297 | + Field_Callback(h,eventdata,handles);
|
---|
| 298 | +
|
---|
| 299 | +
|
---|
| 300 | + %eval([newmodelname '=md;']);
|
---|
| 301 | + %close gcbf;
|
---|
| 302 | + %eval(['mdanalysis(' newmodelname ');']);
|
---|
| 303 | +
|
---|
| 304 | +% --- Executes during object creation, after setting all properties.
|
---|
| 305 | +function ModelChoice_CreateFcn(hObject, eventdata, handles)
|
---|
| 306 | +% hObject handle to ModelChoice (see GCBO)
|
---|
| 307 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 308 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 309 | +global modelname
|
---|
| 310 | +
|
---|
| 311 | +
|
---|
| 312 | +%figure out how many models are in the workspace!
|
---|
| 313 | +whores=evalin('base','whos');
|
---|
| 314 | +flags=zeros(length(whores),1);
|
---|
| 315 | +for i=1:length(whores),
|
---|
| 316 | + if strcmpi(whores(i).class,'model') | strcmpi(whores(i).class,'sealevelmodel'),
|
---|
| 317 | + flags(i)=1;
|
---|
| 318 | + end
|
---|
| 319 | +end
|
---|
| 320 | +pos=find(flags);
|
---|
| 321 | +whores=whores(pos);
|
---|
| 322 | +
|
---|
| 323 | +strings={};
|
---|
| 324 | +for i=1:length(whores),
|
---|
| 325 | + strings{end+1}=[whores(i).name ' (' whores(i).class ')'];
|
---|
| 326 | +end
|
---|
| 327 | +
|
---|
| 328 | +%match with varargin{1}'s name:
|
---|
| 329 | +counter=-1;
|
---|
| 330 | +for i=1:length(strings),
|
---|
| 331 | + if strcmpi(modelname,whores(i).name),
|
---|
| 332 | + counter=i;
|
---|
| 333 | + break;
|
---|
| 334 | + end
|
---|
| 335 | +end
|
---|
| 336 | +if counter==-1,
|
---|
| 337 | + error('cound not find input model name matching base workspace names!');
|
---|
| 338 | +end
|
---|
| 339 | +
|
---|
| 340 | +set(hObject,'String',strings);
|
---|
| 341 | +set(hObject,'Value',counter);
|
---|
| 342 | +
|
---|
| 343 | +
|
---|
| 344 | +% Hint: popupmenu controls usually have a white background on Windows.
|
---|
| 345 | +% See ISPC and COMPUTER.
|
---|
| 346 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 347 | + set(hObject,'BackgroundColor','white');
|
---|
| 348 | +end
|
---|
| 349 | +
|
---|
| 350 | +%}}}
|
---|
| 351 | +%Cmin {{{
|
---|
| 352 | +function Cmin_Callback(hObject, eventdata, handles)
|
---|
| 353 | +% hObject handle to Cmin (see GCBO)
|
---|
| 354 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 355 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 356 | +plotm();
|
---|
| 357 | +% Hints: get(hObject,'String') returns contents of Cmin as text
|
---|
| 358 | +% str2double(get(hObject,'String')) returns contents of Cmin as a double
|
---|
| 359 | +
|
---|
| 360 | +
|
---|
| 361 | +% --- Executes during object creation, after setting all properties.
|
---|
| 362 | +function Cmin_CreateFcn(hObject, eventdata, handles)
|
---|
| 363 | +% hObject handle to Cmin (see GCBO)
|
---|
| 364 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 365 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 366 | +set(hObject,'String',num2str(NaN));
|
---|
| 367 | +% Hint: edit controls usually have a white background on Windows.
|
---|
| 368 | +% See ISPC and COMPUTER.
|
---|
| 369 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 370 | + set(hObject,'BackgroundColor','white');
|
---|
| 371 | +end
|
---|
| 372 | +%}}}
|
---|
| 373 | +%Cmax {{{
|
---|
| 374 | +function Cmax_Callback(hObject, eventdata, handles)
|
---|
| 375 | +% hObject handle to Cmax (see GCBO)
|
---|
| 376 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 377 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 378 | +
|
---|
| 379 | +% Hints: get(hObject,'String') returns contents of Cmax as text
|
---|
| 380 | +% str2double(get(hObject,'String')) returns contents of Cmax as a double
|
---|
| 381 | +plotm();
|
---|
| 382 | +
|
---|
| 383 | +% --- Executes during object creation, after setting all properties.
|
---|
| 384 | +function Cmax_CreateFcn(hObject, eventdata, handles)
|
---|
| 385 | +% hObject handle to Cmax (see GCBO)
|
---|
| 386 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 387 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 388 | +set(hObject,'String',num2str(NaN));
|
---|
| 389 | +% Hint: edit controls usually have a white background on Windows.
|
---|
| 390 | +% See ISPC and COMPUTER.
|
---|
| 391 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 392 | + set(hObject,'BackgroundColor','white');
|
---|
| 393 | +end
|
---|
| 394 | +%}}}
|
---|
| 395 | +%Xmin {{{
|
---|
| 396 | +function xmin_Callback(hObject, eventdata, handles)
|
---|
| 397 | +% hObject handle to xmin (see GCBO)
|
---|
| 398 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 399 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 400 | +
|
---|
| 401 | +% Hints: get(hObject,'String') returns contents of xmin as text
|
---|
| 402 | +% str2double(get(hObject,'String')) returns contents of xmin as a double
|
---|
| 403 | +
|
---|
| 404 | +% --- Executes during object creation, after setting all properties.
|
---|
| 405 | +function xmin_CreateFcn(hObject, eventdata, handles)
|
---|
| 406 | +% hObject handle to xmin (see GCBO)
|
---|
| 407 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 408 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 409 | +
|
---|
| 410 | +% Hint: edit controls usually have a white background on Windows.
|
---|
| 411 | +% See ISPC and COMPUTER.
|
---|
| 412 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 413 | + set(hObject,'BackgroundColor','white');
|
---|
| 414 | +end
|
---|
| 415 | +%}}}
|
---|
| 416 | +%Xmax {{{
|
---|
| 417 | +function xmax_Callback(hObject, eventdata, handles)
|
---|
| 418 | +% hObject handle to xmax (see GCBO)
|
---|
| 419 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 420 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 421 | +% Hints: get(hObject,'String') returns contents of xmax as text
|
---|
| 422 | +% str2double(get(hObject,'String')) returns contents of xmax as a double
|
---|
| 423 | +
|
---|
| 424 | +% --- Executes during object creation, after setting all properties.
|
---|
| 425 | +function xmax_CreateFcn(hObject, eventdata, handles)
|
---|
| 426 | +% hObject handle to xmax (see GCBO)
|
---|
| 427 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 428 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 429 | +
|
---|
| 430 | +% Hint: edit controls usually have a white background on Windows.
|
---|
| 431 | +% See ISPC and COMPUTER.
|
---|
| 432 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 433 | + set(hObject,'BackgroundColor','white');
|
---|
| 434 | +end
|
---|
| 435 | +% }}}
|
---|
| 436 | +%Ymin {{{
|
---|
| 437 | +function ymin_Callback(hObject, eventdata, handles)
|
---|
| 438 | +% hObject handle to ymin (see GCBO)
|
---|
| 439 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 440 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 441 | +% Hints: get(hObject,'String') returns contents of ymin as text
|
---|
| 442 | +% str2double(get(hObject,'String')) returns contents of ymin as a double
|
---|
| 443 | +
|
---|
| 444 | +
|
---|
| 445 | +% --- Executes during object creation, after setting all properties.
|
---|
| 446 | +function ymin_CreateFcn(hObject, eventdata, handles)
|
---|
| 447 | +% hObject handle to ymin (see GCBO)
|
---|
| 448 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 449 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 450 | +
|
---|
| 451 | +% Hint: edit controls usually have a white background on Windows.
|
---|
| 452 | +% See ISPC and COMPUTER.
|
---|
| 453 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 454 | + set(hObject,'BackgroundColor','white');
|
---|
| 455 | +end
|
---|
| 456 | +%}}}
|
---|
| 457 | +%Ymax {{{
|
---|
| 458 | +function ymax_Callback(hObject, eventdata, handles)
|
---|
| 459 | +% hObject handle to ymax (see GCBO)
|
---|
| 460 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 461 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 462 | +% Hints: get(hObject,'String') returns contents of ymax as text
|
---|
| 463 | +% str2double(get(hObject,'String')) returns contents of ymax as a double
|
---|
| 464 | +
|
---|
| 465 | +
|
---|
| 466 | +% --- Executes during object creation, after setting all properties.
|
---|
| 467 | +function ymax_CreateFcn(hObject, eventdata, handles)
|
---|
| 468 | +% hObject handle to ymax (see GCBO)
|
---|
| 469 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 470 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 471 | +
|
---|
| 472 | +% Hint: edit controls usually have a white background on Windows.
|
---|
| 473 | +% See ISPC and COMPUTER.
|
---|
| 474 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 475 | + set(hObject,'BackgroundColor','white');
|
---|
| 476 | +end
|
---|
| 477 | +%}}}
|
---|
| 478 | +%Time lable {{{
|
---|
| 479 | +function Time_Callback(hObject, eventdata, handles)
|
---|
| 480 | +% hObject handle to Time (see GCBO)
|
---|
| 481 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 482 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 483 | +
|
---|
| 484 | +% Hints: get(hObject,'String') returns contents of Time as text
|
---|
| 485 | +% str2double(get(hObject,'String')) returns contents of Time as a double
|
---|
| 486 | +
|
---|
| 487 | +
|
---|
| 488 | +% --- Executes during object creation, after setting all properties.
|
---|
| 489 | +function Time_CreateFcn(hObject, eventdata, handles)
|
---|
| 490 | +global md
|
---|
| 491 | +% hObject handle to Time (see GCBO)
|
---|
| 492 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 493 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 494 | +if issealevel, if isearth, results=md.earth.results; else results=md.icecaps{1}.results; end; else results=md.results; end;
|
---|
| 495 | +if isfield(results,'TransientSolution'),
|
---|
| 496 | + set(hObject,'String',sprintf('%4.2f',results.TransientSolution(1).time));
|
---|
| 497 | +else
|
---|
| 498 | + set(hObject,'String',sprintf('%4.2f',0));
|
---|
| 499 | +end
|
---|
| 500 | +% Hint: edit controls usually have a white background on Windows.
|
---|
| 501 | +% See ISPC and COMPUTER.
|
---|
| 502 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 503 | + set(hObject,'BackgroundColor','white');
|
---|
| 504 | +end
|
---|
| 505 | +
|
---|
| 506 | +% --- If Enable == 'on', executes on mouse press in 5 pixel border.
|
---|
| 507 | +% --- Otherwise, executes on mouse press in 5 pixel border or over Time.
|
---|
| 508 | +function Time_ButtonDownFcn(hObject, eventdata, handles)
|
---|
| 509 | +% hObject handle to Time (see GCBO)
|
---|
| 510 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 511 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 512 | +% }}}
|
---|
| 513 | +%Mask: {{{
|
---|
| 514 | +% --- Executes on selection change in Masque.
|
---|
| 515 | +function Masque_Callback(hObject, eventdata, handles)
|
---|
| 516 | +% hObject handle to Masque (see GCBO)
|
---|
| 517 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 518 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 519 | +plotm();
|
---|
| 520 | +% Hints: contents = cellstr(get(hObject,'String')) returns Masque contents as cell array
|
---|
| 521 | +% contents{get(hObject,'Value')} returns selected item from Masque
|
---|
| 522 | +
|
---|
| 523 | +% --- Executes during object creation, after setting all properties.
|
---|
| 524 | +function Masque_CreateFcn(hObject, eventdata, handles)
|
---|
| 525 | +global md
|
---|
| 526 | +% hObject handle to Masque (see GCBO)
|
---|
| 527 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 528 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 529 | +if issealevel,
|
---|
| 530 | + if isearth,
|
---|
| 531 | + mv=md.earth.mask;
|
---|
| 532 | + else
|
---|
| 533 | + mv=md.icecaps{1}.mask;
|
---|
| 534 | + end
|
---|
| 535 | +else
|
---|
| 536 | + mv=md.mask;
|
---|
| 537 | +end
|
---|
| 538 | +strings=fields(mv);
|
---|
| 539 | +strings={'all',strings{:}};
|
---|
| 540 | +set(hObject,'String',strings);
|
---|
| 541 | +% Hint: popupmenu controls usually have a white background on Windows.
|
---|
| 542 | +% See ISPC and COMPUTER.
|
---|
| 543 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 544 | + set(hObject,'BackgroundColor','white');
|
---|
| 545 | +end
|
---|
| 546 | +%}}}
|
---|
| 547 | +%DiffStep {{{
|
---|
| 548 | +% --- Executes on selection change in DiffStep.
|
---|
| 549 | +function DiffStep_Callback(hObject, eventdata, handles)
|
---|
| 550 | +% hObject handle to DiffStep (see GCBO)
|
---|
| 551 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 552 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 553 | +plotm();
|
---|
| 554 | +
|
---|
| 555 | +% Hints: contents = cellstr(get(hObject,'String')) returns DiffStep contents as cell array
|
---|
| 556 | +% contents{get(hObject,'Value')} returns selected item from DiffStep
|
---|
| 557 | +
|
---|
| 558 | +% --- Executes during object creation, after setting all properties.
|
---|
| 559 | +function DiffStep_CreateFcn(hObject, eventdata, handles)
|
---|
| 560 | +global md ;
|
---|
| 561 | +% hObject handle to DiffStep (see GCBO)
|
---|
| 562 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 563 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 564 | +if issealevel, if isearth, results=md.earth.results; else results=md.icecaps{1}.results; end; else results=md.results; end;
|
---|
| 565 | +if isfield(results,'TransientSolution'),
|
---|
| 566 | + strings=cell(length(results.TransientSolution),1);
|
---|
| 567 | + for i=1:length(results.TransientSolution),
|
---|
| 568 | + strings{i}=sprintf('%4.2f (%i)',results.TransientSolution(i).time,i);
|
---|
| 569 | + end
|
---|
| 570 | + if length(strings)>20,
|
---|
| 571 | + %too many strings, reduce!
|
---|
| 572 | + lt=length(strings);
|
---|
| 573 | + modlt=floor(lt/20);
|
---|
| 574 | + strings=strings(1:modlt:end);
|
---|
| 575 | + end
|
---|
| 576 | + set(hObject,'String',strings);
|
---|
| 577 | +else
|
---|
| 578 | + set(hObject,'String',{});
|
---|
| 579 | +end
|
---|
| 580 | +
|
---|
| 581 | +% Hint: popupmenu controls usually have a white background on Windows.
|
---|
| 582 | +% See ISPC and COMPUTER.
|
---|
| 583 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 584 | + set(hObject,'BackgroundColor','white');
|
---|
| 585 | +end
|
---|
| 586 | +% --- If Enable == 'on', executes on mouse press in 5 pixel border.
|
---|
| 587 | +% --- Otherwise, executes on mouse press in 5 pixel border or over DiffStep.
|
---|
| 588 | +function DiffStep_ButtonDownFcn(hObject, eventdata, handles)
|
---|
| 589 | +% hObject handle to DiffStep (see GCBO)
|
---|
| 590 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 591 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 592 | +% }}}
|
---|
| 593 | +%Diff button {{{
|
---|
| 594 | +% --- Executes on button press in Diff.
|
---|
| 595 | +function Diff_Callback(hObject, eventdata, handles)
|
---|
| 596 | +% hObject handle to Diff (see GCBO)
|
---|
| 597 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 598 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 599 | +plotm();
|
---|
| 600 | +% Hint: get(hObject,'Value') returns toggle state of Diff
|
---|
| 601 | +
|
---|
| 602 | +% --- Executes during object creation, after setting all properties.
|
---|
| 603 | +function Diff_CreateFcn(hObject, eventdata, handles)
|
---|
| 604 | +% hObject handle to Diff (see GCBO)
|
---|
| 605 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 606 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 607 | +%}}}
|
---|
| 608 | +%Model Fields: {{{
|
---|
| 609 | +% --- Executes on selection change in ModelFields.
|
---|
| 610 | +function ModelFields_Callback(hObject, eventdata, handles)
|
---|
| 611 | +% hObject handle to ModelFields (see GCBO)
|
---|
| 612 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 613 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 614 | +plotm();
|
---|
| 615 | +% Hints: contents = cellstr(get(hObject,'String')) returns ModelFields contents as cell array
|
---|
| 616 | +% contents{get(hObject,'Value')} returns selected item from ModelFields
|
---|
| 617 | +
|
---|
| 618 | +% --- Executes during object creation, after setting all properties.
|
---|
| 619 | +function ModelFields_CreateFcn(hObject, eventdata, handles)
|
---|
| 620 | +global md
|
---|
| 621 | +% hObject handle to ModelFields (see GCBO)
|
---|
| 622 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 623 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 624 | +
|
---|
| 625 | +
|
---|
| 626 | +% fields {{{
|
---|
| 627 | +fields={'geometry.thickness',...
|
---|
| 628 | + 'geometry.surface',...
|
---|
| 629 | + 'geometry.base',...
|
---|
| 630 | + 'geometry.bed',...
|
---|
| 631 | + 'inversion.vx_obs',...
|
---|
| 632 | + 'inversion.vy_obs',...
|
---|
| 633 | + 'inversion.vel_obs',...
|
---|
| 634 | + 'friction.coefficient',...
|
---|
| 635 | + 'materials.rheology_B',...
|
---|
| 636 | + 'mask.ice_levelset',...
|
---|
| 637 | + 'mask.groundedice_levelset',...
|
---|
| 638 | + 'slr.deltathickness'...
|
---|
| 639 | + };
|
---|
| 640 | +
|
---|
| 641 | + if issealevel(),
|
---|
| 642 | + if isearth,
|
---|
| 643 | + mask=md.earth.mask;
|
---|
| 644 | + else
|
---|
| 645 | + mask=md.icecaps{1}.mask;
|
---|
| 646 | + end
|
---|
| 647 | + else
|
---|
| 648 | + mask=md.mask;
|
---|
| 649 | + end
|
---|
| 650 | +
|
---|
| 651 | + if strcmpi(class(mask),'maskpsl'),
|
---|
| 652 | + fields{end+1}='mask.ocean_levelset';
|
---|
| 653 | + fields{end+1}='mask.land_levelset';
|
---|
| 654 | + end
|
---|
| 655 | +
|
---|
| 656 | +
|
---|
| 657 | +% }}}
|
---|
| 658 | +set(hObject,'String',fields);
|
---|
| 659 | +% Hint: popupmenu controls usually have a white background on Windows.
|
---|
| 660 | +% See ISPC and COMPUTER.
|
---|
| 661 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 662 | + set(hObject,'BackgroundColor','white');
|
---|
| 663 | +end
|
---|
| 664 | +% }}}
|
---|
| 665 | +%Mf button: {{{
|
---|
| 666 | +% --- Executes on button press in Mf.
|
---|
| 667 | +function Mf_CreateFcn(varargin)
|
---|
| 668 | +function Mf_Callback(hObject, eventdata, handles)
|
---|
| 669 | +% hObject handle to Mf (see GCBO)
|
---|
| 670 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 671 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 672 | +plotm();
|
---|
| 673 | +% Hint: get(hObject,'Value') returns toggle state of Mf
|
---|
| 674 | +%}}}
|
---|
| 675 | +%Solution menu {{{
|
---|
| 676 | +% --- Executes on selection change in popupmenu10.
|
---|
| 677 | +function popupmenu10_Callback(hObject, eventdata, handles)
|
---|
| 678 | +global solutiontype
|
---|
| 679 | +% hObject handle to popupmenu10 (see GCBO)
|
---|
| 680 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 681 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 682 | +
|
---|
| 683 | +%figure out what results we are plotting here:
|
---|
| 684 | +value=get(hObject,'Value');
|
---|
| 685 | +strings=get(hObject,'String');
|
---|
| 686 | +solutiontype=strings(value);
|
---|
| 687 | +
|
---|
| 688 | +plotm();
|
---|
| 689 | +% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu10 contents as cell array
|
---|
| 690 | +% contents{get(hObject,'Value')} returns selected item from popupmenu10
|
---|
| 691 | +
|
---|
| 692 | +% --- Executes during object creation, after setting all properties.
|
---|
| 693 | +function popupmenu10_CreateFcn(hObject, eventdata, handles)
|
---|
| 694 | +global md solutiontype
|
---|
| 695 | +% hObject handle to popupmenu10 (see GCBO)
|
---|
| 696 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 697 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 698 | +if issealevel,
|
---|
| 699 | + if isearth,
|
---|
| 700 | + resultfields=fields(md.earth.results);
|
---|
| 701 | + else
|
---|
| 702 | + resultfields=fields(md.icecaps{1}.results);
|
---|
| 703 | + end
|
---|
| 704 | +else
|
---|
| 705 | + resultfields=fields(md.results);
|
---|
| 706 | +end
|
---|
| 707 | +if isempty(resultfields),
|
---|
| 708 | + resultfields={'None'};
|
---|
| 709 | +end
|
---|
| 710 | +
|
---|
| 711 | +%default solution:
|
---|
| 712 | +for i=1:length(resultfields),
|
---|
| 713 | + solutiontype=resultfields{i};
|
---|
| 714 | + if strcmpi(solutiontype,'StressbalanceSolution'),
|
---|
| 715 | + i0=i;
|
---|
| 716 | + break;
|
---|
| 717 | + elseif strcmpi(solutiontype,'StressbalanceSolution'),
|
---|
| 718 | + i0=i;
|
---|
| 719 | + break;
|
---|
| 720 | + else
|
---|
| 721 | + i0=1;
|
---|
| 722 | + end
|
---|
| 723 | +end
|
---|
| 724 | +set(hObject,'String',resultfields);
|
---|
| 725 | +set(hObject,'Value',i0);
|
---|
| 726 | +
|
---|
| 727 | +% Hint: popupmenu controls usually have a white background on Windows.
|
---|
| 728 | +% See ISPC and COMPUTER.
|
---|
| 729 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 730 | + set(hObject,'BackgroundColor','white');
|
---|
| 731 | +end
|
---|
| 732 | +% }}}
|
---|
| 733 | +%Icecaps menu: {{{
|
---|
| 734 | +% --- Executes on selection change in popupmenu11.
|
---|
| 735 | +function popupmenu11_Callback(hObject, eventdata, handles)
|
---|
| 736 | +global md
|
---|
| 737 | +% hObject handle to popupmenu11 (see GCBO)
|
---|
| 738 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 739 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 740 | +strings=get(hObject,'String');
|
---|
| 741 | +value=get(hObject,'Value');
|
---|
| 742 | +continent=strings{value};
|
---|
| 743 | +
|
---|
| 744 | +%update basin list:
|
---|
| 745 | +basins=md.basinsfromcontinent(continent);
|
---|
| 746 | +strings={'All',basins{:}};
|
---|
| 747 | +obj=findobj('Tag', 'popupmenu12');
|
---|
| 748 | +set(obj,'String',strings');
|
---|
| 749 | +set(obj,'Value',1);
|
---|
| 750 | +
|
---|
| 751 | +plotm();
|
---|
| 752 | +% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu11 contents as cell array
|
---|
| 753 | +% contents{get(hObject,'Value')} returns selected item from popupmenu11
|
---|
| 754 | +
|
---|
| 755 | +
|
---|
| 756 | +% --- Executes during object creation, after setting all properties.
|
---|
| 757 | +function popupmenu11_CreateFcn(hObject, eventdata, handles)
|
---|
| 758 | +% hObject handle to popupmenu11 (see GCBO)
|
---|
| 759 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 760 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 761 | +global md range;
|
---|
| 762 | +
|
---|
| 763 | +if issealevel(),
|
---|
| 764 | + strings=md.continents();
|
---|
| 765 | + set(hObject,'String',strings);
|
---|
| 766 | + set(hObject,'Value',1);
|
---|
| 767 | +else
|
---|
| 768 | + set(hObject,'String',{});
|
---|
| 769 | + set(hObject,'Value',1);
|
---|
| 770 | +end
|
---|
| 771 | +
|
---|
| 772 | +
|
---|
| 773 | +% Hint: popupmenu controls usually have a white background on Windows.
|
---|
| 774 | +% See ISPC and COMPUTER.
|
---|
| 775 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 776 | + set(hObject,'BackgroundColor','white');
|
---|
| 777 | +end
|
---|
| 778 | +% }}}
|
---|
| 779 | +%Basins menu{{{
|
---|
| 780 | +% --- Executes on selection change in popupmenu12.
|
---|
| 781 | +function popupmenu12_Callback(hObject, eventdata, handles)
|
---|
| 782 | +global md
|
---|
| 783 | +% hObject handle to popupmenu12 (see GCBO)
|
---|
| 784 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 785 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 786 | +
|
---|
| 787 | +plotm();
|
---|
| 788 | +% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu12 contents as cell array
|
---|
| 789 | +% contents{get(hObject,'Value')} returns selected item from popupmenu12
|
---|
| 790 | +
|
---|
| 791 | +% --- Executes during object creation, after setting all properties.
|
---|
| 792 | +function popupmenu12_CreateFcn(hObject, eventdata, handles)
|
---|
| 793 | +global md
|
---|
| 794 | +% hObject handle to popupmenu12 (see GCBO)
|
---|
| 795 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 796 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 797 | +
|
---|
| 798 | +if issealevel(),
|
---|
| 799 | +
|
---|
| 800 | + %need the continent name: default first one.
|
---|
| 801 | + continents=md.continents();
|
---|
| 802 | + basins=md.basinsfromcontinent(continents{1});
|
---|
| 803 | + strings={'All',basins{:}};
|
---|
| 804 | + set(hObject,'String',strings);
|
---|
| 805 | + set(hObject,'Value',1);
|
---|
| 806 | +else
|
---|
| 807 | + set(hObject,'String',{});
|
---|
| 808 | + set(hObject,'Value',1);
|
---|
| 809 | +end
|
---|
| 810 | +% Hint: popupmenu controls usually have a white background on Windows.
|
---|
| 811 | +% See ISPC and COMPUTER.
|
---|
| 812 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 813 | + set(hObject,'BackgroundColor','white');
|
---|
| 814 | +end
|
---|
| 815 | +% }}}
|
---|
| 816 | +%Comparison: {{{
|
---|
| 817 | +
|
---|
| 818 | +% --- Executes on button press in radiobutton17.
|
---|
| 819 | +function radiobutton17_Callback(hObject, eventdata, handles)
|
---|
| 820 | +global comparison
|
---|
| 821 | +% hObject handle to radiobutton17 (see GCBO)
|
---|
| 822 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 823 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 824 | +comparison=get(hObject,'Value');
|
---|
| 825 | +plotm();
|
---|
| 826 | +% Hint: get(hObject,'Value') returns toggle state of radiobutton17
|
---|
| 827 | +% }}}
|
---|
| 828 | +%Earth button: {{{
|
---|
| 829 | +
|
---|
| 830 | +% --- Executes on button press in radiobutton18.
|
---|
| 831 | +function radiobutton18_Callback(hObject, eventdata, handles)
|
---|
| 832 | +% hObject handle to radiobutton18 (see GCBO)
|
---|
| 833 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 834 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 835 | +global md earth
|
---|
| 836 | +earth=get(hObject,'value');
|
---|
| 837 | +
|
---|
| 838 | +%Change Field:
|
---|
| 839 | +if issealevel, if isearth, results=md.earth.results; else results=md.icecaps{1}.results; end; else results=md.results; end;
|
---|
| 840 | +fieldHandle=findobj('Tag', 'Field');
|
---|
| 841 | +if isfield(results,'TransientSolution'),
|
---|
| 842 | + fieldss=listfields(results,'TransientSolution');
|
---|
| 843 | + set(fieldHandle,'String',fieldss);
|
---|
| 844 | + set(fieldHandle,'Value',1);
|
---|
| 845 | +else
|
---|
| 846 | + set(fieldHandle,'String',{});
|
---|
| 847 | + set(fieldHandle,'Value',1);
|
---|
| 848 | +end
|
---|
| 849 | +
|
---|
| 850 | +%Change Masque:
|
---|
| 851 | +if issealevel,
|
---|
| 852 | + if isearth,
|
---|
| 853 | + mv=md.earth.mask;
|
---|
| 854 | + else
|
---|
| 855 | + mv=md.icecaps{1}.mask;
|
---|
| 856 | + end
|
---|
| 857 | +else
|
---|
| 858 | + mv=md.mask;
|
---|
| 859 | +end
|
---|
| 860 | +fieldHandle=findobj('Tag', 'Masque');
|
---|
| 861 | +strings=fields(mv);
|
---|
| 862 | +strings={'all',strings{:}};
|
---|
| 863 | +set(fieldHandle,'String',strings);
|
---|
| 864 | +
|
---|
| 865 | +plotm();
|
---|
| 866 | +% Hint: get(hObject,'Value') returns toggle state of radiobutton18
|
---|
| 867 | +% --- Executes during object creation, after setting all properties.
|
---|
| 868 | +function radiobutton18_CreateFcn(hObject, eventdata, handles)
|
---|
| 869 | +% hObject handle to radiobutton18 (see GCBO)
|
---|
| 870 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 871 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 872 | +global earth
|
---|
| 873 | +earth=1;
|
---|
| 874 | +set(hObject,'Value',earth);
|
---|
| 875 | +%}}}
|
---|
| 876 | +%Reload model: {{{
|
---|
| 877 | +% --- Executes on button press in pushbutton1.
|
---|
| 878 | +function pushbutton1_Callback(hObject, eventdata, handles)
|
---|
| 879 | +% hObject handle to pushbutton1 (see GCBO)
|
---|
| 880 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 881 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 882 | +global reload
|
---|
| 883 | +reload=1;
|
---|
| 884 | +plotm();
|
---|
| 885 | +%}}}
|
---|
| 886 | +%Scalar {{{
|
---|
| 887 | +function Scalar_Callback(hObject, eventdata, handles)
|
---|
| 888 | +% hObject handle to Scalar (see GCBO)
|
---|
| 889 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 890 | +% handles structure with handles and user data (see GUIDATA)
|
---|
| 891 | +
|
---|
| 892 | +% Hints: get(hObject,'String') returns contents of Scalar as text
|
---|
| 893 | +% str2double(get(hObject,'String')) returns contents of Scalar as a double
|
---|
| 894 | +
|
---|
| 895 | +% --- Executes during object creation, after setting all properties.
|
---|
| 896 | +function Scalar_CreateFcn(hObject, eventdata, handles)
|
---|
| 897 | +% hObject handle to Scalar (see GCBO)
|
---|
| 898 | +% eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 899 | +% handles empty - handles not created until after all CreateFcns called
|
---|
| 900 | +
|
---|
| 901 | +% Hint: edit controls usually have a white background on Windows.
|
---|
| 902 | +% See ISPC and COMPUTER.
|
---|
| 903 | +
|
---|
| 904 | + scalarHandle=findobj('Tag', 'Scalar');
|
---|
| 905 | + set(scalarHandle,'String',sprintf('%4.2f',NaN));
|
---|
| 906 | +
|
---|
| 907 | + if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
---|
| 908 | + set(hObject,'BackgroundColor','white');
|
---|
| 909 | + end
|
---|
| 910 | +% }}}
|
---|
| 911 | +function plotv() % {{{
|
---|
| 912 | + global md range
|
---|
| 913 | +
|
---|
| 914 | + %field: % {{{
|
---|
| 915 | + fieldHandle=findobj('Tag', 'Field');
|
---|
| 916 | + fieldstrings=get(fieldHandle,'String');
|
---|
| 917 | + fieldvalue=get(fieldHandle,'Value');
|
---|
| 918 | + field=fieldstrings{fieldvalue};
|
---|
| 919 | + %}}}
|
---|
| 920 | + %lock limits: % {{{
|
---|
| 921 | + lockHandle=findobj('Tag', 'Lock'); lockvalue=get(lockHandle,'Value');
|
---|
| 922 | + if lockvalue,
|
---|
| 923 | + xl=xlim; yl=ylim;
|
---|
| 924 | + end
|
---|
| 925 | + %}}}
|
---|
| 926 | +
|
---|
| 927 | + cla, reset(gca);
|
---|
| 928 | + hold on ;
|
---|
| 929 | + if issealevel,
|
---|
| 930 | + if isearth,
|
---|
| 931 | + %do nothing. no ice volume.
|
---|
| 932 | + else
|
---|
| 933 | + dt=md.earth.timestepping.time_step*md.earth.settings.output_frequency;
|
---|
| 934 | + for j=1:length(range),
|
---|
| 935 | + i=range(j);
|
---|
| 936 | + vols=resultstomatrix(md.icecaps{i},'TransientSolution',field);
|
---|
| 937 | + if j==1,
|
---|
| 938 | + volst=vols;
|
---|
| 939 | + else
|
---|
| 940 | + volst(1,:)=volst(1,:)+vols(1,:);
|
---|
| 941 | + end
|
---|
| 942 | + end
|
---|
| 943 | + s1=subplot(2,1,1);
|
---|
| 944 | + set(s1,'Position',[0.3300 0.6100 0.4750 0.3]);
|
---|
| 945 | + plot(volst(2,:),(volst(1,:)-volst(1,1))*md.icecaps{1}.materials.rho_ice/1e12);
|
---|
| 946 | + xlabel('time (yr)'); ylabel('Mass (Gt)'); colorbar off;
|
---|
| 947 | + if lockvalue, xlim(xl), ylim(yl); end
|
---|
| 948 | +
|
---|
| 949 | + s2=subplot(2,1,2);
|
---|
| 950 | + set(s2,'Position',[0.3300 0.1100 0.4750 0.3]);
|
---|
| 951 | + dv=diff(volst(1,:))/dt;
|
---|
| 952 | + plot(volst(2,1:end-1),dv*md.icecaps{1}.materials.rho_ice/1e12);
|
---|
| 953 | + xlabel('time (yr)'); ylabel('Mass (Gt)'); colorbar off;
|
---|
| 954 | + if lockvalue, xlim(xl), ylim(yl); end
|
---|
| 955 | + end
|
---|
| 956 | + else
|
---|
| 957 | + dt=md.timestepping.time_step*md.settings.output_frequency;
|
---|
| 958 | + vols=resultstomatrix(md,'TransientSolution',field);
|
---|
| 959 | + dv=diff(vols(1,:))/dt;
|
---|
| 960 | +
|
---|
| 961 | + s1=subplot(2,1,1);
|
---|
| 962 | + set(s1,'Position',[0.3300 0.6100 0.4750 0.3]);
|
---|
| 963 | + xlabel('time (yr)'); ylabel('Mass (Gt)'); colorbar off;
|
---|
| 964 | + plot(vols(2,:),(vols(1,:)-vols(1,1))*md.materials.rho_ice/1e12);
|
---|
| 965 | + if lockvalue, xlim(xl), ylim(yl); end
|
---|
| 966 | +
|
---|
| 967 | + s2=subplot(2,1,2);
|
---|
| 968 | + set(s2,'Position',[0.3300 0.1100 0.4750 0.3]);
|
---|
| 969 | + xlabel('time (yr)'); ylabel('Mass (Gt)'); colorbar off;
|
---|
| 970 | + plot(vols(2,1:end-1),dv*md.materials.rho_ice/1e12);
|
---|
| 971 | + if lockvalue, xlim(xl), ylim(yl); end
|
---|
| 972 | + end
|
---|
| 973 | +%}}}
|
---|
| 974 | +function displayscalar() % {{{
|
---|
| 975 | + global md range
|
---|
| 976 | +
|
---|
| 977 | + %field: % {{{
|
---|
| 978 | + fieldHandle=findobj('Tag', 'Field');
|
---|
| 979 | + fieldstrings=get(fieldHandle,'String');
|
---|
| 980 | + fieldvalue=get(fieldHandle,'Value');
|
---|
| 981 | + field=fieldstrings{fieldvalue};
|
---|
| 982 | + %}}}
|
---|
| 983 | + %counter: % {{{
|
---|
| 984 | + stepHandle=findobj('Tag', 'Step');
|
---|
| 985 | + stepstrings=get(stepHandle,'String');
|
---|
| 986 | + stepvalue=get(stepHandle,'Value');
|
---|
| 987 | + if ~isempty(stepstrings),
|
---|
| 988 | + stepstring=stepstrings{stepvalue};
|
---|
| 989 | + %grab second integer:
|
---|
| 990 | + A=sscanf(stepstring,'%g (%i)'); counter=A(2);
|
---|
| 991 | + else
|
---|
| 992 | + counter=1;
|
---|
| 993 | + end
|
---|
| 994 | + %}}}
|
---|
| 995 | +
|
---|
| 996 | +
|
---|
| 997 | + if issealevel,
|
---|
| 998 | + if isearth,
|
---|
| 999 | + if strcmpi(field,'SealevelRSLEustatic'),
|
---|
| 1000 | + dt=md.earth.timestepping.time_step*md.earth.slr.geodetic_run_frequency;
|
---|
| 1001 | + eus=md.earth.results.TransientSolution(counter-1).(field)/dt*1000; %in mm/yr
|
---|
| 1002 | + scalarHandle=findobj('Tag', 'Scalar');
|
---|
| 1003 | + set(scalarHandle,'String',sprintf('%4.5f mm/yr',eus));
|
---|
| 1004 | + end
|
---|
| 1005 | + else
|
---|
| 1006 | + error('not supported yet!');
|
---|
| 1007 | + end
|
---|
| 1008 | + end
|
---|
| 1009 | +%}}}
|
---|
| 1010 | +function plotm() % {{{
|
---|
| 1011 | +
|
---|
| 1012 | + %retrieve field:
|
---|
| 1013 | + hObject=findobj('Tag', 'Field');
|
---|
| 1014 | + strings=get(hObject,'String'); value=get(hObject,'Value');
|
---|
| 1015 | +
|
---|
| 1016 | + string='';
|
---|
| 1017 | + if value,
|
---|
| 1018 | + if ~isempty(strings),
|
---|
| 1019 | + string=strings(value);
|
---|
| 1020 | + end
|
---|
| 1021 | + end
|
---|
| 1022 | +
|
---|
| 1023 | + if strcmpi(string,'IceVolume') | strcmpi(string,'IceVolumeAboveFloatation'),
|
---|
| 1024 | + plotv();
|
---|
| 1025 | + elseif strcmpi(string,'SealevelRSLEustatic'),
|
---|
| 1026 | + displayscalar();
|
---|
| 1027 | + else
|
---|
| 1028 | + if issealevel(),
|
---|
| 1029 | + plotsl();
|
---|
| 1030 | + else
|
---|
| 1031 | + plotmd();
|
---|
| 1032 | + end
|
---|
| 1033 | + end
|
---|
| 1034 | +%}}}
|
---|
| 1035 | + function plotmd() % {{{
|
---|
| 1036 | + global logvalue md solutiontype comparison
|
---|
| 1037 | +
|
---|
| 1038 | + %counter: % {{{
|
---|
| 1039 | + stepHandle=findobj('Tag', 'Step');
|
---|
| 1040 | + stepstrings=get(stepHandle,'String');
|
---|
| 1041 | + stepvalue=get(stepHandle,'Value');
|
---|
| 1042 | + if ~isempty(stepstrings),
|
---|
| 1043 | + stepstring=stepstrings{stepvalue};
|
---|
| 1044 | + %grab second integer:
|
---|
| 1045 | + A=sscanf(stepstring,'%g (%i)'); counter=A(2);
|
---|
| 1046 | + else
|
---|
| 1047 | + counter=1;
|
---|
| 1048 | + end
|
---|
| 1049 | + %}}}
|
---|
| 1050 | + %log: % {{{
|
---|
| 1051 | + logHandle=findobj('Tag', 'Log'); logvalue=get(logHandle,'Value');
|
---|
| 1052 | + %}}}
|
---|
| 1053 | + %shading: %{{{
|
---|
| 1054 | + interpHandle=findobj('Tag', 'Interp'); interpvalue=get(interpHandle,'Value');
|
---|
| 1055 | + flatHandle=findobj('Tag', 'Flat'); flatvalue=get(flatHandle,'Value');
|
---|
| 1056 | + facetedHandle=findobj('Tag', 'Faceted'); facetedvalue=get(facetedHandle,'Value');
|
---|
| 1057 | + if interpvalue,
|
---|
| 1058 | + shadingv='interp';
|
---|
| 1059 | + elseif flatvalue,
|
---|
| 1060 | + shadingv='flat';
|
---|
| 1061 | + elseif facetedvalue,
|
---|
| 1062 | + shadingv='faceted';
|
---|
| 1063 | + else
|
---|
| 1064 | + shadingv='interp';
|
---|
| 1065 | + end
|
---|
| 1066 | + %}}}
|
---|
| 1067 | + %mask: %{{{
|
---|
| 1068 | + maskfieldHandle=findobj('Tag', 'Masque');
|
---|
| 1069 | + maskfieldstrings=get(maskfieldHandle,'String');
|
---|
| 1070 | + maskfieldvalue=get(maskfieldHandle,'Value');
|
---|
| 1071 | + maskfield=maskfieldstrings(maskfieldvalue);
|
---|
| 1072 | + maskfield=maskfield{:};
|
---|
| 1073 | + if strcmpi(maskfield,'all'),
|
---|
| 1074 | + maskv=ones(md.mesh.numberofvertices,1);
|
---|
| 1075 | + else
|
---|
| 1076 | + maskv=md.mask.(maskfield);
|
---|
| 1077 | + end
|
---|
| 1078 | + if strcmpi(maskfield,'all'),
|
---|
| 1079 | + %do nothing;
|
---|
| 1080 | + elseif strcmpi(maskfield,'groundedice_levelset'),
|
---|
| 1081 | + maskv=maskv>=0;
|
---|
| 1082 | + elseif strcmpi(maskfield,'ice_levelset'),
|
---|
| 1083 | + maskv=maskv<=0;
|
---|
| 1084 | + elseif strcmpi(maskfield,'ocean_levelset'),
|
---|
| 1085 | + maskv=maskv==1;
|
---|
| 1086 | + elseif strcmpi(maskfield,'land_levelset'),
|
---|
| 1087 | + maskv=maskv==1;
|
---|
| 1088 | + elseif strcmpi(maskfield,'glacier_levelset'),
|
---|
| 1089 | + if isnan(maskv),
|
---|
| 1090 | + maskv=ones(md.mesh.numberofvertices,1);
|
---|
| 1091 | + else
|
---|
| 1092 | + maskv=maskv==1;
|
---|
| 1093 | + end
|
---|
| 1094 | + end
|
---|
| 1095 | + maskvalue=0;
|
---|
| 1096 | + %}}}
|
---|
| 1097 | + %lock limits: % {{{
|
---|
| 1098 | + lockHandle=findobj('Tag', 'Lock'); lockvalue=get(lockHandle,'Value');
|
---|
| 1099 | + if lockvalue,
|
---|
| 1100 | + xl=xlim; yl=ylim;
|
---|
| 1101 | + else
|
---|
| 1102 | + xl=[min(md.mesh.x) max(md.mesh.x)];
|
---|
| 1103 | + yl=[min(md.mesh.y) max(md.mesh.y)];
|
---|
| 1104 | + end %}}}
|
---|
| 1105 | + %time: {{{
|
---|
| 1106 | + timeHandle=findobj('Tag','Time');
|
---|
| 1107 | + if strcmpi(solutiontype,'TransientSolution'),
|
---|
| 1108 | + set(timeHandle,'String',sprintf('%4.2f',md.results.TransientSolution(counter).time));
|
---|
| 1109 | + else
|
---|
| 1110 | + set(timeHandle,'String',sprintf('%4.2f',0));
|
---|
| 1111 | + end
|
---|
| 1112 | + %}}}
|
---|
| 1113 | + %diffcounter: % {{{
|
---|
| 1114 | + stepHandle=findobj('Tag', 'DiffStep');
|
---|
| 1115 | + stepstrings=get(stepHandle,'String');
|
---|
| 1116 | + stepvalue=get(stepHandle,'Value');
|
---|
| 1117 | + if ~isempty(stepstrings),
|
---|
| 1118 | + stepstring=stepstrings{stepvalue};
|
---|
| 1119 | + %grab second integer:
|
---|
| 1120 | + A=sscanf(stepstring,'%g (%i)'); diffcounter=A(2);
|
---|
| 1121 | + else
|
---|
| 1122 | + diffcounter=1;
|
---|
| 1123 | + end
|
---|
| 1124 | + diffHandle=findobj('Tag', 'Diff');
|
---|
| 1125 | + diff=get(diffHandle,'Value');
|
---|
| 1126 | + %}}}
|
---|
| 1127 | + %field: % {{{
|
---|
| 1128 | + fieldHandle=findobj('Tag', 'Field');
|
---|
| 1129 | + fieldstrings=get(fieldHandle,'String');
|
---|
| 1130 | + fieldvalue=get(fieldHandle,'Value');
|
---|
| 1131 | + if ~isempty(fieldstrings),
|
---|
| 1132 | + fieldv=fieldstrings{fieldvalue};
|
---|
| 1133 | + else
|
---|
| 1134 | + fieldv=NaN;
|
---|
| 1135 | + end
|
---|
| 1136 | + mfHandle=findobj('Tag', 'Mf');
|
---|
| 1137 | + mf=get(mfHandle,'Value');
|
---|
| 1138 | + if mf | strcmpi(solutiontype,'None'),
|
---|
| 1139 | + fieldHandle=findobj('Tag', 'ModelFields');
|
---|
| 1140 | + fieldstrings=get(fieldHandle,'String');
|
---|
| 1141 | + fieldvalue=get(fieldHandle,'Value');
|
---|
| 1142 | + fieldv=fieldstrings{fieldvalue};
|
---|
| 1143 | + eval(['field=md.' fieldv ';']);
|
---|
| 1144 | + if isnan(field),
|
---|
| 1145 | + field='mesh';
|
---|
| 1146 | + end
|
---|
| 1147 | + else
|
---|
| 1148 | + if strcmpi(solutiontype,'TransientSolution'),
|
---|
| 1149 | + field=md.results.TransientSolution(counter).(fieldv);
|
---|
| 1150 | + dfield=md.results.TransientSolution(diffcounter).(fieldv);
|
---|
| 1151 | + elseif strcmpi(solutiontype,'StressbalanceSolution'),
|
---|
| 1152 | + field=md.results.StressbalanceSolution.(fieldv);
|
---|
| 1153 | + dfield=NaN;
|
---|
| 1154 | + else
|
---|
| 1155 | + error('unknown solution type!');
|
---|
| 1156 | + end
|
---|
| 1157 | + end
|
---|
| 1158 | + if comparison,
|
---|
| 1159 | + if strcmpi(solutiontype,'None'),
|
---|
| 1160 | + error('cannot compare a solution field to model as no solution was run or selected!');
|
---|
| 1161 | + end
|
---|
| 1162 | + %figure out second field:
|
---|
| 1163 | + if strcmpi(fieldv,'Vel'),
|
---|
| 1164 | + field2=md.inversion.vel_obs;
|
---|
| 1165 | + end
|
---|
| 1166 | + end
|
---|
| 1167 | +
|
---|
| 1168 | + %}}}
|
---|
| 1169 | + %color limits: % {{{
|
---|
| 1170 | + cminHandle=findobj('Tag','Cmin'); cmin=str2num(get(cminHandle,'String'));
|
---|
| 1171 | + cmaxHandle=findobj('Tag','Cmax'); cmax=str2num(get(cmaxHandle,'String'));
|
---|
| 1172 | +
|
---|
| 1173 | + if isnan(cmin)
|
---|
| 1174 | + if logvalue,
|
---|
| 1175 | + cmin=.1;
|
---|
| 1176 | + else
|
---|
| 1177 | + pos=find(maskv);
|
---|
| 1178 | + cmin=min(field(pos));
|
---|
| 1179 | + end
|
---|
| 1180 | + end
|
---|
| 1181 | + if isnan(cmax)
|
---|
| 1182 | + pos=find(maskv);
|
---|
| 1183 | + cmax=max(field(pos));
|
---|
| 1184 | + end
|
---|
| 1185 | + colaxis=[cmin,cmax];
|
---|
| 1186 | + %}}}
|
---|
| 1187 | +
|
---|
| 1188 | + cla;
|
---|
| 1189 | + if logvalue,
|
---|
| 1190 | + plotmodel(md,'data',field,'figurestatement','off','clf','off','mask',maskv,'caxis',colaxis,'log',10,'xlim',xl,'ylim',yl,'shading',shadingv);
|
---|
| 1191 | + else
|
---|
| 1192 | + if ~diff,
|
---|
| 1193 | + if comparison,
|
---|
| 1194 | + plotmodel(md,'data',field,'data',field2,'figurestatement','off','clf','off','mask#all',maskv,'caxis#all',colaxis,'xlim#all',xl,'ylim#all',yl,'shading#all',shadingv,'nlines',2,'ncols',1);
|
---|
| 1195 | + else
|
---|
| 1196 | + if ischar(field) & strcmpi(field,'mesh'),
|
---|
| 1197 | + plotmodel(md,'data','mesh','figurestatement','off','clf','off','xlim',xl,'ylim',yl);
|
---|
| 1198 | + else
|
---|
| 1199 | + plotmodel(md,'data',field,'figurestatement','off','clf','off','mask',maskv,'caxis',colaxis,'xlim',xl,'ylim',yl,'shading',shadingv);
|
---|
| 1200 | + end
|
---|
| 1201 | + end
|
---|
| 1202 | + else
|
---|
| 1203 | + plotmodel(md,'data',dfield-field,'figurestatement','off','clf','off','mask',maskv,'caxis',colaxis,'xlim',xl,'ylim',yl,'shading',shadingv);
|
---|
| 1204 | + end
|
---|
| 1205 | +
|
---|
| 1206 | + end
|
---|
| 1207 | + set(gca,'Position',[0.2300 0.1100 0.7750 0.8150]);
|
---|
| 1208 | + %}}}
|
---|
| 1209 | +function plotsl() % {{{
|
---|
| 1210 | + global logvalue md solutiontype comparison
|
---|
| 1211 | +
|
---|
| 1212 | + %counter: % {{{
|
---|
| 1213 | + stepHandle=findobj('Tag', 'Step');
|
---|
| 1214 | + stepstrings=get(stepHandle,'String');
|
---|
| 1215 | + stepvalue=get(stepHandle,'Value');
|
---|
| 1216 | + if ~isempty(stepstrings),
|
---|
| 1217 | + stepstring=stepstrings{stepvalue};
|
---|
| 1218 | + %grab second integer:
|
---|
| 1219 | + A=sscanf(stepstring,'%g (%i)'); counter=A(2);
|
---|
| 1220 | + else
|
---|
| 1221 | + counter=1;
|
---|
| 1222 | + end
|
---|
| 1223 | + %}}}
|
---|
| 1224 | + %log: % {{{
|
---|
| 1225 | + logHandle=findobj('Tag', 'Log'); logvalue=get(logHandle,'Value');
|
---|
| 1226 | + %}}}
|
---|
| 1227 | + %shading: %{{{
|
---|
| 1228 | + interpHandle=findobj('Tag', 'Interp'); interpvalue=get(interpHandle,'Value');
|
---|
| 1229 | + flatHandle=findobj('Tag', 'Flat'); flatvalue=get(flatHandle,'Value');
|
---|
| 1230 | + facetedHandle=findobj('Tag', 'Faceted'); facetedvalue=get(facetedHandle,'Value');
|
---|
| 1231 | + if interpvalue,
|
---|
| 1232 | + shadingv='interp';
|
---|
| 1233 | + elseif flatvalue,
|
---|
| 1234 | + shadingv='flat';
|
---|
| 1235 | + elseif facetedvalue,
|
---|
| 1236 | + shadingv='faceted';
|
---|
| 1237 | + else
|
---|
| 1238 | + shadingv='interp';
|
---|
| 1239 | + end
|
---|
| 1240 | + %}}}
|
---|
| 1241 | + %time: {{{
|
---|
| 1242 | + timeHandle=findobj('Tag','Time');
|
---|
| 1243 | + if strcmpi(solutiontype,'TransientSolution'),
|
---|
| 1244 | + if isearth,
|
---|
| 1245 | + set(timeHandle,'String',sprintf('%4.2f',md.earth.results.TransientSolution(counter).time));
|
---|
| 1246 | + else
|
---|
| 1247 | + set(timeHandle,'String',sprintf('%4.2f',md.icecaps{1}.results.TransientSolution(counter).time));
|
---|
| 1248 | + end
|
---|
| 1249 | + else
|
---|
| 1250 | + set(timeHandle,'String',sprintf('%4.2f',0));
|
---|
| 1251 | + end
|
---|
| 1252 | + %}}}
|
---|
| 1253 | + %diffcounter: % {{{
|
---|
| 1254 | + stepHandle=findobj('Tag', 'DiffStep');
|
---|
| 1255 | + stepstrings=get(stepHandle,'String');
|
---|
| 1256 | + stepvalue=get(stepHandle,'Value');
|
---|
| 1257 | + if ~isempty(stepstrings),
|
---|
| 1258 | + stepstring=stepstrings{stepvalue};
|
---|
| 1259 | + %grab second integer:
|
---|
| 1260 | + A=sscanf(stepstring,'%g (%i)'); diffcounter=A(2);
|
---|
| 1261 | + else
|
---|
| 1262 | + diffcounter=1;
|
---|
| 1263 | + end
|
---|
| 1264 | + diffHandle=findobj('Tag', 'Diff');
|
---|
| 1265 | + diff=get(diffHandle,'Value');
|
---|
| 1266 | + %}}}
|
---|
| 1267 | +
|
---|
| 1268 | + if isearth,
|
---|
| 1269 | + %Earth plotting: {{{
|
---|
| 1270 | + %field: % {{{
|
---|
| 1271 | + fieldHandle=findobj('Tag', 'Field');
|
---|
| 1272 | + fieldstrings=get(fieldHandle,'String');
|
---|
| 1273 | + fieldvalue=get(fieldHandle,'Value');
|
---|
| 1274 | + if ~isempty(fieldstrings),
|
---|
| 1275 | + fieldv=fieldstrings{fieldvalue};
|
---|
| 1276 | + else
|
---|
| 1277 | + fieldv=NaN;
|
---|
| 1278 | + end
|
---|
| 1279 | + colorbartitle={fieldv,''};
|
---|
| 1280 | + if strcmpi(fieldv,'SealevelRSLRate'),
|
---|
| 1281 | + colorbartitle={'SealevelRSLRate (mm/yr)',''};
|
---|
| 1282 | + end
|
---|
| 1283 | +
|
---|
| 1284 | + mfHandle=findobj('Tag', 'Mf');
|
---|
| 1285 | + mf=get(mfHandle,'Value');
|
---|
| 1286 | + if mf | strcmpi(solutiontype,'None'),
|
---|
| 1287 | + fieldHandle=findobj('Tag', 'ModelFields');
|
---|
| 1288 | + fieldstrings=get(fieldHandle,'String');
|
---|
| 1289 | + fieldvalue=get(fieldHandle,'Value');
|
---|
| 1290 | + fieldv=fieldstrings{fieldvalue};
|
---|
| 1291 | + eval(['field=md.earth.' fieldv ';']);
|
---|
| 1292 | + if isnan(field),
|
---|
| 1293 | + field='mesh';
|
---|
| 1294 | + end
|
---|
| 1295 | + else
|
---|
| 1296 | + if strcmpi(solutiontype,'TransientSolution'),
|
---|
| 1297 | + field=md.earth.results.TransientSolution(counter).(fieldv);
|
---|
| 1298 | + dfield=md.earth.results.TransientSolution(diffcounter).(fieldv);
|
---|
| 1299 | + elseif strcmpi(solutiontype,'StressbalanceSolution'),
|
---|
| 1300 | + field=md.earth.results.StressbalanceSolution.(fieldv);
|
---|
| 1301 | + dfield=NaN;
|
---|
| 1302 | + else
|
---|
| 1303 | + error('unknown solution type!');
|
---|
| 1304 | + end
|
---|
| 1305 | + end
|
---|
| 1306 | + if comparison,
|
---|
| 1307 | + if strcmpi(solutiontype,'None'),
|
---|
| 1308 | + error('cannot compare a solution field to model as no solution was run or selected!');
|
---|
| 1309 | + end
|
---|
| 1310 | + %figure out second field:
|
---|
| 1311 | + if strcmpi(fieldv,'Vel'), field2=md.earth.inversion.vel_obs; end
|
---|
| 1312 | + if strcmpi(fieldv,'Base'), field2=md.earth.geometry.base; end
|
---|
| 1313 | + end
|
---|
| 1314 | + %}}}
|
---|
| 1315 | + %mask: %{{{
|
---|
| 1316 | + maskfieldHandle=findobj('Tag', 'Masque');
|
---|
| 1317 | + maskfieldstrings=get(maskfieldHandle,'String');
|
---|
| 1318 | + maskfieldvalue=get(maskfieldHandle,'Value');
|
---|
| 1319 | + maskfield=maskfieldstrings(maskfieldvalue);
|
---|
| 1320 | + maskfield=maskfield{:};
|
---|
| 1321 | + if strcmpi(maskfield,'all'),
|
---|
| 1322 | + maskv=ones(md.earth.mesh.numberofvertices,1);
|
---|
| 1323 | + else
|
---|
| 1324 | + maskv=md.earth.mask.(maskfield);
|
---|
| 1325 | + end
|
---|
| 1326 | + if strcmpi(maskfield,'all'),
|
---|
| 1327 | + %do nothing;
|
---|
| 1328 | + elseif strcmpi(maskfield,'groundedice_levelset'),
|
---|
| 1329 | + maskv=maskv>=0;
|
---|
| 1330 | + elseif strcmpi(maskfield,'ice_levelset'),
|
---|
| 1331 | + maskv=maskv<=0;
|
---|
| 1332 | + elseif strcmpi(maskfield,'ocean_levelset'),
|
---|
| 1333 | + maskv=maskv==1;
|
---|
| 1334 | + elseif strcmpi(maskfield,'land_levelset'),
|
---|
| 1335 | + maskv=maskv==1;
|
---|
| 1336 | + elseif strcmpi(maskfield,'glacier_levelset'),
|
---|
| 1337 | + if isnan(maskv),
|
---|
| 1338 | + maskv=ones(md.earth.mesh.numberofvertices,1);
|
---|
| 1339 | + else
|
---|
| 1340 | + maskv=maskv==1;
|
---|
| 1341 | + end
|
---|
| 1342 | + end
|
---|
| 1343 | + maskvalue=0;
|
---|
| 1344 | + %}}}
|
---|
| 1345 | + %color limits: % {{{
|
---|
| 1346 | + if ~ischar(field),
|
---|
| 1347 | + cminHandle=findobj('Tag','Cmin'); cmin=str2num(get(cminHandle,'String'));
|
---|
| 1348 | + cmaxHandle=findobj('Tag','Cmax'); cmax=str2num(get(cmaxHandle,'String'));
|
---|
| 1349 | +
|
---|
| 1350 | + if isnan(cmin)
|
---|
| 1351 | + if logvalue,
|
---|
| 1352 | + cmin=.1;
|
---|
| 1353 | + else
|
---|
| 1354 | + pos=find(maskv);
|
---|
| 1355 | + cmin=min(field(pos));
|
---|
| 1356 | + end
|
---|
| 1357 | + end
|
---|
| 1358 | + if isnan(cmax)
|
---|
| 1359 | + pos=find(maskv);
|
---|
| 1360 | + cmax=max(field(pos));
|
---|
| 1361 | + end
|
---|
| 1362 | +
|
---|
| 1363 | + if cmin==cmax,
|
---|
| 1364 | + colaxis=[cmin-eps,cmax+eps];
|
---|
| 1365 | + else
|
---|
| 1366 | + colaxis=[cmin,cmax];
|
---|
| 1367 | + end
|
---|
| 1368 | + end
|
---|
| 1369 | +
|
---|
| 1370 | + %}}}
|
---|
| 1371 | + %lock limits: % {{{
|
---|
| 1372 | + lockHandle=findobj('Tag', 'Lock'); lockvalue=get(lockHandle,'Value');
|
---|
| 1373 | + if lockvalue,
|
---|
| 1374 | + xl=xlim; yl=ylim; zl=zlim;
|
---|
| 1375 | + [az,el]=view; v=[az,el];
|
---|
| 1376 | + else
|
---|
| 1377 | + xl=[min(md.earth.mesh.x) max(md.earth.mesh.x)];
|
---|
| 1378 | + yl=[min(md.earth.mesh.y) max(md.earth.mesh.y)];
|
---|
| 1379 | + zl=[min(md.earth.mesh.z) max(md.earth.mesh.z)];
|
---|
| 1380 | + v=[57,50];
|
---|
| 1381 | + end %}}}
|
---|
| 1382 | +
|
---|
| 1383 | + %some quirks:
|
---|
| 1384 | + cla;
|
---|
| 1385 | + if logvalue,
|
---|
| 1386 | + plotmodel(md.earth,'data',field,'figurestatement','off','clf','off','mask',maskv,'caxis',colaxis,'log',10,'xlim',xl,'ylim',yl,'zlim',zl,'shading',shadingv,'colorbar','on','view',v,'colorbartitle',colorbartitle);
|
---|
| 1387 | + else
|
---|
| 1388 | + if ~diff,
|
---|
| 1389 | + if comparison,
|
---|
| 1390 | + plotmodel(md.earth,'data',field,'data',field2,'figurestatement','off','clf','off','mask#all',maskv,'caxis#all',colaxis,'xlim#all',xl,'ylim#all',yl,'zlim#all',zl,'shading#all',shadingv,'nlines',2,'ncols',1,'view#all',v,'colorbartitle',colorbartitle);
|
---|
| 1391 | + else
|
---|
| 1392 | + if ischar(field) & strcmpi(field,'mesh'),
|
---|
| 1393 | + plotmodel(md.earth,'data','mesh','figurestatement','off','clf','off','xlim',xl,'ylim',yl,'zlim',zl,'view#all',v,'colorbartitle',colorbartitle);
|
---|
| 1394 | + else
|
---|
| 1395 | + plotmodel(md.earth,'data',field,'figurestatement','off','clf','off','mask',maskv,'maskvalue',maskvalue,'caxis',colaxis,'xlim',xl,'ylim',yl,'zlim',zl,'shading',shadingv,'axes','equal','colorbarpos',[.95 .5 .01 .15],'view#all',v,'colorbartitle',colorbartitle);
|
---|
| 1396 | + end
|
---|
| 1397 | + end
|
---|
| 1398 | + else
|
---|
| 1399 | + plotmodel(md.earth,'data',dfield-field,'figurestatement','off','clf','off','mask',maskv,'caxis',colaxis,'xlim',xl,'ylim',yl,'zlim',zl,'shading',shadingv,'view#all',v,'colorbartitle',colorbartitle);
|
---|
| 1400 | + end
|
---|
| 1401 | + end
|
---|
| 1402 | +
|
---|
| 1403 | + %coastlines and graticule: {{{
|
---|
| 1404 | + load coastlines
|
---|
| 1405 | + [x,y,z]=AboveGround(coastlat,coastlon,md.earth.mesh.r(1),1000);
|
---|
| 1406 | + hold on; p=plot3(x,y,z,'k-'); set(p,'Color','k');
|
---|
| 1407 | +
|
---|
| 1408 | + %graticule:
|
---|
| 1409 | + grat=graticule(30,40,1);
|
---|
| 1410 | + [x,y,z]=AboveGround(grat.lat,grat.long,md.earth.mesh.r(1),1000);
|
---|
| 1411 | + hold on, p=plot3(x,y,z,'k.-','MarkerSize',.01); set(p,'Color','k');
|
---|
| 1412 | + %}}}
|
---|
| 1413 | + %}}}
|
---|
| 1414 | + else
|
---|
| 1415 | + %IceCaps plotting: {{{
|
---|
| 1416 | +
|
---|
| 1417 | + %counter: % {{{
|
---|
| 1418 | + stepHandle=findobj('Tag', 'Step');
|
---|
| 1419 | + stepstrings=get(stepHandle,'String');
|
---|
| 1420 | + stepvalue=get(stepHandle,'Value');
|
---|
| 1421 | + if ~isempty(stepstrings),
|
---|
| 1422 | + stepstring=stepstrings{stepvalue};
|
---|
| 1423 | + %grab second integer:
|
---|
| 1424 | + A=sscanf(stepstring,'%g (%i)'); counter=A(2);
|
---|
| 1425 | + else
|
---|
| 1426 | + counter=1;
|
---|
| 1427 | + end
|
---|
| 1428 | + %}}}
|
---|
| 1429 | + %log: % {{{
|
---|
| 1430 | + logHandle=findobj('Tag', 'Log'); logvalue=get(logHandle,'Value');
|
---|
| 1431 | + %}}}
|
---|
| 1432 | + %shading: %{{{
|
---|
| 1433 | + interpHandle=findobj('Tag', 'Interp'); interpvalue=get(interpHandle,'Value');
|
---|
| 1434 | + flatHandle=findobj('Tag', 'Flat'); flatvalue=get(flatHandle,'Value');
|
---|
| 1435 | + facetedHandle=findobj('Tag', 'Faceted'); facetedvalue=get(facetedHandle,'Value');
|
---|
| 1436 | + if interpvalue,
|
---|
| 1437 | + shadingv='interp';
|
---|
| 1438 | + elseif flatvalue,
|
---|
| 1439 | + shadingv='flat';
|
---|
| 1440 | + elseif facetedvalue,
|
---|
| 1441 | + shadingv='faceted';
|
---|
| 1442 | + else
|
---|
| 1443 | + shadingv='interp';
|
---|
| 1444 | + end
|
---|
| 1445 | + %}}}
|
---|
| 1446 | + %time: {{{
|
---|
| 1447 | + timeHandle=findobj('Tag','Time');
|
---|
| 1448 | + if strcmpi(solutiontype,'TransientSolution'),
|
---|
| 1449 | + set(timeHandle,'String',sprintf('%4.2f',md.icecaps{1}.results.TransientSolution(counter).time));
|
---|
| 1450 | + else
|
---|
| 1451 | + set(timeHandle,'String',sprintf('%4.2f',0));
|
---|
| 1452 | + end
|
---|
| 1453 | + %}}}
|
---|
| 1454 | + %diffcounter: % {{{
|
---|
| 1455 | + stepHandle=findobj('Tag', 'DiffStep');
|
---|
| 1456 | + stepstrings=get(stepHandle,'String');
|
---|
| 1457 | + stepvalue=get(stepHandle,'Value');
|
---|
| 1458 | + if ~isempty(stepstrings),
|
---|
| 1459 | + stepstring=stepstrings{stepvalue};
|
---|
| 1460 | + %grab second integer:
|
---|
| 1461 | + A=sscanf(stepstring,'%g (%i)'); diffcounter=A(2);
|
---|
| 1462 | + else
|
---|
| 1463 | + diffcounter=1;
|
---|
| 1464 | + end
|
---|
| 1465 | + diffHandle=findobj('Tag', 'Diff');
|
---|
| 1466 | + diff=get(diffHandle,'Value');
|
---|
| 1467 | + %}}}
|
---|
| 1468 | + %range: % {{{
|
---|
| 1469 | + basins=getbasins();
|
---|
| 1470 | + if strcmpi(basins,'All'),
|
---|
| 1471 | + range=md.basinindx('continent',{getcontinent()});
|
---|
| 1472 | + else
|
---|
| 1473 | + range=md.basinindx('basin',basins);
|
---|
| 1474 | + end
|
---|
| 1475 | +
|
---|
| 1476 | + %}}}
|
---|
| 1477 | + cla;
|
---|
| 1478 | + for j=1:length(range),
|
---|
| 1479 | + i=range(j);
|
---|
| 1480 | + %mask: %{{{
|
---|
| 1481 | + maskfieldHandle=findobj('Tag', 'Masque');
|
---|
| 1482 | + maskfieldstrings=get(maskfieldHandle,'String');
|
---|
| 1483 | + maskfieldvalue=get(maskfieldHandle,'Value');
|
---|
| 1484 | + maskfield=maskfieldstrings(maskfieldvalue);
|
---|
| 1485 | + maskfield=maskfield{:};
|
---|
| 1486 | + if strcmpi(maskfield,'all'),
|
---|
| 1487 | + maskv=ones(md.icecaps{i}.mesh.numberofvertices,1);
|
---|
| 1488 | + else
|
---|
| 1489 | + maskv=md.icecaps{i}.mask.(maskfield);
|
---|
| 1490 | + end
|
---|
| 1491 | + if strcmpi(maskfield,'all'),
|
---|
| 1492 | + %do nothing;
|
---|
| 1493 | + elseif strcmpi(maskfield,'groundedice_levelset'),
|
---|
| 1494 | + maskv=maskv>=0;
|
---|
| 1495 | + elseif strcmpi(maskfield,'ice_levelset'),
|
---|
| 1496 | + maskv=maskv<=0;
|
---|
| 1497 | + elseif strcmpi(maskfield,'ocean_levelset'),
|
---|
| 1498 | + maskv=maskv==1;
|
---|
| 1499 | + elseif strcmpi(maskfield,'land_levelset'),
|
---|
| 1500 | + maskv=maskv==1;
|
---|
| 1501 | + elseif strcmpi(maskfield,'glacier_levelset'),
|
---|
| 1502 | + if isnan(maskv),
|
---|
| 1503 | + maskv=ones(md.icecaps{i}.mesh.numberofvertices,1);
|
---|
| 1504 | + else
|
---|
| 1505 | + maskv=maskv==1;
|
---|
| 1506 | + end
|
---|
| 1507 | + end
|
---|
| 1508 | + maskvalue=0;
|
---|
| 1509 | + %}}}
|
---|
| 1510 | + %lock limits: % {{{
|
---|
| 1511 | + lockHandle=findobj('Tag', 'Lock'); lockvalue=get(lockHandle,'Value');
|
---|
| 1512 | + if lockvalue,
|
---|
| 1513 | + xl=xlim; yl=ylim;
|
---|
| 1514 | + else
|
---|
| 1515 | + if j==1,
|
---|
| 1516 | + xl=[min(md.icecaps{i}.mesh.x) max(md.icecaps{i}.mesh.x)];
|
---|
| 1517 | + else
|
---|
| 1518 | + xl=[min([md.icecaps{i}.mesh.x;xl(1)]) max([md.icecaps{i}.mesh.x;xl(2)])];
|
---|
| 1519 | + end
|
---|
| 1520 | + if j==1,
|
---|
| 1521 | + yl=[min(md.icecaps{i}.mesh.y) max(md.icecaps{i}.mesh.y)];
|
---|
| 1522 | + else
|
---|
| 1523 | + yl=[min([md.icecaps{i}.mesh.y; yl(1)]) max([md.icecaps{i}.mesh.y; yl(2)])];
|
---|
| 1524 | + end
|
---|
| 1525 | + end %}}}
|
---|
| 1526 | + %field: % {{{
|
---|
| 1527 | + fieldHandle=findobj('Tag', 'Field');
|
---|
| 1528 | + fieldstrings=get(fieldHandle,'String');
|
---|
| 1529 | + fieldvalue=get(fieldHandle,'Value');
|
---|
| 1530 | + if ~isempty(fieldstrings),
|
---|
| 1531 | + fieldv=fieldstrings{fieldvalue};
|
---|
| 1532 | + else
|
---|
| 1533 | + fieldv=NaN;
|
---|
| 1534 | + end
|
---|
| 1535 | + mfHandle=findobj('Tag', 'Mf');
|
---|
| 1536 | + mf=get(mfHandle,'Value');
|
---|
| 1537 | + if mf | strcmpi(solutiontype,'None'),
|
---|
| 1538 | + fieldHandle=findobj('Tag', 'ModelFields');
|
---|
| 1539 | + fieldstrings=get(fieldHandle,'String');
|
---|
| 1540 | + fieldvalue=get(fieldHandle,'Value');
|
---|
| 1541 | + fieldv=fieldstrings{fieldvalue};
|
---|
| 1542 | + eval(['field=md.icecaps{' num2str(i) '}.' fieldv ';']);
|
---|
| 1543 | + if isnan(field),
|
---|
| 1544 | + field='mesh';
|
---|
| 1545 | + end
|
---|
| 1546 | + else
|
---|
| 1547 | + if strcmpi(solutiontype,'TransientSolution'),
|
---|
| 1548 | + field=md.icecaps{i}.results.TransientSolution(counter).(fieldv);
|
---|
| 1549 | + dfield=md.icecaps{i}.results.TransientSolution(diffcounter).(fieldv);
|
---|
| 1550 | + elseif strcmpi(solutiontype,'StressbalanceSolution'),
|
---|
| 1551 | + field=md.icecaps{i}.results.StressbalanceSolution.(fieldv);
|
---|
| 1552 | + dfield=NaN;
|
---|
| 1553 | + else
|
---|
| 1554 | + error('unknown solution type!');
|
---|
| 1555 | + end
|
---|
| 1556 | + end
|
---|
| 1557 | + if comparison,
|
---|
| 1558 | + if strcmpi(solutiontype,'None'),
|
---|
| 1559 | + error('cannot compare a solution field to model as no solution was run or selected!');
|
---|
| 1560 | + end
|
---|
| 1561 | + %figure out second field:
|
---|
| 1562 | + if strcmpi(fieldv,'Vel'), field2=md.icecaps{i}.inversion.vel_obs; end
|
---|
| 1563 | + if strcmpi(fieldv,'Base'), field2=md.icecaps{i}.geometry.base; end
|
---|
| 1564 | + if strcmpi(fieldv,'Bed'), field2=md.icecaps{i}.geometry.bed; end
|
---|
| 1565 | + if strcmpi(fieldv,'Thickness'), field2=md.icecaps{i}.geometry.thickness; end
|
---|
| 1566 | + if strcmpi(fieldv,'Surface'), field2=md.icecaps{i}.geometry.surface; end
|
---|
| 1567 | + end
|
---|
| 1568 | +
|
---|
| 1569 | + %}}}
|
---|
| 1570 | + %color limits: % {{{
|
---|
| 1571 | + cminHandle=findobj('Tag','Cmin'); cminfield=str2num(get(cminHandle,'String'));
|
---|
| 1572 | + cmaxHandle=findobj('Tag','Cmax'); cmaxfield=str2num(get(cmaxHandle,'String'));
|
---|
| 1573 | +
|
---|
| 1574 | + if isnan(cminfield)
|
---|
| 1575 | + if logvalue,
|
---|
| 1576 | + cmin=.1;
|
---|
| 1577 | + else
|
---|
| 1578 | + pos=find(maskv);
|
---|
| 1579 | + if j==1,
|
---|
| 1580 | + cmin=min(field(pos));
|
---|
| 1581 | + else
|
---|
| 1582 | + cmin=min(min(field(pos)),cmin);
|
---|
| 1583 | + end
|
---|
| 1584 | + end
|
---|
| 1585 | + else
|
---|
| 1586 | + cmin=cminfield;
|
---|
| 1587 | + end
|
---|
| 1588 | + if isnan(cmaxfield)
|
---|
| 1589 | + pos=find(maskv);
|
---|
| 1590 | + if j==1
|
---|
| 1591 | + cmax=max(field(pos));
|
---|
| 1592 | + else
|
---|
| 1593 | + cmax=max(max(field(pos)),cmax);
|
---|
| 1594 | + end
|
---|
| 1595 | + else
|
---|
| 1596 | + cmax=cmaxfield;
|
---|
| 1597 | + end
|
---|
| 1598 | + if cmin==cmax,
|
---|
| 1599 | + cmin=cmin-1e-10; cmax=cmax+1e-10;
|
---|
| 1600 | + end
|
---|
| 1601 | + colaxis=[cmin,cmax];
|
---|
| 1602 | + %}}}
|
---|
| 1603 | + %contour levels? {{{
|
---|
| 1604 | + contourlevels=0;
|
---|
| 1605 | + if strncmpi(fieldv,'Mask',4),
|
---|
| 1606 | + contourexp=[tempname '.exp'];
|
---|
| 1607 | + expcontourlevelzero(md.icecaps{i},field,0, contourexp);
|
---|
| 1608 | + contourlevels=1;
|
---|
| 1609 | +
|
---|
| 1610 | + if diff,
|
---|
| 1611 | + contourdiffexp=[tempname '.exp'];
|
---|
| 1612 | + expcontourlevelzero(md.icecaps{i},dfield,0, contourdiffexp);
|
---|
| 1613 | + end
|
---|
| 1614 | + end
|
---|
| 1615 | + %}}}
|
---|
| 1616 | + %display : {{{
|
---|
| 1617 | + if logvalue,
|
---|
| 1618 | + plotmodel(md.icecaps{i},'data',field,'figurestatement','off','clf','off','mask',maskv,'caxis',colaxis,'log',10,'xlim',xl,'ylim',yl,'shading',shadingv);
|
---|
| 1619 | + else
|
---|
| 1620 | + if ~diff,
|
---|
| 1621 | + if comparison,
|
---|
| 1622 | + plotmodel(md.icecaps{i},'data',field,'data',field2,'figurestatement','off','clf','off','mask#all',maskv,'caxis#all',colaxis,'xlim#all',xl,'ylim#all',yl,'shading#all',shadingv,'nlines',2,'ncols',1);
|
---|
| 1623 | + else
|
---|
| 1624 | + if ischar(field) & strcmpi(field,'mesh'),
|
---|
| 1625 | + plotmodel(md.icecaps{i},'data','mesh','figurestatement','off','clf','off','xlim',xl,'ylim',yl);
|
---|
| 1626 | + else
|
---|
| 1627 | + plotmodel(md.icecaps{i},'data',field,'figurestatement','off','clf','off','mask',maskv,'caxis',colaxis,'xlim',xl,'ylim',yl,'shading',shadingv);
|
---|
| 1628 | + if contourlevels,
|
---|
| 1629 | + contour=expread(contourexp);
|
---|
| 1630 | + hold on;
|
---|
| 1631 | + for k=1:length(contour),
|
---|
| 1632 | + plot(contour(k).x,contour(k).y,'r-');
|
---|
| 1633 | + end
|
---|
| 1634 | + end
|
---|
| 1635 | + end
|
---|
| 1636 | + end
|
---|
| 1637 | + else
|
---|
| 1638 | + plotmodel(md.icecaps{i},'data',dfield-field,'figurestatement','off','clf','off','mask',maskv,'caxis',colaxis,'xlim',xl,'ylim',yl,'shading',shadingv);
|
---|
| 1639 | + if contourlevels,
|
---|
| 1640 | + contour=expread(contourexp);
|
---|
| 1641 | + hold on;
|
---|
| 1642 | + for k=1:length(contour),
|
---|
| 1643 | + plot(contour(k).x,contour(k).y,'k-');
|
---|
| 1644 | + end
|
---|
| 1645 | + dcontour=expread(contourdiffexp);
|
---|
| 1646 | + hold on;
|
---|
| 1647 | + for k=1:length(dcontour),
|
---|
| 1648 | + plot(dcontour(k).x,dcontour(k).y,'r-');
|
---|
| 1649 | + end
|
---|
| 1650 | + end
|
---|
| 1651 | + end
|
---|
| 1652 | + end
|
---|
| 1653 | + % }}}
|
---|
| 1654 | +
|
---|
| 1655 | + end %end for
|
---|
| 1656 | +
|
---|
| 1657 | + if ~comparison,
|
---|
| 1658 | + set(gca,'Position',[0.2300 0.1100 0.7750 0.8150]);
|
---|
| 1659 | + end % }}}
|
---|
| 1660 | + end
|
---|
| 1661 | +% }}}
|
---|
| 1662 | +function result=isearth() % {{{
|
---|
| 1663 | + global earth;
|
---|
| 1664 | + result=earth;
|
---|
| 1665 | +%}}}
|
---|
| 1666 | +function result=issealevel() % {{{
|
---|
| 1667 | + global md;
|
---|
| 1668 | + if strcmpi(class(md),'sealevelmodel'),
|
---|
| 1669 | + result=1;
|
---|
| 1670 | + else
|
---|
| 1671 | + result=0;
|
---|
| 1672 | + end
|
---|
| 1673 | +%}}}
|
---|
| 1674 | +function continent=getcontinent() % {{{
|
---|
| 1675 | +
|
---|
| 1676 | + continentHandle=findobj('Tag', 'popupmenu11');
|
---|
| 1677 | + strings=get(continentHandle,'String');
|
---|
| 1678 | + value=get(continentHandle,'Value');
|
---|
| 1679 | + continent=strings{value};
|
---|
| 1680 | +
|
---|
| 1681 | +%}}}
|
---|
| 1682 | +function basins=getbasins() % {{{
|
---|
| 1683 | +
|
---|
| 1684 | + basinHandle=findobj('Tag', 'popupmenu12');
|
---|
| 1685 | + strings=get(basinHandle,'String');
|
---|
| 1686 | + value=get(basinHandle,'Value');
|
---|
| 1687 | + basins=strings{value};
|
---|
| 1688 | +% }}}
|
---|
| 1689 | Index: ../trunk-jpl/src/m/contrib/larour/mdanalysis.fig
|
---|
| 1690 | ===================================================================
|
---|
| 1691 | Cannot display: file marked as a binary type.
|
---|
| 1692 | svn:mime-type = application/octet-stream
|
---|
| 1693 | Index: ../trunk-jpl/src/m/contrib/larour/mdanalysis.fig
|
---|
| 1694 | ===================================================================
|
---|
| 1695 | --- ../trunk-jpl/src/m/contrib/larour/mdanalysis.fig (nonexistent)
|
---|
| 1696 | +++ ../trunk-jpl/src/m/contrib/larour/mdanalysis.fig (revision 24880)
|
---|
| 1697 |
|
---|
| 1698 | Property changes on: ../trunk-jpl/src/m/contrib/larour/mdanalysis.fig
|
---|
| 1699 | ___________________________________________________________________
|
---|
| 1700 | Added: svn:mime-type
|
---|
| 1701 | ## -0,0 +1 ##
|
---|
| 1702 | +application/octet-stream
|
---|
| 1703 | \ No newline at end of property
|
---|
| 1704 | Index: ../trunk-jpl/src/m/contrib/larour/glacier_inventory.m
|
---|
| 1705 | ===================================================================
|
---|
| 1706 | --- ../trunk-jpl/src/m/contrib/larour/glacier_inventory.m (revision 24879)
|
---|
| 1707 | +++ ../trunk-jpl/src/m/contrib/larour/glacier_inventory.m (revision 24880)
|
---|
| 1708 | @@ -118,6 +118,19 @@
|
---|
| 1709 | end
|
---|
| 1710 | end
|
---|
| 1711 | %}}}
|
---|
| 1712 | + function varargout=loadcontour(self,id) % {{{
|
---|
| 1713 | +
|
---|
| 1714 | + %go find the projected contours for an 'id' region:
|
---|
| 1715 | + disp(['reading projected shapefile for region: ' self.regions(id).name]);
|
---|
| 1716 | + contours=shaperead([self.root '/' self.regions(id).name '.laeaproj.shp']);
|
---|
| 1717 | + self.regions(id).contours=contours;
|
---|
| 1718 | +
|
---|
| 1719 | + if nargout==1,
|
---|
| 1720 | + varargout{1}=contours;
|
---|
| 1721 | + end
|
---|
| 1722 | +
|
---|
| 1723 | + end
|
---|
| 1724 | + %}}}
|
---|
| 1725 | function disp(self) % {{{
|
---|
| 1726 | disp(sprintf(' Glacier inventory:'));
|
---|
| 1727 |
|
---|