Você está na página 1de 40

MATLAB & Practical Application on Climate Variability Studies EXERCISES

B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera & Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

DAYS 3 & 4 functions


a4.m
figure('PaperType','A4','Position',[280 100 2*210 2*297],'Resize','off','PaperUnits','centimeters',... 'PaperPosition',[1.5 1.5 21-3 29.7-3]);

a4l.m
figure('PaperType','A4','Position',[280 100 2*297 2*210],'Resize','off','PaperUnits','centimeters',... 'PaperPosition',[1.5 1.5 29.7-3 21-3],'PaperOrientation','landscape');

MATLAB & Practical Application on Climate Variability Studies 1 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

bluewhitered.m
function newmap = bluewhitered(m) %BLUEWHITERED Blue, white, and red color map. % BLUEWHITERED(M) returns an M-by-3 matrix containing a blue to white % to red colormap, with white corresponding to the CAXIS value closest % to zero. This colormap is most useful for images and surface plots % with positive and negative values. BLUEWHITERED, by itself, is the % same length as the current colormap. % % Examples: % -----------------------------% figure % imagesc(peaks(250)); % colormap(bluewhitered(256)), colorbar % % figure % imagesc(peaks(250), [0 8]) % colormap(bluewhitered), colorbar % % figure % imagesc(peaks(250), [-6 0]) % colormap(bluewhitered), colorbar % % figure % surf(peaks) % colormap(bluewhitered) % axis tight % % See also HSV, HOT, COOL, BONE, COPPER, PINK, FLAG, % COLORMAP, RGBPLOT.

if nargin < 1 m = size(get(gcf,'colormap'),1); end

bottom = [0 0 0.5]; botmiddle = [0 0.5 1]; middle = [1 1 1]; topmiddle = [1 0 0]; top = [0.5 0 0]; % Find middle lims = get(gca, 'CLim'); % Find ratio of negative to positive if (lims(1) < 0) & (lims(2) > 0) % It has both negative and positive % Find ratio of negative to positive ratio = abs(lims(1)) / (abs(lims(1)) + lims(2)); neglen = round(m*ratio); poslen = m - neglen; % Just negative new = [bottom; botmiddle; middle]; len = length(new); oldsteps = linspace(0, 1, len); newsteps = linspace(0, 1, neglen);
MATLAB & Practical Application on Climate Variability Studies 2 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

newmap1 = zeros(neglen, 3); for i=1:3 % Interpolate over RGB spaces of colormap newmap1(:,i) = min(max(interp1(oldsteps, new(:,i), newsteps)', 0), 1); end % Just positive new = [middle; topmiddle; top]; len = length(new); oldsteps = linspace(0, 1, len); newsteps = linspace(0, 1, poslen); newmap = zeros(poslen, 3); for i=1:3 % Interpolate over RGB spaces of colormap newmap(:,i) = min(max(interp1(oldsteps, new(:,i), newsteps)', 0), 1); end % And put 'em together newmap = [newmap1; newmap]; elseif lims(1) >= 0 % Just positive new = [middle; topmiddle; top]; len = length(new); oldsteps = linspace(0, 1, len); newsteps = linspace(0, 1, m); newmap = zeros(m, 3); for i=1:3 % Interpolate over RGB spaces of colormap newmap(:,i) = min(max(interp1(oldsteps, new(:,i), newsteps)', 0), 1); end else % Just negative new = [bottom; botmiddle; middle]; len = length(new); oldsteps = linspace(0, 1, len); newsteps = linspace(0, 1, m); newmap = zeros(m, 3); for i=1:3 % Interpolate over RGB spaces of colormap newmap(:,i) = min(max(interp1(oldsteps, new(:,i), newsteps)', 0), 1); end end

MATLAB & Practical Application on Climate Variability Studies 3 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

chisquare_inv.m
function X = chisquare_inv(P,V); %CHISQUARE_INV Inverse of chi-square cumulative distribution function (cdf). % % X = chisquare_inv(P,V) returns the inverse of chi-square cdf with V % degrees of freedom at fraction P. % This means that P*100 percent of the distribution lies between 0 and X. % % To check, the answer should satisfy: P==gammainc(X/2,V/2) % Uses FMIN and CHISQUARE_SOLVE % % Written January 1998 by C. Torrence if (nargin < 2), error('Must input both P and V');, end if ((1-P) < 1E-4), error('P must be < 0.9999');, end if ((P==0.95) & (V==2)) % this is a no-brainer X = 5.9915; return end MINN = 0.01; % hopefully this is small enough MAXX = 1; % actually starts at 10 (see while loop below) X = 1; TOLERANCE = 1E-4; % this should be accurate enough vers = version; vers = str2num(vers(1)); while ((X+TOLERANCE) >= MAXX) % should only need to loop thru once MAXX = MAXX*10.; % this calculates value for X, NORMALIZED by V % Note: We need two different versions, depending upon the version of Matlab. if (vers >= 6) X = fminbnd('chisquare_solve',MINN,MAXX,optimset('TolX',TOLERANCE),P,V); else X = fmin('chisquare_solve',MINN,MAXX,[0,TOLERANCE],P,V); end MINN = MAXX; end X = X*V; % put back in the goofy V factor

MATLAB & Practical Application on Climate Variability Studies 4 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

chisquare_solve.m
function PDIFF = chisquare_solve(XGUESS,P,V); %CHISQUARE_SOLVE Internal function used by CHISQUARE_INV % % PDIFF=chisquare_solve(XGUESS,P,V) Given XGUESS, a percentile P, % and degrees-of-freedom V, return the difference between % calculated percentile and P. % Uses GAMMAINC % % Written January 1998 by C. Torrence % extra factor of V is necessary because X is Normalized PGUESS = gammainc(V*XGUESS/2,V/2); % incomplete Gamma function PDIFF = abs(PGUESS - P); % error in calculated P

TOL = 1E-4; if (PGUESS >= 1-TOL) % if P is very close to 1 (i.e. a bad guess) PDIFF = XGUESS; % then just assign some big number like XGUESS end

MATLAB & Practical Application on Climate Variability Studies 5 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

ecolorbar.m
function [h0,h1]=ecolorbar(D,L,label,W,hand) % ECOLORBAR colorbar with discrete color axis % To be used with CONTOURF-plot. % % When contours (V) are given, the colorlimit ('Clim') property of % _both_ the plot and the colorbar is locked to the lower and upper % contourlevel. This should solve the problem of how to keep the same % color-to-data relationship from plot to plot. % % As a general rule, place the colorbar on a side of the graph that has % no ticklabels or title (right is this function's default). % % [h0,h1]=ecolorbar(D,L,label,W,hand) % % D = a) The contour-specification vector used when making the % CONTOURF-plot (the most robust method), % or b) The data-matrix of the CONTOURF-plot % (use when no contour-spec is given). % % L = String giving location of colorbar: % 't'op % 'b'ottom % 'r'ight (default) % 'l'eft % 'o'utside (when rescaling of graph is % undesireable) % 'a'lone (in a subplot when it refers to several % graphs in a subplot-figure) % % label = string for the color-axis-label (default= empty) % % W = Relative width (ratio of graph width/height) (default= 1/30) % % hand = handles to axes which the colorbar refers to. Use this to % ensure the right colorspan on all graphs and their colorbar. % % [h0,h1] are handles to the graph (h0) and to the colorbar (h1) % % NOTE1 : There is no opportunity to give single valued contourspecification % (the number of contours). I haven't gotten so far as to make that % robust, but then a well contemplated contourplot should always % have specified contourlevels. % % NOTE2 : CONTOURF scales CAXIS from the lowest input contourlevel to the % highest given contourlevel or max(max(data)) whichever is % greatest!!! :-( % ECOLORBAR locks the coloraxis of both plot and colorbar between % the first and last contourlevel, to ensure consistency. When % several axes 'share' same colorbar, the 'clim' property of all % axes should be set equal to the colorbar, by input of their % handles in 'hand'! % % Example 1: Difference from the ordinary colorbar-function: %------------------------------------------------------------------------% [x,y,z]=peaks; v=-10:2:8; % figure(1); clf; [cs,h]=contourf(x,y,z,v); clabel(cs,h); colorbar % figure(2); clf; [cs,h]=contourf(x,y,z,v); clabel(cs,h); ecolorbar(v); % And not using contourspecification:
MATLAB & Practical Application on Climate Variability Studies 6 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

% figure(3); clf; [cs,h]=contourf(x,y,z); clabel(cs,h); ecolorbar(z); % % Example 2: Not equidistant contours. %------------------------------------------------------------------------% figure(4); clf; v=[-8 -4 -2 -1 0 1 2 4 8]; % [cs,h]=contourf(x,y,z,v); clabel(cs,h); ecolorbar(v); % % See also CONTOURF LEVELS % ### Updates: ### % 00.10.17: Added options for "outside"- and "alone"-positioning % 99.11.19: I think I found the solution for the color-span problem. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%% % modified from my_colorbar by Tore Furevik, Geophysical Institute, % University of Bergen. % ECOLORBAR by Jan Even Nilsen: %Time-stamp:<Last updated on 01/01/30 at 12:04:59 by even@gfi.uib.no> %File:<d:/home/matlab/ecolorbar.m> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%% error(nargchk(1,5,nargin)); if nargin < 5 | isempty(hand) hand=[]; end if nargin < 4 | isempty(W) W=1/30; end if nargin < 3 | isempty(label) | ~ischar(label) label=''; end if nargin < 2 | isempty(L) L='r'; end outside=0; findstr(L,'o'); % check for "outside" if ans, outside=1; L=L(find([1:length(L)]~=ans)); if isempty(L), L='r'; end %if isempty(L), L='b'; end end alone=0; findstr(L,'a'); % check for "alone" if ans, alone=1; L=L(find([1:length(L)]~=ans)); if isempty(L), L='r'; end end % What D is input... if isvector(D) % D is a vector and therefore a contourspecification V=D; elseif ismatrix(D) % D is datafield and V is empty V=[]; else error('D must be a matrix (the datafield of the plot) or a vector (contours)!'); end % make data matrix for colorbar: if isempty(V) % using the data (range) [x,VC]=meshgrid(1:2,minmax(D)); else [x,VC]=meshgrid(1:2,V); % using the given contour-range
MATLAB & Practical Application on Climate Variability Studies 7 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

end % h0 = handle to the graph's axes ; h1 = handle to the colorbar's axes h0=gca; a=get(h0,'position'); if alone, set(h0,'visible','off'); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% switch L case 't' W=W*a(4); % placement of the colorbar: if findstr(get(h0,'XAxisLocation'),'top'),os=2*W; else os=W; end if outside h1=axes('position',[a(1) a(2)+a(4)+os a(3) W]); else set(h0,'position',[a(1) a(2) a(3) a(4)-W-os]); h1=axes('position',[a(1) a(2)+a(4)-W a(3) W]); end % plotting the colorbar: if isempty(V), [c,h]=contourf(VC',x',VC'); else [c,h]=contourf(VC',x',VC',V); end set(h1,'XAxisLocation','top','YTick',[]); % drawing the colorbars tickmarks: if isempty(V) lev=levels(c); tick=maketick([lev VC(2)]); % Choose ticks % Choose datapoints on which to put the ends of the colorbar: % one increment outside the contourlevel-range, % on the ends of the coloraxis, % or as it is from contourf making the bar % (as tight as possible) levl=length(lev);dlev=[lev(2)-lev(1) lev(levl)-lev(levl-1)]; cax=caxis; olim=get(h1,'Xlim'); grenser=[max([cax(1) olim(1) lev(1)-dlev(1)]) min([olim(2) lev(levl)+dlev(2)])]; tick=tick(find(tick>grenser(1))); else % just use the contour specification tick=maketick(V); grenser=[min(V) max(V)]; end set(h1,'XTick',tick,'Xlim',grenser); xlabel(label) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% case 'b' W=W*a(4); % placement of the colorbar: if findstr(get(h0,'XAxisLocation'),'bottom'),os=W*2; else os=W; end if outside h1=axes('position',[a(1) a(2)-os-W a(3) W]); else set(h0,'position',[a(1) a(2)+os+W a(3) a(4)-os-W]); h1=axes('position',[a(1) a(2) a(3) W]); end % plotting the colorbar: if isempty(V), [c,h]=contourf(VC',x',VC'); else [c,h]=contourf(VC',x',VC',V); end set(h1,'YTick',[]); % drawing the colorbars tickmarks: if isempty(V) lev=levels(c); tick=maketick([lev VC(2)]);
MATLAB & Practical Application on Climate Variability Studies 8 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

% Choose ticks % Choose datapoints on which to put the ends of the colorbar: levl=length(lev);dlev=[lev(2)-lev(1) lev(levl)-lev(levl-1)]; cax=caxis; olim=get(h1,'Xlim'); grenser=[max([cax(1) olim(1) lev(1)-dlev(1)]) min([olim(2) lev(levl)+dlev(2)])]; tick=tick(find(tick>grenser(1))); else % just use the contour specification tick=maketick(V); grenser=[min(V) max(V)]; end set(h1,'XTick',tick,'Xlim',grenser); xlabel(label) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% case 'r' %default W=W*a(3); % placement of the colorbar: if findstr(get(h0,'YAxisLocation'),'right'),os=W*2; else os=W; end if outside h1=axes('position',[a(1)+a(3)+os a(2) W a(4)]); else set(h0,'position',[a(1) a(2) a(3)-os-W a(4)]); h1=axes('position',[a(1)+a(3)-W a(2) W a(4)]); end % plotting the colorbar: if isempty(V), [c,h]=contourf(x,VC,VC); else [c,h]=contourf(x,VC,VC,V); end set(h1,'YAxisLocation','right','XTick',[]); % drawing the colorbars tickmarks: if isempty(V) lev=levels(c);tick=maketick([lev VC(2)]); % Choose ticks % Choose datapoints on which to put the ends of the colorbar: levl=length(lev);dlev=[lev(2)-lev(1) lev(levl)-lev(levl-1)]; cax=caxis; olim=get(h1,'Ylim'); grenser=[max([cax(1) olim(1) lev(1)-dlev(1)]) min([olim(2) lev(levl)+dlev(2)])]; tick=tick(find(tick>grenser(1))); else % just use the contour specification tick=maketick(V); grenser=[min(V) max(V)]; end set(h1,'YTick',tick,'Ylim',grenser); ylabel(label) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% case 'l' W=W*a(3); % placement of the colorbar: if findstr(get(h0,'YAxisLocation'),'left'),os=W*2; else os=W; end if outside h1=axes('position',[a(1) a(2)-os-W W a(4)]); else set(h0,'position',[a(1)+os+W a(2) a(3)-os-W a(4)]); h1=axes('position',[a(1) a(2) W a(4)]); end % plotting the colorbar: if isempty(V) [c,h]=contourf(x,VC,VC); else [c,h]=contourf(x,VC,VC,V); end set(h1,'XTick',[]); % drawing the colorbars tickmarks:
MATLAB & Practical Application on Climate Variability Studies 9 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

if isempty(V) lev=levels(c); tick=maketick([lev VC(2)]); % Choose ticks % Choose datapoints on which to put the ends of the colorbar: levl=length(lev);dlev=[lev(2)-lev(1) lev(levl)-lev(levl-1)]; cax=caxis; olim=get(h1,'Ylim'); grenser=[max([cax(1) olim(1) lev(1)-dlev(1)]) min([olim(2) lev(levl)+dlev(2)])]; tick=tick(find(tick>grenser(1))); else % just use the contour specification tick=maketick(V); grenser=[min(V) max(V)]; end set(h1,'YTick',tick,'Ylim',grenser); ylabel(label) end; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % set current axis pointer back on the graph: axes(h0); % lock the coloraxis onto the colorbar in both plot and bar: hand=hand(:)'; set([h0 h1 hand],'clim',grenser);

%------------------------------------------------------------function tick=maketick(lev) % make the number of ticklabels be less than 10 tick=lev; while length(tick)>10 tick=tick(1:2:length(tick)); end % no tick on the edges of colorbar %if max(tick)==max(lev) % tick=tick(1:length(tick)-1); %end

MATLAB & Practical Application on Climate Variability Studies 10 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

eof.m
function [u,lam,v,proj]=eof(z,modes) % % Compute the eof of matrices z (no masking case) % Andrea 4/1/06 % [uu,ss,vv]=svd(z,0); % Retain only few modes u=uu(:,1:modes); v=vv(:,1:modes); % Compute explained variances lam = diag(ss.^2)/sum(diag(ss.^2)); % Compute projections proj=z'*uu(:,1:modes); return

MATLAB & Practical Application on Climate Variability Studies 11 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

eofrot.m
function [coef,Arot,varrotated]=eofrot(z,index) % Algorithm for eof rotation with the varimax method % Difiere de la eofrot de Antonio, pues le agregue en el "sort" los RPC % (coef) % %Inputs: % z Data Matrix % index EOF to be rotated % %Outputs: % coef Cofficient for the rotated EOFs % Arot Rotated EOF in ascending order % varrotated Variance explained by rotated EOFs

% Time and space points [npoints,ntime]=size(z); % Compute unrotated EOF for variance calculation [uneof,ss,vneof]=svd(z,0); diag(ss); totvar = sum(diag(ss.^2)); lding = uneof(:,index); sl = diag(ss(index,index).^2); % variance explained by the unrotated modes varexpl = sum(sl)/totvar; [n,nf]=size(lding); b=lding; hl=lding*(diag(sl)); hjsq=diag(hl*hl'); hj=sqrt(hjsq); bh=lding./(hj*ones(1,nf));

% Normalize by the communalities

Vtemp=n*sum(sum(bh.^4))-sum(sum(bh.^2).^2);

% VARIMAX functional to be minimized

V0=Vtemp; for it=1:10; % Number of iterations for i=1:nf-1; % Program cycles through 2 factors jl=i+1; % at a time for j=jl:nf; xj=lding(:,i)./hj; % notation here closely yj=lding(:,j)./hj; % follows harman uj=xj.*xj-yj.*yj; vj=2*xj.*yj; A=sum(uj); B=sum(vj); C=uj'*uj-vj'*vj; D=2*uj'*vj; num=D-2*A*B/n; den=C-(A^2-B^2)/n; tan4p=num/den; phi=atan2(num,den)/4; angle=phi*180/pi;
MATLAB & Practical Application on Climate Variability Studies 12 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

[i j it angle]; if abs(phi)> eps; Xj=cos(phi)*xj+sin(phi)*yj; Yj=-sin(phi)*xj+cos(phi)*yj; bj1=Xj.*hj; bj2=Yj.*hj; b(:,i)=bj1; b(:,j)=bj2; lding(:,i)=b(:,i); lding(:,j)=b(:,j); end end end; lding=b; bh=lding./(hj*ones(1,nf)); Vtemp=n*sum(sum(bh.^4))-sum(sum(bh.^2).^2); V=Vtemp; fprintf(' Converging V V0 \n'); fprintf(' %f\n',[V V0]) if abs(V-V0)<.0001;break;else V0=V;end; end; % Reflect vectors with negative sums for i = 1:nf if sum(lding(:,i)) < 0 lding(:,i) = -lding(:,i); end end Arot=lding ; coef=z'*Arot(:,1:nf); whos Arot coef % rotated eof % time series for rotated eof

for i=1:nf varex(i) = sum(var(coef(:,i)*Arot(:,i)')*(ntime-1)); end varexpl varexplrot = sum(varex)/totvar zvar=sum(var(z')*(ntime-1)) totvar % Sort in decreasing order of variance whos varex varex [varex,I]=sort(varex); Arot=Arot(:,I); Arot = fliplr(Arot); coef=coef(:,I); coef=fliplr(coef); varex = flipud(varex');

varunrotated = sl/totvar varrotated = varex/totvar return


MATLAB & Practical Application on Climate Variability Studies 13 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

filtering.m
function [out]=filtering(in,type,dt) % % FILTERING Filter a time series. % USAGE: % [OUT] = FILTERING(IN,TYPE,DT) % IN = series to filter % TYPE = filter type : 'HP', 'LP', 'BP' % DT = number of subsampling for each year. % Filter main settings... n=1; % Filter order switch type case 'HP' % High pass filter highpass=7*dt; % Retain freq < 7 years fre=1/highpass; nyquist=1/2; [b,a] = butter(n,fre/nyquist,'high') case 'LP' % Low pass filter lowpass=7*dt; % Retain freq > 7 years fre=1/lowpass; nyquist=1/2; [b,a] = butter(n,fre/nyquist,'low') case 'BP' % Band pass, retain band 3<freq<6 highpass=6*dt; lowpass=3*dt; fre1=1/highpass; fre2=1/lowpass; nyquist=1/2; [b,a] = butter(n,[ fre1/nyquist fre2/nyquist ],'stop') end % end of main settings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Filtering ... res=size(in); nt=res(1) ndim=res(2) %campofilt = zeros([ nt ndim ]); for n=1:ndim n out(:,n) = filter(b,a,in(:,n)); end return;

MATLAB & Practical Application on Climate Variability Studies 14 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

gausslat.m
function [lat]=gausslat(res) % GAUSSLAT Retuns gaussian grid latitudes. % LAT=GAUSSLAT(RES) returns array LAT containing the % latitudes for the gaussian grid at RES resolution. % Supported resolutions are (case insensitive): % 'T21' : 64x32 Gaussian grid % 'T30' : 96x48 " " % 'T31' : same as T30 % 'T42' : 128x64 " " % 'T63' : 192x96 " " % 'T85' : % 'T106' : 320x160 " " % 'T159' : % n : nx(2*n) " " % % Example: % lat=gausslat('T30') ( or lat=gausslat(48) ) % % Derived from ECHAM5.2 source code (mo_gaussgrid.f90). % Tested again NEC SX-6 results for accuracy. % if (~ischar(res)) ngl=res; nlon=2*res; % ? else switch lower(res) case 't21' ngl=32; nlon=64; case {'t30','t31'} ngl=48; nlon=96; case 't42' ngl=64; nlon=128; case 't63' ngl=96; nlon=192; case 't106' ngl=160; nlon=320; otherwise error(['Unknow resolution: ' res '.']); end end % %api=3.14159265358979323846; api=pi; a=6371000; omega=0.7292E-4; % nhgl=ngl/2; % [zgmu,zgw]=gauaw(ngl); % for jgl=1:nhgl gl_gw(jgl)=zgw(jgl)*0.5;
MATLAB & Practical Application on Climate Variability Studies 15 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

gl_gw(ngl-jgl+1)=zgw(jgl)*0.5; gl_budw(jgl)=gl_gw(jgl)/nlon; gl_budw(ngl-jgl+1)=gl_gw(jgl)/nlon; end % for jlon=1:nlon % double size for rotated domains zl=2*api*(jlon-1.0)/nlon; % on decomposed grid sinlon(jlon)=sin(zl); sinlon(jlon+nlon)=sinlon(jlon); coslon(jlon)=cos(zl); coslon(jlon+nlon)=coslon(jlon); philon(jlon)=360*(jlon-1.0)/nlon; end % % Grid area stored from N - > S ! for jgl=1:nhgl gridarea(jgl)=gl_budw(jgl)*4*api*a^2; gridarea(ngl+1-jgl)=gridarea(jgl); philat(jgl)=180/api*asin(zgmu(jgl)); philat(ngl-jgl+1)=-philat(jgl); end % lat=philat; return %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%% function [pa,pw]=gauaw(nlat) % Compute Gaussian latitudes and weights % %api=3.14159265358979323846; api=pi; epsil = eps; %epsil=0.222044604925031E-15; itemax=20; % ins2=nlat/2+mod(nlat,2); % pa=ones(nlat).*NaN; pw=pa; % % Find first approximation of the roots of the % Legendre polynomial of degree nlat % for jgl=1:ins2 z=(4*jgl-1)*api/(4*nlat+2); pa(jgl)=cos(z+1.0/(tan(z)*(8*nlat^2))); end % % Computes roots and weights % Perform the Newton loop % Find 0 of Legendre polynomial with Newton loop % for jgl=1:ins2 za=pa(jgl); for iter=1:itemax+1 zk=0.0; % Newton iteration step zkm2=1.0; zkm1=za;
MATLAB & Practical Application on Climate Variability Studies 16 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

zx=za; for jn=2:nlat zk=((2*jn-1)*zx*zkm1-(jn-1)*zkm2)/jn; zkm2=zkm1; zkm1=zk; end zkm1=zkm2; zldn=(nlat*(zkm1-zx*zk))/(1.0-zx*zx); zmod=-zk/zldn; zxn=zx+zmod; zan=zxn; % computes weight zkm2=1.0; zkm1=zxn; zx=zxn; for jn=2:nlat zk=((2*jn-1)*zx*zkm1-(jn-1)*zkm2)/jn; zkm2=zkm1; zkm1=zk; end zkm1=zkm2; zw=(1.0-zx*zx)/((nlat*nlat)*zkm1*zkm1); za=zan; if (abs(zmod) <= epsil) break end end pa(jgl)=zan; pw(jgl)=2*zw; end % return %

MATLAB & Practical Application on Climate Variability Studies 17 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

gridcoord.m
function [lon,lat]=gridcoord(res,varargin) % GRIDCOORD Return grid coordinates. % [lon,lat]=GRIDCOORD(RES) returns the model or data grid % coordinates at resolution RES. % % [lon,lat]=GRIDCOORD(RES,PREC) same as above using PREC decimal digit % for latitudes. Useful with gaussian grids only. % % [lon,lat]=GRIDCOORD(RES,GRID) same as above using GRID-points grid. % Useful with ORCA oceanic model grids (T,U,V,W) only. % GRID types are (case insensitive): % 'T' : T-points grid % 'U' : U-points grid % 'V' : V-points grid % 'W' : W-points grid % % Supported resolutions (RES) are (case insensitive): % 'T21' : 64x32 Gaussian grid % 'T30' : 96x48 " " % 'T31' : same as T30 % 'T42' : 128x64 " " % 'T63' : 192x96 " " % 'T85' : % 'T106' : 320x160 " " % 'T159' : % % 'ORCA2' : ORCA grid at 2 degrees resolution. Output are 2D matrices. % % 'NCEP' : NCEP-NCAR Reanalysis Data-set 144x73 % 'GISST' : GISST Data-set 360x180 % % prec=3; % default precision if (nargin > 1) if (isnumeric(varargin{1})) prec=varargin{1}; if (prec<=0) error(['Error: precision is negative or null.']); elseif (prec==1) disp('Warning: one digit precision may be too small!'); end elseif (ischar(varargin{1})) if (length(varargin{1})==1 && ~isempty(findstr(upper(varargin{1}),'TUVW'))) gp=upper(varargin{1}); else error(['Error: wrong grid type ''' varargin{1} '''.']); end else error([varargin{1} ' is not a precision nor a grid type.']); end end % switch lower(res) case 't21' lat=round(gausslat('T21')*10^prec)/10^prec; lon=[0:5.625:360-5.625];
MATLAB & Practical Application on Climate Variability Studies 18 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

case {'t30','t31'} lat=round(gausslat('T30')*10^prec)/10^prec; lon=[0:3.75:360-3.75]; case 't42' lat=round(gausslat('T42')*10^prec)/10^prec; lon=[0:2.8125:360-2.8125]; case 't63' lat=round(gausslat('T63')*10^prec)/10^prec; lon=[0:1.875:360-1.875]; case 't106' lat=round(gausslat('T106')*10^prec)/10^prec; lon=[0:1.125:360-1.125]; case 'orca2' eval(['load orca_r2_' gp]); eval(['lat=lat_' gp ';']); eval(['lon=lon_' gp ';']); case 'ncep' lat=-90:2.5:90; lon=0:2.5:360-2.5; case 'gisst' lat=-89.5:1:89.5; lon=0.5:1:359.5; otherwise error(['Unknown grid tipe: ' res]); end % return %

MATLAB & Practical Application on Climate Variability Studies 19 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

iconturf.m
function [cout,H,CS] = icontourf(varargin) %ICONTOURF Improved filled contour plot. % ICONTOURF(...) is the same as CONTOUR(...) except that the contours % are filled. Areas of the data at or above a given level are filled. % Areas below a level are either left blank or are filled by a lower % level. NaN's in the data leave holes in the filled contour plot. % ICONTOURF differs from CONTOURF in the fact that allows not to plot % the line contours between shaded areas. % % ICONTOURF(...,'LINE_SPEC') accepts 'none' as line specification % and prevent contours from being displayed. % % See also CONTOUR, CONTOURF, CONTOUR3, CLABEL, COLORBAR. % Author: R. Pawlowicz (IOS) rich@ios.bc.ca 12/14/94 % Copyright (c) 1984-98 by The MathWorks, Inc. % $Revision: 1.23 $ $Date: 1998/04/09 13:17:29 $ % Modified by M. Vichi (INGV) error(nargchk(1,5,nargin)); % Check for empty arguments. for i = 1:nargin if isempty(varargin{i}) error ('Invalid Argument - Input matrix is empty'); end end % Trim off the last arg if it's a string (line_spec). nin = nargin; if isstr(varargin{end}) if (varargin{end} == 'none') lin = 'none'; col = ''; else [lin,col,mark,msg] = colstyle(varargin{end}); if ~isempty(msg), error(msg); end end nin = nin - 1; else lin = ''; col = ''; end if (nin == 4), [x,y,z,nv] = deal(varargin{1:4}); if (size(y,1)==1), y=y'; end; if (size(x,2)==1), x=x'; end; [mz,nz] = size(z); elseif (nin == 3), [x,y,z] = deal(varargin{1:3}); nv = []; if (size(y,1)==1), y=y'; end; if (size(x,2)==1), x=x'; end; [mz,nz] = size(z); elseif (nin == 2), [z,nv] = deal(varargin{1:2});
MATLAB & Practical Application on Climate Variability Studies 20 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

[mz,nz] = size(z); x = 1:nz; y = (1:mz)'; elseif (nin == 1), z = varargin{1}; [mz,nz] = size(z); x = 1:nz; y = (1:mz)'; nv = []; end if nin <= 2, [mc,nc] = size(varargin{1}); lims = [1 nc 1 mc]; else lims = [min(varargin{1}(:)),max(varargin{1}(:)), ... min(varargin{2}(:)),max(varargin{2}(:))]; end i = find(isfinite(z)); minz = min(z(i)); maxz = max(z(i)); % Generate default contour levels if they aren't specified if length(nv) <= 1 if isempty(nv) CS=contourc([minz maxz ; minz maxz]); else CS=contourc([minz maxz ; minz maxz],nv); end % Find the levels ii = 1; nv = minz; % Include minz so that the contours are totally filled while (ii < size(CS,2)), nv=[nv CS(1,ii)]; ii = ii + CS(2,ii) + 1; end end % Don't fill contours below the lowest level specified in nv. % To fill all contours, specify a value of nv lower than the % minimum of the surface. draw_min=0; if any(nv <= minz), draw_min=1; end % Get the unique levels nv = sort([minz nv(:)']); zi = [1, find(diff(nv))+1]; nv = nv(zi); % Surround the matrix by a very low region to get closed contours, and % replace any NaN with low numbers as well. zz=[ repmat(NaN,1,nz+2) ; repmat(NaN,mz,1) z repmat(NaN,mz,1) ; repmat(NaN,1,nz+2)]; kk=find(isnan(zz(:))); zz(kk)=minz-1e4*(maxz-minz)+zeros(size(kk)); xx = [2*x(:,1)-x(:,2), x, 2*x(:,nz)-x(:,nz-1)];
MATLAB & Practical Application on Climate Variability Studies 21 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

yy = [2*y(1,:)-y(2,:); y; 2*y(mz,:)-y(mz-1,:)]; if (min(size(yy))==1), [CS,msg]=contours(xx,yy,zz,nv); else [CS,msg]=contours(xx([ 1 1:mz mz],:),yy(:,[1 1:nz nz]),zz,nv); end; if ~isempty(msg), error(msg); end % Find the indices of the curves in the c matrix, and get the % area of closed curves in order to draw patches correctly. ii = 1; ncurves = 0; I = []; Area=[]; while (ii < size(CS,2)), nl=CS(2,ii); ncurves = ncurves + 1; I(ncurves) = ii; xp=CS(1,ii+(1:nl)); % First patch yp=CS(2,ii+(1:nl)); Area(ncurves)=sum( diff(xp).*(yp(1:nl-1)+yp(2:nl))/2 ); ii = ii + nl + 1; end newplot; if ~ishold, view(2); set(gca,'box','on'); set(gca,'xlim',lims(1:2),'ylim',lims(3:4)) end % Plot patches in order of decreasing size. This makes sure that % all the levels get drawn, not matter if we are going up a hill or % down into a hole. When going down we shift levels though, you can % tell whether we are going up or down by checking the sign of the % area (since curves are oriented so that the high side is always % the same side). Lowest curve is largest and encloses higher data % always. H=[]; [FA,IA]=sort(-abs(Area)); if ~isstr(get(gca,'color')), bg = get(gca,'color'); else bg = get(gcf,'color'); end if isempty(col) edgec = get(gcf,'defaultsurfaceedgecolor'); else edgec = col; end if isempty(lin) edgestyle = get(gcf,'defaultpatchlinestyle'); else edgestyle = lin; end % Tolerance for edge comparison xtol = 0.1*(lims(2)-lims(1))/size(z,2); ytol = 0.1*(lims(4)-lims(3))/size(z,1);
MATLAB & Practical Application on Climate Variability Studies 22 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

if nargout>0 cout = []; end for jj=IA, nl=CS(2,I(jj)); lev=CS(1,I(jj)); if (lev ~= minz | draw_min ), xp=CS(1,I(jj)+(1:nl)); yp=CS(2,I(jj)+(1:nl)); if (sign(Area(jj)) ~=sign(Area(IA(1))) ), kk=find(nv==lev); if (kk>1+sum(nv<=minz)*(~draw_min)), lev=nv(kk-1); else lev=NaN; % missing data section end end if (isfinite(lev)), H=[H;patch(xp,yp,lev,'facecolor','flat','edgecolor',edgec, ... 'linestyle',edgestyle,'userdata',lev)]; else H=[H;patch(xp,yp,lev,'facecolor',bg,'edgecolor',edgec, ... 'linestyle',edgestyle,'userdata',CS(1,I(jj)))]; end if nargout>0 xp(abs(xp - lims(1)) < xtol | abs(xp - lims(2)) < xtol) = NaN; yp(abs(yp - lims(3)) < ytol | abs(yp - lims(4)) < ytol) = NaN; cout = [cout,[lev xp;nl yp]]; end end end numPatches = length(H); if numPatches>1 for i=1:numPatches set(H(i), 'faceoffsetfactor', 0, 'faceoffsetbias', (1e-3)+(numPatches-i)/(numPatches-1)/30); end end

MATLAB & Practical Application on Climate Variability Studies 23 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

m2netcdf.m
function m2ncdf(m,varname,lev,lat,lon,output) % M2NETCDF create output file in netcdf format (output.nc), in the % current directory. % % Usage: % M2NETCDF(m,varname,lev,lat,lon,output,precision) % %m Input field. Its size must be N*M*L*I. % N = n of modes. % M = n of levels. % L = n of latitudes. % I = n of longitudes. % varname variable name. % lev level vector. % lat latitude vector. % lon longitude vector. % output output file name. %___________________________________________________________________________ if length(size(m)) ~=4, error('m must be N*M*L*I '); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%% m(isnan(m))=-999; %% ----------------------------- DEFINE THE FILE --------------------------- % ncquiet % No NetCDF warnings. nc = netcdf(output, 'clobber'); % Create NetCDF file. nc.description = 'NetCDF file EOFs exe'; % Global attributes. nc.author = 'Enrico'; nc.date = 'Jan 20, 2006'; %% ---------------------------- DEFINE DIMENSIONS --------------------------%% nc('latitude') = size(lat,1); nc('longitude') = size(lon,2); nc('lev') = size(lev,1); nc('mode')=size(m,1); %% ---------------------------- DEFINE VARIABLES --------------------------%% nc{'latitude'} = 'latitude'; nc{'longitude'} = 'longitude'; nc{'lev'} = {'lev'}; nc{'mode'} = {'mode'}; nc{varname} = {'mode', 'lev', 'latitude', 'longitude'}; %% ---------------------------- DEFINE ATTRIBUTES --------------------------%% nc{'latitude'}.units = 'degrees'; % Attributes. nc{'longitude'}.units = 'degrees'; nc{'lev'}.units = '[]'; nc{'mode'}.units = '[]'; nc{varname}.units = '[]'; nc{varname}.undef = '-999'; %% ---------------------------- STORE THE DATA ---------------------------- % nc{'latitude'}(:) = lat; nc{'longitude'}(:) = lon; nc{'lev'}(:) = lev; nc{'mode'}(:) = [1:1:size(m,1)]; nc{varname}(:) = m; nc = close(nc);

% Close the file.

MATLAB & Practical Application on Climate Variability Studies 24 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

map_global.m
function map_global( input_args ) % Plot a global map in eqd projection % Andrea 4/1/06 a4 axesm(... 'MapProjection','eqdcylin',... 'MapLatLimit',[-90 90],... 'Maplonlimit',[-180 180],... 'parallellabel','off',... 'meridianlabel','off',... 'labelformat','compass',... 'grid','on',... 'fontsize',8,... 'origin',[0 180 0]); load coast plotm(lat,long,'k') % Shading%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % h=pcolorm(axllat,axllon,u1e); % caxis([-3 3]); % colormap(jet(30)); % % % h=colormap; % % % h(1,:)=1; % % % colormap(h); % colorbar('horizon'); % shading interp; % % % % patchm(lat,long,[0.9 0.9 0.9]); % Contour %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Negative values % hold on; % [c1,h1]=contourm(axllat,axllon,var,[-4:0.2:-0.2],'b'); % set(h1,'linestyle','--','linewidth',1.0,'visible','on') % Positive values % hold on; % [c2,h2]=contourm(axllat,axllon,var,[0.2:0.2:2],'r'); % set(h2,'linestyle','-','linewidth',1.0,'visible','on') % Zero % hold on; % [c3,h3]=contourm(axllat,axllon,var,[ 0 0 ],'k'); % set(h3,'linestyle','-','linewidth',1.5,'visible','on') % hold on; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% return

MATLAB & Practical Application on Climate Variability Studies 25 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

map_sps.m
function map_sps( input_args ) % Plot a map in a sps projection % Andrea 11/1/06 a4 axesm(... 'MapProjection','stereo',... 'MapLatLimit',[-90 -40],... 'flatlimit', [-Inf 50],... 'parallellabel','off',... 'meridianlabel','off',... 'labelformat','compass',... 'grid','on',... 'fontsize',8,... 'origin',[-90 -90 0]); load coast plotm(lat,long,'k') % Shading%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % h=pcolorm(axllat,axllon,u1e); % caxis([-3 3]); % colormap(jet(30)); % % % h=colormap; % % % h(1,:)=1; % % % colormap(h); % colorbar('horizon'); % shading interp; % % % % patchm(lat,long,[0.9 0.9 0.9]); % Contour %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Negative values % hold on; % [c1,h1]=contourm(axllat,axllon,var,[-4:0.2:-0.2],'b'); % set(h1,'linestyle','--','linewidth',1.0,'visible','on') % Positive values % hold on; % [c2,h2]=contourm(axllat,axllon,var,[0.2:0.2:2],'r'); % set(h2,'linestyle','-','linewidth',1.0,'visible','on') % Zero % hold on; % [c3,h3]=contourm(axllat,axllon,var,[ 0 0 ],'k'); % set(h3,'linestyle','-','linewidth',1.5,'visible','on') % hold on; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% return

MATLAB & Practical Application on Climate Variability Studies 26 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

pacific_red_nonans_norm.m
function [field,field_std,ind]=pacific_red_nonans_norm(var,nonan) % pacific_red_nonans_norm % function to reduce to the % eq. pacific area (30S 30N - 130E 90W) % the ECHAM variables loaded from post-processed monthly ipcc data % and to normalize itself with std. % and finally cutting the nan values. %USAGE: % [FIELD,FIELD_STD,IND] = pacific_red_nonans_norm(VAR,nonan) % VAR = variable to reduce and normalize % NONAN = indexes to set as Nans in the spatial matrix % FIELD = variable reduced and normalizedwith std %FIELD_STD std of the original field used to normalize field % IND = indices of isnan value in var 2d spatial dimension uaf=size(var,1); vari2=var(:,:,53:108,117:241);%area eq. pacific 30S 30N - 130E 90W clima_vari2=squeeze(nanmean(vari2)); clima_vari3=clima_vari2; for k=1:uaf-1 clima_vari3=cat(4,clima_vari3,clima_vari2); end clima_vari3=permute(clima_vari3,[4 1 2 3]); ustra=vari2-clima_vari3; ustra22=reshape(permute(ustra,[2 1 3 4]),12*24,56,125); ustra22(isnan(ustra22))=nan; std_ustra22=nanstd(ustra22,0,1); norma_ustra22=ustra22./permute(repmat(squeeze(std_ustra22),[1 1],288),[3 1 2]); ustra3=reshape(norma_ustra22,12*24,56*125)'; notnans_ustra3=~isnan(ustra3); nans_ustra3=isnan(ustra3); tmp1=zeros(7000,1).*nan; ind=isnan(ustra3(:,1)); ustra4=ustra3; ustra4(nonan==1,:)=[]; std_ustra222=permute(repmat(squeeze(std_ustra22),[1 1],288),[3 1 2]); std_ustra222=reshape(std_ustra222,12*24,56*125)'; std_ustra222(nonan==1,:)=[]; field=ustra4; field_std=std_ustra222;

MATLAB & Practical Application on Climate Variability Studies 27 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

pc_plot.m
function pc_plot(tit,proj,mode) % Plotting the PC % Andrea 11/1/06 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%% a4l %subplot(412); sp=size(proj); h=plot(1:sp(1),proj(:,1)); set(h(1),'linewidth',1.5,'linestyle','-','color','b','marker','.'); grid on; xlabel('Years'); ylabel('Anomalies'); titstrPC = [ 'PC-' num2str(mode) ]; a=max(max(proj(:,1))) text('Position',[1,a],'String',titstrPC) title(tit); return

MATLAB & Practical Application on Climate Variability Studies 28 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

pc4_plot.m
function pc4_plot(tit,proj,stat2) % Plotting the PC % Andrea 11/1/06 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%% a4 sp=size(proj); subplot(411); mode=1 h=plot(1:sp(1),proj(:,mode)); set(h(1),'linewidth',1.5,'linestyle','-','color','b','marker','.'); grid on; xlabel('Years'); ylabel('Anomalies'); titstrPC = [ stat2 '-' num2str(mode) ]; title( [ titstrPC ', ' tit ] ); subplot(412); mode=2 h=plot(1:sp(1),proj(:,mode)); set(h(1),'linewidth',1.5,'linestyle','-','color','b','marker','.'); grid on; xlabel('Years'); ylabel('Anomalies'); titstrPC = [ stat2 '-' num2str(mode) ]; title( [ titstrPC ', ' tit ] ); subplot(413); mode=3 h=plot(1:sp(1),proj(:,mode)); set(h(1),'linewidth',1.5,'linestyle','-','color','b','marker','.'); grid on; xlabel('Years'); ylabel('Anomalies'); titstrPC = [ stat2 '-' num2str(mode) ]; title( [ titstrPC ', ' tit ] ); subplot(414); mode=4 h=plot(1:sp(1),proj(:,mode)); set(h(1),'linewidth',1.5,'linestyle','-','color','b','marker','.'); grid on; xlabel('Years'); ylabel('Anomalies'); titstrPC = [ stat2 '-' num2str(mode) ]; title( [ titstrPC ', ' tit ] );

return

MATLAB & Practical Application on Climate Variability Studies 29 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

project1pacific.m
axesm(... 'MapProjection','eqdcylin',... 'MapLatLimit',[-30 30],... 'Maplonlimit',[130 -90],... 'parallellabel','on',... 'meridianlabel','on',... 'labelformat','compass',... 'grid','on',... 'fontsize',8,... 'origin',[0 180 0]);

MATLAB & Practical Application on Climate Variability Studies 30 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

read_grd.m
function field=read_grd(fid,type,nx,ny,itt) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% % fuction to read a grd file %% % Input arguments: % fid the input file % type='direct'; (sequential) or (direct) % nx, ny indicates the dimension of the field % itt time lengh of the time series %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%% seq=strcmp(type,'sequential'); field=zeros([ nx*ny itt ]); for it=1:itt it if seq , fread(fid,1,'float32');, end; field(:,it)=fread(fid,nx*ny,'float32'); if seq , fread(fid,1,'float32');, end; end return

MATLAB & Practical Application on Climate Variability Studies 31 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

verify_grd_file_saving.m

script

% Script to verify the EOFs_Z500_OND.grd file created by DO_EOF.m % The plot created by this script must be equal to the % ./figures/EOF1_Z500_OND.jpeg plot. clear in=['EOFs_Z500_OND.grd']; % grd file saved in DO_EOF.m [fid,message]=fopen(in,'r','b') type='direct'; % 'direct' or 'sequential' resol = [145 73]; % N.B. resol(1) is 145 not 144! itt=8; % we are using modes as time [var]=read_grd(fid,type,resol(1),resol(2),itt); % 10512x25 ub2=reshape(var,resol(1),resol(2),itt); % 145x73x8 ub2=permute(ub2, [ 2 1 3 ]); % 73x145x8 alatg = [ -90:2.5:90 ]; % Infos about the grid along = [ 0:2.5:360 ]; [axllon,axllat]=meshgrid(along,alatg); mode=2; % mode to plot %% plotting the EOF map_global title ('verifica' ); h=pcolorm(axllat,axllon,ub2(:,:,mode)); tightmap caxis([-3 3]); cmap=colormap(jet(24)); % set N. of colors. cmap([12 13],:)=1; colorbar('horizon'); colormap(cmap); shading interp; hold on; [c3,h3]=contourm(axllat,axllon,ub2(:,:,mode),[ 0 0 ],'k'); set(h3,'linestyle','-','linewidth',1.5,'visible','on') hold on; load coast plotm(lat,long,'k')

MATLAB & Practical Application on Climate Variability Studies 32 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

Wavelet.m
%WAVELET 1D Wavelet transform with optional singificance testing % % [WAVE,PERIOD,SCALE,COI] = wavelet(Y,DT,PAD,DJ,S0,J1,MOTHER,PARAM) % % Computes the wavelet transform of the vector Y (length N), % with sampling rate DT. % % By default, the Morlet wavelet (k0=6) is used. % The wavelet basis is normalized to have total energy=1 at all scales. % % % INPUTS: % % Y = the time series of length N. % DT = amount of time between each Y value, i.e. the sampling time. % % OUTPUTS: % % WAVE is the WAVELET transform of Y. This is a complex array % of dimensions (N,J1+1). FLOAT(WAVE) gives the WAVELET amplitude, % ATAN(IMAGINARY(WAVE),FLOAT(WAVE) gives the WAVELET phase. % The WAVELET power spectrum is ABS(WAVE)^2. % Its units are sigma^2 (the time series variance). % % % OPTIONAL INPUTS: % % *** Note *** setting any of the following to -1 will cause the default % value to be used. % % PAD = if set to 1 (default is 0), pad time series with enough zeroes to get % N up to the next higher power of 2. This prevents wraparound % from the end of the time series to the beginning, and also % speeds up the FFT's used to do the wavelet transform. % This will not eliminate all edge effects (see COI below). % % DJ = the spacing between discrete scales. Default is 0.25. % A smaller # will give better scale resolution, but be slower to plot. % % S0 = the smallest scale of the wavelet. Default is 2*DT. % % J1 = the # of scales minus one. Scales range from S0 up to S0*2^(J1*DJ), % to give a total of (J1+1) scales. Default is J1 = (LOG2(N DT/S0))/DJ. % % MOTHER = the mother wavelet function. % The choices are 'MORLET', 'PAUL', or 'DOG' % % PARAM = the mother wavelet parameter. % For 'MORLET' this is k0 (wavenumber), default is 6. % For 'PAUL' this is m (order), default is 4. % For 'DOG' this is m (m-th derivative), default is 2. % % % OPTIONAL OUTPUTS: % % PERIOD = the vector of "Fourier" periods (in time units) that corresponds % to the SCALEs. %
MATLAB & Practical Application on Climate Variability Studies 33 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

% SCALE = the vector of scale indices, given by S0*2^(j*DJ), j=0...J1 % where J1+1 is the total # of scales. % % COI = if specified, then return the Cone-of-Influence, which is a vector % of N points that contains the maximum period of useful information % at that particular time. % Periods greater than this are subject to edge effects. % This can be used to plot COI lines on a contour plot by doing: % % contour(time,log(period),log(power)) % plot(time,log(coi),'k') % %---------------------------------------------------------------------------% Copyright (C) 1995-1998, Christopher Torrence and Gilbert P. Compo % University of Colorado, Program in Atmospheric and Oceanic Sciences. % This software may be used, copied, or redistributed as long as it is not % sold and this copyright notice is reproduced on each copy made. This % routine is provided as is without any express or implied warranties % whatsoever. % % Notice: Please acknowledge the use of this program in any publications: % ``Wavelet software was provided by C. Torrence and G. Compo, % and is available at URL: http://paos.colorado.edu/research/wavelets/''. % % Notice: Please acknowledge the use of the above software in any publications: % ``Wavelet software was provided by C. Torrence and G. Compo, % and is available at URL: http://paos.colorado.edu/research/wavelets/''. % % Reference: Torrence, C. and G. P. Compo, 1998: A Practical Guide to % Wavelet Analysis. <I>Bull. Amer. Meteor. Soc.</I>, 79, 61-78. % % Please send a copy of such publications to either C. Torrence or G. Compo: % Dr. Christopher Torrence Dr. Gilbert P. Compo % Advanced Study Program NOAA/CIRES Climate Diagnostics Center % National Center for Atmos. Research Campus Box 216 % P.O. Box 3000 University of Colorado at Boulder % Boulder CO 80307--3000, USA. Boulder CO 80309-0216, USA. % E-mail: chris@NO*SPAMrsinc.com E-mail: compo@NO*SPAMcolorado.edu % (remove NO*SPAM from email addresses) %---------------------------------------------------------------------------function [wave,period,scale,coi] = ... wavelet(Y,dt,pad,dj,s0,J1,mother,param); if (nargin < 8), param = -1;, end if (nargin < 7), mother = -1;, end if (nargin < 6), J1 = -1;, end if (nargin < 5), s0 = -1;, end if (nargin < 4), dj = -1;, end if (nargin < 3), pad = 0;, end if (nargin < 2) error('Must input a vector Y and sampling time DT') end n1 = length(Y); if (s0 == -1), s0=2*dt;, end if (dj == -1), dj = 1./4.;, end if (J1 == -1), J1=fix((log(n1*dt/s0)/log(2))/dj);, end if (mother == -1), mother = 'MORLET';, end %....construct time series to analyze, pad if necessary
MATLAB & Practical Application on Climate Variability Studies 34 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

x(1:n1) = Y - mean(Y); if (pad == 1) base2 = fix(log(n1)/log(2) + 0.4999); % power of 2 nearest to N x = [x,zeros(1,2^(base2+1)-n1)]; end n = length(x); %....construct wavenumber array used in transform [Eqn(5)] k = [1:fix(n/2)]; k = k.*((2.*pi)/(n*dt)); k = [0., k, -k(fix((n-1)/2):-1:1)]; %....compute FFT of the (padded) time series f = fft(x); % [Eqn(3)] %....construct SCALE array & empty PERIOD & WAVE arrays scale = s0*2.^((0:J1)*dj); period = scale; wave = zeros(J1+1,n); % define the wavelet array wave = wave + i*wave; % make it complex % loop through all scales and compute transform for a1 = 1:J1+1 [daughter,fourier_factor,coi,dofmin]=wave_bases(mother,k,scale(a1),param); wave(a1,:) = ifft(f.*daughter); % wavelet transform[Eqn(4)] end period = fourier_factor*scale; coi = coi*dt*[1E-5,1:((n1+1)/2-1),fliplr((1:(n1/2-1))),1E-5]; % COI [Sec.3g] wave = wave(:,1:n1); % get rid of padding before returning return

MATLAB & Practical Application on Climate Variability Studies 35 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

wave_bases.m
%WAVE_BASES 1D Wavelet functions Morlet, Paul, or DOG % % [DAUGHTER,FOURIER_FACTOR,COI,DOFMIN] = ... % wave_bases(MOTHER,K,SCALE,PARAM); % % Computes the wavelet function as a function of Fourier frequency, % used for the wavelet transform in Fourier space. % (This program is called automatically by WAVELET) % % INPUTS: % % MOTHER = a string, equal to 'MORLET' or 'PAUL' or 'DOG' % K = a vector, the Fourier frequencies at which to calculate the wavelet % SCALE = a number, the wavelet scale % PARAM = the nondimensional parameter for the wavelet function % % OUTPUTS: % % DAUGHTER = a vector, the wavelet function % FOURIER_FACTOR = the ratio of Fourier period to scale % COI = a number, the cone-of-influence size at the scale % DOFMIN = a number, degrees of freedom for each point in the wavelet power % (either 2 for Morlet and Paul, or 1 for the DOG) % %---------------------------------------------------------------------------% Copyright (C) 1995-1998, Christopher Torrence and Gilbert P. Compo % University of Colorado, Program in Atmospheric and Oceanic Sciences. % This software may be used, copied, or redistributed as long as it is not % sold and this copyright notice is reproduced on each copy made. This % routine is provided as is without any express or implied warranties % whatsoever. %---------------------------------------------------------------------------function [daughter,fourier_factor,coi,dofmin] = ... wave_bases(mother,k,scale,param); mother = upper(mother); n = length(k); if (strcmp(mother,'MORLET')) %----------------------------------- Morlet if (param == -1), param = 6.;, end k0 = param; expnt = -(scale.*k - k0).^2/2.*(k > 0.); norm = sqrt(scale*k(2))*(pi^(-0.25))*sqrt(n); % total energy=N [Eqn(7)] daughter = norm*exp(expnt); daughter = daughter.*(k > 0.); % Heaviside step function fourier_factor = (4*pi)/(k0 + sqrt(2 + k0^2)); % Scale-->Fourier [Sec.3h] coi = fourier_factor/sqrt(2); % Cone-of-influence [Sec.3g] dofmin = 2; % Degrees of freedom elseif (strcmp(mother,'PAUL')) %-------------------------------- Paul if (param == -1), param = 4.;, end m = param; expnt = -(scale.*k).*(k > 0.); norm = sqrt(scale*k(2))*(2^m/sqrt(m*prod(2:(2*m-1))))*sqrt(n); daughter = norm*((scale.*k).^m).*exp(expnt); daughter = daughter.*(k > 0.); % Heaviside step function fourier_factor = 4*pi/(2*m+1); coi = fourier_factor*sqrt(2); dofmin = 2;
MATLAB & Practical Application on Climate Variability Studies 36 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

elseif (strcmp(mother,'DOG')) %-------------------------------- DOG if (param == -1), param = 2.;, end m = param; expnt = -(scale.*k).^2 ./ 2.0; norm = sqrt(scale*k(2)/gamma(m+0.5))*sqrt(n); daughter = -norm*(i^m)*((scale.*k).^m).*exp(expnt); fourier_factor = 2*pi*sqrt(2./(2*m+1)); coi = fourier_factor/sqrt(2); dofmin = 1; else error('Mother must be one of MORLET,PAUL,DOG') end return

MATLAB & Practical Application on Climate Variability Studies 37 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

Wave_signif.m
%WAVE_SIGNIF Significance testing for the 1D Wavelet transform WAVELET % % [SIGNIF,FFT_THEOR] = ... % wave_signif(Y,DT,SCALE,SIGTEST,LAG1,SIGLVL,DOF,MOTHER,PARAM) % % INPUTS: % % Y = the time series, or, the VARIANCE of the time series. % (If this is a single number, it is assumed to be the variance...) % DT = amount of time between each Y value, i.e. the sampling time. % SCALE = the vector of scale indices, from previous call to WAVELET. % % % OUTPUTS: % % SIGNIF = significance levels as a function of SCALE % FFT_THEOR = output theoretical red-noise spectrum as fn of PERIOD % % % OPTIONAL INPUTS: % *** Note *** setting any of the following to -1 will cause the default % value to be used. % % SIGTEST = 0, 1, or 2. If omitted, then assume 0. % % If 0 (the default), then just do a regular chi-square test, % i.e. Eqn (18) from Torrence & Compo. % If 1, then do a "time-average" test, i.e. Eqn (23). % In this case, DOF should be set to NA, the number % of local wavelet spectra that were averaged together. % For the Global Wavelet Spectrum, this would be NA=N, % where N is the number of points in your time series. % If 2, then do a "scale-average" test, i.e. Eqns (25)-(28). % In this case, DOF should be set to a % two-element vector [S1,S2], which gives the scale % range that was averaged together. % e.g. if one scale-averaged scales between 2 and 8, % then DOF=[2,8]. % % LAG1 = LAG 1 Autocorrelation, used for SIGNIF levels. Default is 0.0 % % SIGLVL = significance level to use. Default is 0.95 % % DOF = degrees-of-freedom for signif test. % IF SIGTEST=0, then (automatically) DOF = 2 (or 1 for MOTHER='DOG') % IF SIGTEST=1, then DOF = NA, the number of times averaged together. % IF SIGTEST=2, then DOF = [S1,S2], the range of scales averaged. % % Note: IF SIGTEST=1, then DOF can be a vector (same length as SCALEs), % in which case NA is assumed to vary with SCALE. % This allows one to average different numbers of times % together at different scales, or to take into account % things like the Cone of Influence. % See discussion following Eqn (23) in Torrence & Compo. % % %---------------------------------------------------------------------------% Copyright (C) 1995-1998, Christopher Torrence and Gilbert P. Compo
MATLAB & Practical Application on Climate Variability Studies 38 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

% University of Colorado, Program in Atmospheric and Oceanic Sciences. % This software may be used, copied, or redistributed as long as it is not % sold and this copyright notice is reproduced on each copy made. This % routine is provided as is without any express or implied warranties % whatsoever. %---------------------------------------------------------------------------function [signif,fft_theor] = ... wave_signif(Y,dt,scale1,sigtest,lag1,siglvl,dof,mother,param); if (nargin < 9), param = -1;, end if (nargin < 8), mother = -1;, end if (nargin < 7), dof = -1;, end if (nargin < 6), siglvl = -1;, end if (nargin < 5), lag1 = -1;, end if (nargin < 4), sigtest = -1;, end if (nargin < 3) error('Must input a vector Y, sampling time DT, and SCALE vector') end n1 = length(Y); J1 = length(scale1) - 1; scale(1:J1+1) = scale1; s0 = min(scale); dj = log(scale(2)/scale(1))/log(2.); if (n1 == 1) variance = Y; else variance = std(Y)^2; end if (sigtest == -1), sigtest = 0;, end if (lag1 == -1), lag1 = 0.0;, end if (siglvl == -1), siglvl = 0.95;, end if (mother == -1), mother = 'MORLET';, end mother = upper(mother); % get the appropriate parameters [see Table(2)] if (strcmp(mother,'MORLET')) %---------------------------------- Morlet if (param == -1), param = 6.;, end k0 = param; fourier_factor = (4*pi)/(k0 + sqrt(2 + k0^2)); % Scale-->Fourier [Sec.3h] empir = [2.,-1,-1,-1]; if (k0 == 6), empir(2:4)=[0.776,2.32,0.60];, end elseif (strcmp(mother,'PAUL')) %-------------------------------- Paul if (param == -1), param = 4.;, end m = param; fourier_factor = 4*pi/(2*m+1); empir = [2.,-1,-1,-1]; if (m == 4), empir(2:4)=[1.132,1.17,1.5];, end elseif (strcmp(mother,'DOG')) %--------------------------------- DOG if (param == -1), param = 2.;, end m = param; fourier_factor = 2*pi*sqrt(2./(2*m+1)); empir = [1.,-1,-1,-1]; if (m == 2), empir(2:4) = [3.541,1.43,1.4];, end if (m == 6), empir(2:4) = [1.966,1.37,0.97];, end else error('Mother must be one of MORLET,PAUL,DOG') end
MATLAB & Practical Application on Climate Variability Studies 39 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

period = scale.*fourier_factor; dofmin = empir(1); % Degrees of freedom with no smoothing Cdelta = empir(2); % reconstruction factor gamma_fac = empir(3); % time-decorrelation factor dj0 = empir(4); % scale-decorrelation factor freq = dt ./ period; % normalized frequency fft_theor = (1-lag1^2) ./ (1-2*lag1*cos(freq*2*pi)+lag1^2); % [Eqn(16)] fft_theor = variance*fft_theor; % include time-series variance signif = fft_theor; if (dof == -1), dof = dofmin;, end if (sigtest == 0) % no smoothing, DOF=dofmin [Sec.4] dof = dofmin; chisquare = chisquare_inv(siglvl,dof)/dof; signif = fft_theor*chisquare ; % [Eqn(18)] elseif (sigtest == 1) % time-averaged significance if (length(dof) == 1), dof=zeros(1,J1+1)+dof;, end truncate = find(dof < 1); dof(truncate) = ones(size(truncate)); dof = dofmin*sqrt(1 + (dof*dt/gamma_fac ./ scale).^2 ); % [Eqn(23)] truncate = find(dof < dofmin); dof(truncate) = dofmin*ones(size(truncate)); % minimum DOF is dofmin for a1 = 1:J1+1 chisquare = chisquare_inv(siglvl,dof(a1))/dof(a1); signif(a1) = fft_theor(a1)*chisquare; end elseif (sigtest == 2) % time-averaged significance if (length(dof) ~= 2) error('DOF must be set to [S1,S2], the range of scale-averages') end if (Cdelta == -1) error(['Cdelta & dj0 not defined for ',mother, ... ' with param = ',num2str(param)]) end s1 = dof(1); s2 = dof(2); avg = find((scale >= s1) & (scale <= s2)); % scales between S1 & S2 navg = length(avg); if (navg == 0) error(['No valid scales between ',num2str(s1),' and ',num2str(s2)]) end Savg = 1./sum(1 ./ scale(avg)); % [Eqn(25)] Smid = exp((log(s1)+log(s2))/2.); % power-of-two midpoint dof = (dofmin*navg*Savg/Smid)*sqrt(1 + (navg*dj/dj0)^2); % [Eqn(28)] fft_theor = Savg*sum(fft_theor(avg) ./ scale(avg)); % [Eqn(27)] chisquare = chisquare_inv(siglvl,dof)/dof; signif = (dj*dt/Cdelta/Savg)*fft_theor*chisquare; % [Eqn(26)] else error('sigtest must be either 0, 1, or 2') end return

MATLAB & Practical Application on Climate Variability Studies 40 EXERCISES B.Aires, 20-24/02/06 - Centro de Investigaciones del Mar y la Atmosfera, Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro, A.F.Carril

Você também pode gostar