Commit e69ad1fa authored by dumoda01's avatar dumoda01

narr2gotm.m produit les fichiers momentum_flux. Reste a produire les heat_flux...

parent fa31f137
......@@ -24,24 +24,26 @@ end
% Time scale given in Matlab serial date number
ncfile = ['uwnd.narr.',name,'.',yrstr,'.nc'];
t = nc_varget(ncfile,'TIME');
t1 = nc_varget(ncfile,'TIME');
tunits = nc_attget(ncfile,'TIME','units');
init_date = datenum([year 01 01 00 00 00]);
tlength = length(t);
tlength = length(t1);
delta_t = t(2)-t(1);
delta_t = t1(2)-t1(1);
if strfind(tunits,'seconds');
time = t./86400;
time = t1./86400;
time = time - time(1) + init_date;
timevec = datevec(time);
end
if strfind(tunits,'hours');
time = t./24;
time = t1./24;
time = time - time(1) + init_date;
timevec = datevec(time);
end
if strfind(tunits,'days');
time = t;
time = t1;
time = time - time(1) + init_date;
timevec = datevec(time);
end
timevec = datevec(time);
......@@ -88,7 +90,6 @@ uwnd = nc_varget(ncfile,'UWND');
ncfile = ['vwnd.narr.',name,'.',yrstr,'.nc'];
vwnd = nc_varget(ncfile,'VWND');
% Wind stress calculation
% cf. Stewart, R.H. (2002) Introduction to Physical Oceanography
rho = 1.3; % density of air (kg m^-3)
......@@ -108,11 +109,7 @@ for l = 1:tlength
end
end
% C10 = 2.18e-3 .* C10;
% C10(U >=3 && U < 6) = (0.29 + 3.1./U + 7.7./U.^2).*1e-3;
% C10(U >= 6) = (0.60 + 0.070.*U).*1e-3; % Yelland and Taylor (1996)
% C10 = (0.75 + 0.065.*U).*1e-3; % Garratt (1977)
% C10 = (0.75 + 0.065.*U).*1e-3; % Garratt (1977)
dir = atan2(vwnd,uwnd); % wind direction (rad)
tau = rho.*C10.*U.*U; % wind stress amplitude (N m^-2)
taux = tau.*cos(dir); % zonal wind stress (N m^-2)
......@@ -132,27 +129,31 @@ for n = 1:nloc
array(:,7) = squeeze(taux(:,iloc(n),jloc(n)));
array(:,8) = squeeze(tauy(:,iloc(n),jloc(n)));
if n < 10
memstr = ['00',num2str(n)];
elseif n < 100
memstr = ['0',num2str(n)];
else
memstr = num2str(n);
for m = 1:3
mem = n + (m - 1).*nloc + m - 1;
if mem < 10
memstr = ['00',num2str(mem)];
elseif n < 100
memstr = ['0',num2str(mem)];
else
memstr = num2str(mem);
end
fid = fopen(['narr_momentumflux_',yrstr,'_',memstr,'.dat'], 'wt');
fprintf(fid, '%4.0f-%02.0f-%02.0f %02.0f:%02.0f:%02.0f\t%f\t%f\n', ...
array');
fclose(fid);
tau = sqrt(array(:,7).^2 + array(:,8).^2);
plot(time,tau,'Color',[0.7 0.7 0.7]);
hold on
end
fid = fopen(['narr_momentumflux_',yrstr,'_',memstr,'.dat'], 'wt');
fprintf(fid, '%4.0f-%02.0f-%02.0f %02.0f:%02.0f:%02.0f\t%f\t%f\n', ...
array');
fclose(fid);
tau = sqrt(array(:,7).^2 + array(:,8).^2);
plot(time,tau,'Color',[0.7 0.7 0.7]);
hold on
end
% Average file
% Average file 000
array = nan .* ones(tlength,8);
array(:,1:6) = timevec;
array(:,7) = mean(mean(taux(:,8:12,7:9),3),2);
......@@ -165,12 +166,9 @@ fclose(fid);
tau = sqrt(array(:,7).^2 + array(:,8).^2);
plot(time,tau,'-k');
hold off
%% Incoming shortwave radiative flux and surface heat flux
% from NARR 3-hourly reanalysis
% ----------------------------------------------------------------------
ncfile = ['dswrf.narr.',name,'.',yrstr,'.nc'];
dswrf = nc_varget(ncfile,'DSWRF'); % W/m^2
......@@ -180,30 +178,57 @@ dswrf(dswrf < 0.0) = 0.0;
ncfile = ['uswrf.narr.',name,'.',yrstr,'.nc'];
uswrf = nc_varget(ncfile,'USWRF'); % W/m^2
ncfile = ['dlwrf].narr.',name,'.',yrstr,'.nc'];
ncfile = ['dlwrf.narr.',name,'.',yrstr,'.nc'];
dlwrf = nc_varget(ncfile,'DLWRF'); % W/m^2
ncfile = ['ulwrf].narr.',name,'.',yrstr,'.nc'];
ncfile = ['ulwrf.narr.',name,'.',yrstr,'.nc'];
ulwrf = nc_varget(ncfile,'ULWRF'); % W/m^2
ncfile = ['shtfl].narr.',name,'.',yrstr,'.nc'];
ncfile = ['shtfl.narr.',name,'.',yrstr,'.nc'];
shtfl = nc_varget(ncfile,'SHTFL'); % W/m^2
ncfile = ['lhtfl].narr.',name,'.',yrstr,'.nc'];
ncfile = ['lhtfl.narr.',name,'.',yrstr,'.nc'];
lhtfl = nc_varget(ncfile,'LHTFL'); % W/m^2
% Transmitted shortwave radiative flux
% that include the extinction due to the ice cover
% Canadian Ice Service
eval(['load cis_icec_',yrstr])
% eval(['load cis_icec_',yrstr])
% ECMWF
ncfile = ['ci.',yrstr,'.nc'];
icec = nc_varget(ncfile,'CI');
ci = nc_varget(ncfile,'ci');
t2 = nc_varget(ncfile,'time');
t2 = double(t2);
tunits = nc_attget(ncfile,'time','units');
init_date = datenum([year 01 01 00 00 00]);
tlength = length(t2);
if strfind(tunits,'seconds');
time2 = t2./86400;
time2 = time2 - time2(1) + init_date;
timevec = datevec(time2);
end
if strfind(tunits,'hours');
time2 = t2./24;
time2 = time2 - time2(1) + init_date;
timevec = datevec(time2);
end
if strfind(tunits,'days');
time2 = t2;
time2 = time2 - time2(1) + init_date;
timevec = datevec(time2);
end
% Indices over the Amundsen Gulf
iecmwf = [3 4 5];
jecmwf = [2 2 2];
iecmwf = [2 2 2];
jecmwf = [3 4 5];
necmwf = length(iecmwf);
for m = 1:necmwf
icec(:,m) = squeeze(ci(:,iecmwf(m),jecmwf(m)));
end
swr = (dswrf - uswrf).*(1.0-icec);
for ii = 1:length(swr)
......@@ -211,17 +236,12 @@ for ii = 1:length(swr)
swr(ii) = 0.0;
end
end
% No ice effect
% swr = (dswrf - uswrf);
% Total heat flux (minus the shortwave)
% positive = towards the ocean surface
% qt = dlwrf - ulwrf + shtfl + lhtfl; (????)
% that include the insulation due to the ice cover
% (Data from D. Barber group)
qt = (dlwrf - ulwrf + shtfl + lhtfl) .* (1.0-icec);
% No ice effect
% qt = dlwrf - ulwrf + shtfl + lhtfl;
qt_001 = (dlwrf - ulwrf + shtfl + lhtfl) .* (1.0-icec_001);
figure; plot(time,qt)
figure; plot(time,swr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment