Warning, /utils/matlab/Graphix/GraphixRun.m is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit 9928f98a on 2006-04-11 19:10:46 UTC
5bbd0d07c9 Dani*0001 function GraphixRun(varargin);
0002
0003 % Function: GraphixRun
0004 % Author: Daniel Enderton
0005 %
0006 % Input Fields:
0007 %
0008 % Field Type (Brief) Description
0009 % -----------------------------------------------------------------------
0010 % page cell array Experiment and plot information (Required)
0011 % pagename string Page name (title and output file) (Required)
0012 %
0013 % OutputDir string Output directory name (Optional)
0014 % LoadData 0/1 Load data (Optional)
0015 % LoadGridData 0/1 Load grid data (Optional)
0016 % DumpData 0/1 Save plotting data (Optional)
0017 % SavePlots 0/1 Save plot (Optional)
0018 % GraphixDebug 0/1 Print debug flags (Optional)
0019 %
0020 % (More optional parameters seen in GraphixRunDefaults)
0021 %
0022 % Descripton:
0023 % This is the top level function of the cubed-sphere global model
0024 % data manipulation and plotting package.
0025 %
0026 % Sample function call is as follows (page and pagename appropriately
0027 % defined):
0028 %
0029 % >> GraphixRun(page,pagename,'LoadData',1);
0030 % >> GraphixRun(page,pagename,'LoadData',1,'OutputDir','~/');
0031
0032
0033 % Load GraphixRun default parameters and general diagnostics parameters.
0034 GraphixGenParam;
0035 GraphixRunDefaults;
0036
0037
0038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0039 % Read in function arguements %
0040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0041
0042 % Read in list of possible run parameters.
0043 grphxrunparam = ReadVariables('GraphixRunDefaults.m');
0044 grphxplotparam = ReadVariables('GraphixPlotDefaults.m');
074135d206 Dani*0045 grphxplotparam{end+1} = 'contint';
0046 grphxplotparam{end+1} = 'units';
0047 grphxplotparam{end+1} = 'range';
5bbd0d07c9 Dani*0048
0049 % Rudimentary checks to make sure that the page and pagemane fields are
0050 % there and that they are the correct classes.
0051 if length(varargin) < 2
0052 error('There must be at least two input arguements.')
0053 else
0054 if isequal(class(varargin{1}),'cell')
0055 page = varargin{1};
0056 else
0057 error('''page'' (1st argument) must be cell array.');
0058 end
0059 if isequal(class(varargin{2}),'char')
0060 pagename = varargin{2};
0061 else
0062 error('''pagename'' (2nd arguement) must be a string.');
0063 end
0064 end
0065
0066 % Read in optional parameters, overriding the GraphixRun defaults.
0067 plotparam = {}; plotparamvalue = {};
0068 for iarg = 3:2:length(varargin)
0069 incoming = varargin{iarg+1};
0070 if ismember(varargin{iarg},grphxrunparam)
0071 eval([varargin{iarg},'=incoming;']);
0072 elseif ismember(varargin{iarg},grphxplotparam)
0073 plotparam{end+1} = varargin{iarg};
0074 plotparamvalue{end+1} = incoming;
0075 else
0076 error(['Unrecognized GraphixRun setting: ',lower(varargin{iarg})]);
0077 end
0078 end
0079
0080
0081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0082 % Function body %
0083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0084
0085 % Determine number of plots for this page.
0086 nplot = length(page);
0087
0088 % Here would be a nice place to implement a function to verify that the
0089 % experiment field, slicing, averaging, and plot configuration information
0090 % is all self-consistent.
0091
0092
0093 % If the loaddata options is set to 0, the loading, averaging and slicing
0094 % of the data will be bypassed and the data to be plotted will be pulled
0095 % from the 'dump.mat' file. This options is here almost entirely for the
0096 % purpose of fine-tuning your plots with the 'GraphixPlot' function (also good
0097 % for testing modifications to GraphixPlot!). If the setting is set to 1,
0098 % then after the loading, averaging, and slicing the data to be plotted is
0099 % automatically saved to 'GraphixDump.mat' so you so not have to load the
0100 % exact same data next time is you so desire.
0101 if LoadData
0102
0103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0104 % Load data (calls GraphixAverage and GraphixSlice %
0105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0106 for inplot = 1:nplot
0107 ntrl = length(page{inplot}); if ntrl ~= 1, ntrl = ntrl - 1; end
0108 for intrl = 1:ntrl
0109 ExpInfo = page{inplot}{intrl};
0110
0111 % Put 'Empty' for data holders if a blank space is desired.
0112 if isequal(ExpInfo,'Empty')
0113 data{inplot}{intrl} = 'Empty';
0114 xax{inplot}{intrl} = 'Empty';
0115 yax{inplot}{intrl} = 'Empty';
0116 time{inplot}{intrl} = 'Empty';
0117 pltslc{inplot}{intrl} = 'Empty';
0118
0119 else
0120 fil = ExpInfo{ifil}; % FileName (Required)
0121 fln = ExpInfo{ifln}; % FieldName (Required)
0122 trl = ExpInfo{itrl}; % Experiment (Required)
0123 dat = ExpInfo{idat}; % DataType (Required)
0124 dad = ExpInfo{idad}; % DataDir (Required)
0125 grd = ExpInfo{igrd}; % GridDir (Required)
0126 itr = ExpInfo{iitr}; % Iterations (Required)
0127 tst = ExpInfo{itst}; % TimeStep (Required)
0128 flu = ExpInfo{iflu}; % Fluid (Required)
0129 ddf = ExpInfo{iddf}; % DataFormat (Required)
0130 gdf = ExpInfo{igdf}; % GridFormat (Required)
0131 avg = ExpInfo{iavg}; % Averaging (Required)
0132 slc = ExpInfo{islc}; % SliceType (Required)
0133 pst = ExpInfo{ipst}; % PlotStyle (Required)
0134
0135 % Set panel settings to default values or this that are
0136 % overriden for the entire page. Override within panel.
0137 for param = grphxrunparam
0138 eval([param{1},'Temp=',param{1},';']);
0139 end
0140 for iarg = 15:2:length(ExpInfo)
0141 incoming = ExpInfo{iarg+1};
0142 eval([ExpInfo{iarg},'Temp=incoming;']);
0143 end
0144
0145 % Make GraphixLoad function call.
0146 disp(['Loading - Experiment: ',trl,'; Field: ',fln]);
0147 [data{inplot}{intrl},xax{inplot}{intrl},...
0148 yax{inplot}{intrl},time{inplot}{intrl},...
9928f98a52 Dani*0149 pltslc{inplot}{intrl},XG{inplot}{intrl},...
0150 YG{inplot}{intrl}] = GraphixLoad(...
5bbd0d07c9 Dani*0151 fil,fln,trl,dat,dad,grd,itr,tst,flu,ddf,gdf,avg,slc,...
0152 pst,LoadGridData,GraphixDebug,GridSuffixTemp,...
0153 ZcordFileTemp,IndexTemp,DimTemp,VectorTemp,MateTemp,...
0154 uFldTemp,vFldTemp,gmfileTemp,KwxFldTemp,KwyFldTemp,...
0155 GradsTemp,Year0IterTemp,SecPerYearTemp,MonthsTemp,...
0156 PlotFldTemp,XLTemp,YLTemp,ThetaToActTTemp,...
9928f98a52 Dani*0157 ThetaToThetaEcTemp,DataInTemp,SecMomTemp,TFldTemp,...
0158 T2FldTemp,EtaFldTemp,Eta2FldTemp,u2FldTemp,...
0159 v2FldTemp,DevFromMeanTemp,WFldTemp,W2FldTemp);
0160
5bbd0d07c9 Dani*0161 % Save panel data for outside use.
0162 if DumpData
0163 datadump = data{inplot}{intrl};
0164 xaxdump = xax{inplot}{intrl};
0165 yaxdump = yax{inplot}{intrl};
0166 timedump = time{inplot}{intrl};
0167 pltslcdump = pltslc{inplot}{intrl};
0168 save(['Data',pagename,fln,flu,'.mat'],'datadump',...
0169 'xaxdump','yaxdump','timedump','pltslcdump');
0170 end
0171 end
0172 end
0173 end
9928f98a52 Dani*0174 save('GraphixDump.mat','data','xax','yax','time','pltslc','XG','YG');
5bbd0d07c9 Dani*0175 else
9928f98a52 Dani*0176 load('GraphixDump.mat');
5bbd0d07c9 Dani*0177 end
0178
0179
0180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0181 % Plot Data %
0182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0183
0184 % Now to make the actual plots. Basically, all of the information is
0185 % passed to the 'GraphixPlot' functions, and things get a bit hairy in
0186 % there. Hopefully the comments in the function, and its supporting
0187 % scripts will help you to make sense of this as needed.
9928f98a52 Dani*0188 if PlotResults
0189 disp(['Plotting results:']);
0190 GraphixPlot(plotparam,plotparamvalue,pagename,page,data,xax,yax,...
0191 XG,YG,time,pltslc,OutputDir,LoadGridData,SavePlots,...
0192 GraphixDebug);
0193 end