diff --git a/S06a_getMeanU.m b/S06a_getMeanU.m new file mode 100644 index 0000000..1753c49 --- /dev/null +++ b/S06a_getMeanU.m @@ -0,0 +1,64 @@ +%%%%%%%%% +% Created: 08-Apr-2014 19:50:46 +% Computer: GLNX86 +% Matlab: 7.9 +% Author: NK +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function S06a_getMeanU + %% init + DD=initialise; + %% find files + [file]=findVelFiles(DD); + %% get dims + [d,pos,dim]=getDims(file,DD); + %% means + means=getMeans(d,pos,dim,file,DD); %#ok + %% save + save([DD.path.meanU.file], 'means') +end +function means=getMeans(d,pos,dim,file,DD) + for kk=1:numel(file) + U(:,:,kk)=squeeze(nc_varget(file(1).U,'UVEL',dim.start,dim.length))/100; %#ok<*AGROW> + V(:,:,kk)=squeeze(nc_varget(file(1).V,'VVEL',dim.start,dim.length))/100; + end + U(U<-1e33)=nan; % missing values + V(V<-1e33)=nan; % missing values + means.zonal=nanmean(U,3); + means.merid=nanmean(V,3); + means.total=hypot(means.zonal,means.merid); + means.direc=azimuth(zeros(size(means.zonal)),zeros(size(means.zonal)),means.merid,means.zonal); + means.depth=d(pos.z.start); + %% + lin=extractfield(load(DD.path.protoMaps.file),'idx'); + means.small.zonal=nan(DD.dim.Y,DD.dim.X); + for li=unique(lin(lin~=0 & ~isnan(lin))) + means.small.zonal(li)=nanmean(means.zonal(lin==li)); + end + +end +function [d,pos,dim]=getDims(file,DD) + dWanted=DD.parameters.depthRossby; + d=nc_varget(file(1).U,'depth_t'); + [~,pos.z.start]=min(abs(d-dWanted)); + pos.z.length=1; + pos.x.start=DD.map.window.limits.west; + pos.x.length=DD.map.window.size.X; + pos.y.start=DD.map.window.limits.south; + pos.y.length=DD.map.window.size.Y; + dim.start = [0 pos.z.start pos.y.start pos.x.start]; + dim.length = [inf pos.z.length pos.y.length pos.x.length ]; +end +function [file]=findVelFiles(DD) + %% find the U and V files + ucc=0; vcc=0; + for kk=1:numel(DD.path.TempSalt.files) + if ~isempty(strfind(DD.path.TempSalt.files(kk).name,'UVEL')) + ucc=ucc+1; + file(ucc).U=[DD.path.TempSalt.name DD.path.TempSalt.files(kk).name]; %#ok + end + if ~isempty(strfind(DD.path.TempSalt.files(kk).name,'VVEL')) + vcc=vcc+1; + file(vcc).V=[DD.path.TempSalt.name DD.path.TempSalt.files(kk).name]; %#ok + end + end +end \ No newline at end of file diff --git a/S07_drawPlots.m b/S07_drawPlots.m index 35e6d0c..32e7dcf 100755 --- a/S07_drawPlots.m +++ b/S07_drawPlots.m @@ -248,7 +248,7 @@ function mapstuff(maps,vecs,DD,ticks,lo,la) VV=maps.(sen).radius.toRo; pcolor(lo,la,VV);shading flat caxis([ticks.radiusToRo(1) ticks.radiusToRo(2)]) - decorate('radiusToRo',ticks,DD,sen,'Radius/(2*L_R)',' ',1,1); + decorate('radiusToRo',ticks,DD,sen,'Radius/(2 L_R)',' ',1,1); savefig(DD.path.plots,ticks.rez,ticks.width,ticks.height,[sen,'_MapRadToRo']); end