function [times, Pass_Times, depths, Pass_Depths, cs] = ... dinocat(CatalogServer, get_archive, Time, Depth, ranges) % % This function passes time and depth information and transforms them to model grid % % The preceding empty line is important. if exist(get_archive) == 2 eval(get_archive) else disp('Metadata not found!') return end Pass_Times = []; times = []; Pass_Depths = []; depths = []; cs = []; BaseTime = Time(1); % == das basetime BeginTime = max(Time(1), ranges(4,1)); EndTime = min(Time(2), ranges(4,2)); BeginYear = floor(BeginTime); StartYear = BeginYear; Constraint = ['time']; eval(['loaddods(''', CatalogServer, '?', Constraint,''')']) ntime = length(time); if ntime ~= Ntime disp('Can not resolve TimeRange. Error in archive.m file'); return end if isleap(BeginYear) DaysInYear = 366; else DaysInYear = 365; end %timestep = abs(diff(Time(2),Time(1))) / (Ntime -1); for i = 1:ntime timetemp(i,1) = BaseTime + time(i,1) / DaysInYear; if (timetemp(i,1) >= BeginTime) & (timetemp(i,1) <= EndTime) times = [times; timetemp(i,1)]; Pass_Times = [Pass_Times; i-1]; end end BaseDepth = Depth(1); % on the surface StartDepth = BaseDepth; BeginDepth = max(Depth(1), ranges(3,1)); EndDepth = min(Depth(2), ranges(3,2)); depthstep = abs(diff(Depth(2),Depth(1))) / (Ndepth -1); for j = 1:Ndepth depthtemp(j,1) = StartDepth; if (depthtemp(j,1) >= BeginDepth) & (depthtemp(j,1) <= EndDepth) depths = [depths; depthtemp(j,1)]; Pass_Depths = [Pass_Depths; j-1]; end StartDepth = StartDepth + depthstep; end