-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathW_Croco1990_2010.m
More file actions
90 lines (65 loc) · 2.2 KB
/
W_Croco1990_2010.m
File metadata and controls
90 lines (65 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
clear all; close all; clc
cd /Volumes/BM_2022_x/Hindcast_1990_2010/depths
mask=ncread('/Volumes/BM_2022_x/Hindcast_1990_2010/means/Mean_Y2010M12.nc','mask_rho');
LON=ncread('/Volumes/BM_2022_x/Hindcast_1990_2010/means/Mean_Y2010M12.nc','lon_rho'); %lon lat s_rho time
LAT=ncread('/Volumes/BM_2022_x/Hindcast_1990_2010/means/Mean_Y2010M12.nc','lat_rho');
mask(mask==0)=NaN;
hdir=dir('Depth_Y*.mat');
vardir=dir('var_Y*.mat');
yr=1990:2010;
mo=1:12;
Wmld=zeros(size(LON,2),size(LON,1),length(hdir));
%wind=zeros(size(LON,2),size(LON,1),length(hdir));
%figure
jj=0;
Wmld_sum=0;
for iy=yr(1):1:yr(end)
for imo=mo(1):1:mo(end)
fn_depth=sprintf('Depth_Y%dM%d.mat',iy,imo);
fn_var=sprintf('var_Y%dM%d.mat',iy,imo);
disp(fn_var)
z=struct2array(load(fn_depth,'z'));
load(fn_var);
ww=permute(w,[3 2 1 4]);
w_interp_mld = winterp_mld(ww, z,mld');
% pcolor(LON',LAT',w_interp_mld.*mask'); shading flat; colorbar;
% title(['W velocity at MLD - ' fn_var(5:end-4)]); cmocean deep;
% caxis([-1*10^(-4) 1*10^(-4)]);
%
% pause(1)
% clf
jj=jj+1;
Wmld(:,:,jj)=w_interp_mld;
%wind(:,:,jj)=wind10';
end
end
%%
%save('MLD_W.mat','Wmld','wind');
save('MLD_W_1990_2010.mat','Wmld');
%%
clear all; close all; clc
cd /Users/dlizarbe/Documents/DANIEL/depths
% mask=ncread('/Volumes/BM_2022_x/Hindcast_1990_2010/means/Mean_Y2010M12.nc','mask_rho');
% LON=ncread('/Volumes/BM_2022_x/Hindcast_1990_2010/means/Mean_Y2010M12.nc','lon_rho'); %lon lat s_rho time
% LAT=ncread('/Volumes/BM_2022_x/Hindcast_1990_2010/means/Mean_Y2010M12.nc','lat_rho');
%mask(mask==0)=NaN;
hdir=dir('Depth_Y*.mat');
%vardir=dir('var_Y200*.mat');
yr=1990:2010;
mo=1:12;
sumData=0;
%jj=0;
for iy=yr(1):1:yr(end)
for imo=mo(1):1:mo(end)
fn_depth=sprintf('Depth_Y%dM%d.mat',iy,imo);
z=struct2array(load(fn_depth,'z'));
zz=permute(z,[2 3 1]);
disp(fn_depth)
%jj=jj+1;
%z_all(:,:,:,jj)=zz;
sumData=sumData+zz;
end
end
%%
Z_mean=sumData./length(hdir);
save('Z_1990_2010.mat','Z_mean');