| 1 |
%DEF Field projection on 3D surface |
| 2 |
|
| 3 |
|
| 4 |
% Which variables to plot: |
| 5 |
%wvar = [1 2 3 4 6]; |
| 6 |
wvar = [1]; |
| 7 |
|
| 8 |
for ip = 1 : length(wvar) |
| 9 |
|
| 10 |
figure(30+ip);clf;hold on;iw=1;jw=1; |
| 11 |
|
| 12 |
% Variables loop: |
| 13 |
% Default: |
| 14 |
CBAR = 'v'; % Colorbar orientation |
| 15 |
Tcontour = [17 19]; Tcolor = [0 0 0]; % Theta contours |
| 16 |
Hcontour = -[0:200:600]; Hcolor = [0 0 0]; % MLD contours |
| 17 |
unit = ''; % Default unit |
| 18 |
load mapanom2 ; N = 256; c = [0 0]; cmap = jet; % Colormaping |
| 19 |
showT = 1; % Iso-Theta contours |
| 20 |
showW = 0; % Windstress arrows |
| 21 |
showH = 0; colorW = 'w'; % Mixed Layer Depth |
| 22 |
showCLIM = 0; % Show CLIMODE region box |
| 23 |
CONT = 0; % Contours instead of pcolor |
| 24 |
CONTshlab = 0; % Show label for contours plot |
| 25 |
colorCOAST = [0 0 0]; % Land color |
| 26 |
|
| 27 |
%if it==1, mini; end |
| 28 |
switch wvar(ip) |
| 29 |
|
| 30 |
end %switch what to plot |
| 31 |
|
| 32 |
C = Diso; |
| 33 |
Clon = STlon; |
| 34 |
Clat = STlat; |
| 35 |
% Replace land by zero: |
| 36 |
STs = squeeze(ST(1,:,:)); |
| 37 |
%C(isnan(STs)) = 0; |
| 38 |
|
| 39 |
C2 = Qiso; |
| 40 |
% Replace land by zero: |
| 41 |
Qs = squeeze(Q(1,:,:)); |
| 42 |
C2(isnan(Qs)) = 0; |
| 43 |
% Replace ocean surface area of Diso by surface value of Q: |
| 44 |
%C2(isnan(C)) = -10; |
| 45 |
C2(isnan(C)) = Qs(isnan(C)); |
| 46 |
|
| 47 |
% Then replace NaN surface value of Diso by 0 |
| 48 |
C(isnan(C)) = 0; |
| 49 |
C2(isnan(C2)) = 10; |
| 50 |
|
| 51 |
LON = [min(Clon) max(Clon)]; |
| 52 |
LAT = [min(Clat) max(Clat)]; |
| 53 |
%LON = [277 299]; |
| 54 |
LAT = [26 40]; |
| 55 |
C = squeeze(C( max(find(Clat<=LAT(1))):max(find(Clat<=LAT(2))) , : )); |
| 56 |
C = squeeze(C( : , max(find(Clon<=LON(1))):max(find(Clon<=LON(2))) )); |
| 57 |
C2=squeeze(C2( max(find(Clat<=LAT(1))):max(find(Clat<=LAT(2))) , : )); |
| 58 |
C2=squeeze(C2( : , max(find(Clon<=LON(1))):max(find(Clon<=LON(2))))); |
| 59 |
Clon = squeeze(Clon( max(find(Clon<=LON(1))):max(find(Clon<=LON(2))) )); |
| 60 |
Clat = squeeze(Clat( max(find(Clat<=LAT(1))):max(find(Clat<=LAT(2))) )); |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
if 0 |
| 65 |
nlon = length(Clon); |
| 66 |
nlat = length(Clat); |
| 67 |
[lati longi] = meshgrid(Clat,Clon); |
| 68 |
%longi = longi'; lati = lati'; |
| 69 |
|
| 70 |
new_dimension = fix([1*nlon .5*nlat]); |
| 71 |
n_nlon = new_dimension(1); |
| 72 |
n_nlat = new_dimension(2); |
| 73 |
n_Clon = interp1(Clon,[1:fix(nlon/n_nlon):nlon],'cubic')'; |
| 74 |
n_Clat = interp1(Clat,[1:fix(nlat/n_nlat):nlat],'cubic')'; |
| 75 |
[n_lati n_longi] = meshgrid(n_Clat,n_Clon); |
| 76 |
n_lati = n_lati'; n_longi = n_longi'; |
| 77 |
|
| 78 |
n_C = interp2(lati,longi,C',n_lati,n_longi,'spline'); |
| 79 |
|
| 80 |
n_C(find(n_C==0)) = NaN; |
| 81 |
n_C = lisse(n_C,5,5); |
| 82 |
|
| 83 |
end %if |
| 84 |
|
| 85 |
|
| 86 |
%C(find(C==0)) = NaN; |
| 87 |
%C = lisse(C,2,2); |
| 88 |
%C2 = lisse(C2,2,2); |
| 89 |
|
| 90 |
% Map projection: |
| 91 |
%m_proj('mercator','long',subdomain.limlon,'lat',subdomain.limlat); |
| 92 |
%m_proj('mercator','long',subdomain.limlon,'lat',[25 40]); |
| 93 |
%m_proj('mercator','long',[subdomain.limlon(1) 360-24],'lat',[25 50]); |
| 94 |
%m_proj('mercator','long',Clon([1 length(Clon)])','lat',Clat([1 length(Clat)])'); |
| 95 |
%m_proj('mercator','long',Clon([1 length(Clon)])','lat',[15 40]); |
| 96 |
%m_proj('mercator','long',[275 330],'lat',[15 40]); |
| 97 |
|
| 98 |
camx = [-200:20:200]; |
| 99 |
az = [-30:10:30]; |
| 100 |
az = 5; |
| 101 |
el = linspace(5,50,length(az)); |
| 102 |
el = 20*ones(1,length(az)); |
| 103 |
|
| 104 |
for ii = 1 : length(az) |
| 105 |
|
| 106 |
clf |
| 107 |
%surf(n_Clon,n_Clat,n_C); |
| 108 |
s=surf(Clon,Clat,C); |
| 109 |
%[X,Y] = m_ll2xy(Clon,Clat); |
| 110 |
%s=surf(X,Y,C); |
| 111 |
|
| 112 |
set(s,'cdata',C2); |
| 113 |
N = 32; |
| 114 |
%c = [1 30]; |
| 115 |
%cx = [-(1+2*c(1)) 1+2*c(2)]*1.5e-12; cmap = mapanom; cmap = jet; |
| 116 |
c = [0 12]; |
| 117 |
cx = [-(1+2*c(1)) 1+2*c(2)]*.95*1e-9; cmap = mapanom; %cmap = jet; |
| 118 |
cmap = [logcolormap(N,c(1),c(2),cmap); .3 .3 .3]; % Last value is for NaN |
| 119 |
%cmap = 1 - cmap; |
| 120 |
colormap(cmap); |
| 121 |
caxis(cx); %colorbar |
| 122 |
|
| 123 |
|
| 124 |
shading interp |
| 125 |
view(az(ii),el(ii)) |
| 126 |
%set(gca,'ylim',[15 40]); |
| 127 |
%set(gca,'xlim',[275 330]); |
| 128 |
grid on |
| 129 |
xlabel('Longitude'); |
| 130 |
ylabel('Latitude'); |
| 131 |
zlabel('Depth'); |
| 132 |
|
| 133 |
%h = camlight('left'); %set(h,'color',[0 0 0]); |
| 134 |
%camlight |
| 135 |
l=light('position',[0 0 1]); |
| 136 |
light('position',[0 0 -1]); |
| 137 |
%set(h,'position',[150 -200 2000]); |
| 138 |
%set(h,'style','infinite') |
| 139 |
lighting flat |
| 140 |
material dull |
| 141 |
|
| 142 |
%set(gca,'plotBoxAspectRatio',[2 2 .5]) |
| 143 |
%m_coast('color',[0 0 0]) |
| 144 |
camzoom(2) |
| 145 |
camzoom(1.25) |
| 146 |
|
| 147 |
set(gca,'plotBoxAspectRatio',[2 2 .25]) |
| 148 |
set(gca,'visible','off'); |
| 149 |
%camzoom(1.1) |
| 150 |
%for ix=1:length(camx) |
| 151 |
% set(h,'position',[camx(ix) -200 2000]); |
| 152 |
% refresh;drawnow |
| 153 |
%M(ii) = getframe; |
| 154 |
%end |
| 155 |
|
| 156 |
|
| 157 |
if 0 |
| 158 |
xlim = get(gca,'xlim'); |
| 159 |
ylim = get(gca,'ylim'); |
| 160 |
lC=[0 0 1]; |
| 161 |
for x = 280:10:340 |
| 162 |
if x >= xlim(1) & x <= xlim(2) |
| 163 |
line([1 1]*x,ylim,'color',lC); |
| 164 |
end |
| 165 |
end %for x |
| 166 |
for y = 0 : 10 : 90 |
| 167 |
if y >= ylim(1) & y <= ylim(2) |
| 168 |
line(xlim,[1 1]*y,'color',lC) |
| 169 |
end |
| 170 |
end %for y |
| 171 |
end |
| 172 |
|
| 173 |
|
| 174 |
if 1 % Show the date in big in the upper left corner |
| 175 |
spp=subplot('position',[0 .95 .25 .05]); |
| 176 |
p=patch([0 1 1 0],[0 0 1 1],'w'); |
| 177 |
set(spp,'ytick',[],'xtick',[]); |
| 178 |
set(spp,'box','off'); |
| 179 |
dat = num2str(TIME(it,:)); |
| 180 |
dat = strcat(dat(1:4),'/',dat(5:6),'/',dat(7:8),':',dat(9:10),'H',dat(11:12)); |
| 181 |
text(0.1,.5,dat,'fontsize',16,... |
| 182 |
'fontweight','bold','color','r','verticalalign','middle'); |
| 183 |
end |
| 184 |
|
| 185 |
end |
| 186 |
%return |
| 187 |
|
| 188 |
%%%%%%%%%%%%%%%% |
| 189 |
drawnow |
| 190 |
set(gcf,'position',[4 48 888 430]); |
| 191 |
%videotimeline(TIME,it,'b') |
| 192 |
%videotimeline(num2str(zeros(size(TIME,1),1)),it,'b') |
| 193 |
set(gcf,'color','white') |
| 194 |
if prtimg |
| 195 |
%set(findobj('tag','m_grid_color'),'facecolor','none') |
| 196 |
set(gcf,'paperposition',[0.6 6.5 25 14]); |
| 197 |
titf='3Dview'; |
| 198 |
exportj(gcf,1,strcat(outimg,sla,titf,'.',snapshot)); |
| 199 |
end %if |
| 200 |
|
| 201 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
end %for ip |