Warning, /utils/matlab/Graphix/GraphixLoadMonitor.m is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit 25d8528d on 2006-04-13 16:45:12 UTC
5bbd0d07c9 Dani*0001 function [data,time] = ...
25d8528d16 Dani*0002 GraphixLoadMonitor(fln,mnchandle,dad,itr,tst,SecPerYear,DiagDebug);
5bbd0d07c9 Dani*0003
0004 % Read in files names.
25d8528d16 Dani*0005 %files = dir([dad,'/',mnchandle,'*']);
0006 filesin=ls([dad,'/',mnchandle,'*']);
5bbd0d07c9 Dani*0007 index=1;
0008 while ~isempty(filesin)
0009 [token,filesin] = strtok(filesin);
0010 if ~isempty(filesin)
0011 files(index).name=token; index=index+1;
0012 end
0013 end
0014
0015
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 % Read in data %
0018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0019
0020 % Initialize result arrays.
0021 if isempty(itr),
0022 time=[];
0023 data=[];
0024 else
0025 time=NaN.*zeros(size(itr));
0026 data=NaN.*zeros(size(itr));
0027 end
0028
0029 for ifile = 1:length(files)
0030
0031 % Open monitor file.
0032 if DiagDebug, disp(['Entering file: ',files(ifile).name]); end
0033 nc=netcdf(files(ifile).name,'read');
0034
0035 % Read time and data information.
25d8528d16 Dani*0036 nciter=nc{'T'}(:);
5bbd0d07c9 Dani*0037
0038 ncdata=nc{fln};
0039 if isempty(nciter), error('Monitor time axis not found!'); end
0040 if isempty(ncdata), error(['Monitor field not found: ',fln]); end
0041
0042 % Load desired indecies.
0043 if isempty(itr)
0044 if isempty(time),
0045 time=nciter(:);
0046 data=ncdata(:);
0047 else
0048 index=find(~ismember(nciter(:),time));
0049 if ~isempty(index)
0050 nciter=nciter(index); time=[time;NaN;nciter];
0051 ncdata=ncdata(index); data=[data;NaN;ncdata];
0052 end
0053 end
0054 else
0055 [test,loc]=ismember(itr,nciter(:));
0056 index=find(test);
0057 if ~isempty(index)
0058 time(index)=nciter(loc(index));
0059 data(index)=ncdata(loc(index));
0060 end
0061 end
0062
0063 close(nc);
0064 end
0065
0066 % Check for missing indecies.
0067 % if ~isempty(find(isnan(time))) || ~isempty(find(isnan(data)))
0068 % error('Missing monitor data for specified indecies!');
0069 % end
0070
0071 time=time./SecPerYear;