Commit fa31f137 authored by dumoda01's avatar dumoda01

En developpement ...

parent 75b6f144
......@@ -23,10 +23,28 @@ else
end
% Time scale given in Matlab serial date number
ncfile = ['uwnd.narr.',name,'.',yrstr,'.nc'];
t = nc_varget(ncfile,'TIME');
tunits = nc_attget(ncfile,'TIME','units');
init_date = datenum([year 01 01 00 00 00]);
time = [init_date:1/24:init_date+nod-1/24]';
tlength = length(t);
delta_t = t(2)-t(1);
if strfind(tunits,'seconds');
time = t./86400;
time = time - time(1) + init_date;
timevec = datevec(time);
end
if strfind(tunits,'hours');
time = t./24;
time = time - time(1) + init_date;
end
if strfind(tunits,'days');
time = t;
time = time - time(1) + init_date;
end
timevec = datevec(time);
tlength = length(time);
%% Horizontal coordinates
......@@ -37,31 +55,29 @@ lat = nc_varget(ncfile,'LAT');
%% Choosing members
% Indices of chosen locations
i_loc = [5 5 6 6 6 7 7 7 8 8 8 9];
j_loc = [4 5 3 4 5 3 4 5 3 4 5 3];
nloc = length(i_loc);
iloc = [ 7 7 7 7 ...
8 8 8 8 8 ...
9 9 9 9 9 9 ...
10 10 10 10 10 10 ...
11 11 11 11 11 11 ...
12 12 12 12 12 12 ...
13 13 13 13 13];
jloc = [ 8 9 10 11 ...
7 8 9 10 11 ...
6 7 8 9 10 11 ...
6 7 8 9 10 11 ...
5 6 7 8 9 10 ...
5 6 7 8 9 10 ...
5 6 7 8 9];
nloc = length(iloc);
figure
gray = [0.55 0.55 0.55];
ax = worldmap([67 75],[-135 -115]);
tightmap
gridm('-')
mlabel('on')
plabel('on')
geoshow('landareas.shp', 'FaceColor',gray)
setm(gca,'FontName','Times','FontSize',12,'FontWeight','bold', ...
'MLabelLocation',[-135 -125], ...
'PLabelLocation',[70 75], ...
'PLineLocation',[70 75], ...
'PLineLimit', [-135 -115], ...
'MLineLocation',[-135 -130 -120], ...
'MLineLimit', [67 75], ...
'FLineWidth',1, ...
'GColor', [0.4 0.4 0.4])
geoshow('worldlakes.shp', 'FaceColor', 'white');
plotm(lat,lon,'ok')
return
plot(lon,lat,'ok'); hold on
for n = 1:nloc
plot(lon(iloc(n),jloc(n)),lat(iloc(n),jloc(n)),'xk');
end
hold off
%% Momentum flux
......@@ -72,24 +88,30 @@ uwnd = nc_varget(ncfile,'UWND');
ncfile = ['vwnd.narr.',name,'.',yrstr,'.nc'];
vwnd = nc_varget(ncfile,'VWND');
% interpolation des donn???es ??? chaque heure
uwnd = interp(uwnd,3);
vwnd = interp(vwnd,3);
% Wind stress calculation
% cf. Stewart, R.H. (2002) Introduction to Physical Oceanography
rho = 1.3; % density of air (kg m^-3)
U = sqrt(uwnd.^2 + vwnd.^2); % velocity amplitude (m s^-1)
C10 = nan .* ones(length(U),1);
for i = 1:length(U)
if (U(i) >= 3 && U(i) < 6)
C10(i) = (0.29 + 3.1./U(i) + 7.7./U(i).^2).*1e-3;
elseif U(i) >= 6
C10(i) = (0.60 + 0.070.*U(i)).*1e-3; % Yelland and Taylor (1996)
else
C10(i) = 2.18e-3;
C10 = nan .* ones(tlength,size(U,2),size(U,3));
for l = 1:tlength
for i = 1:size(U,2)
for j = 1:size(U,3)
if (U(l,i,j) >= 3 && U(l,i,j) < 6)
C10(l,i,j) = (0.29 + 3.1./U(l,i,j) + 7.7./U(l,i,j).^2).*1e-3;
elseif U(l,i,j) >= 6
C10(l,i,j) = (0.60 + 0.070.*U(l,i,j)).*1e-3; % Yelland and Taylor (1996)
else
C10(l,i,j) = 2.18e-3;
end
end
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)
dir = atan2(vwnd,uwnd); % wind direction (rad)
tau = rho.*C10.*U.*U; % wind stress amplitude (N m^-2)
......@@ -99,59 +121,90 @@ tauy = tau.*sin(dir); % meridional wind stress (N m^-2)
% figure; plot(U,tau,'ok')
clear U dir tau C10 rho
% Creation of the file 'narr_momentumflux.dat'
% file with tx and ty given in N/m^2
momentumflux = nan .* ones(tlength,8);
momentumflux(:,1:6) = timevec;
momentumflux(:,7) = taux;
momentumflux(:,8) = tauy;
% Creation of nloc files 'narr_momentumflux_????_???.dat', one for each member
% tx and ty in N/m^2
fid = fopen(['narr_hourly_momentumflux_',yrstr,'.dat'], 'wt');
figure
for n = 1:nloc
array = nan .* ones(tlength,8);
array(:,1:6) = timevec;
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);
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
array = nan .* ones(tlength,8);
array(:,1:6) = timevec;
array(:,7) = mean(mean(taux(:,8:12,7:9),3),2);
array(:,8) = mean(mean(tauy(:,8:12,7:9),3),2);
fid = fopen(['narr_momentumflux_',yrstr,'_000.dat'], 'wt');
fprintf(fid, '%4.0f-%02.0f-%02.0f %02.0f:%02.0f:%02.0f\t%f\t%f\n', ...
momentumflux');
array');
fclose(fid);
tau = sqrt(array(:,7).^2 + array(:,8).^2);
plot(time,tau,'-k');
% ----------------------------------------------------------------------
% Incoming shortwave radiative flux and surface heat flux
hold off
%% Incoming shortwave radiative flux and surface heat flux
% from NARR 3-hourly reanalysis
% ----------------------------------------------------------------------
ncfile = ['dswrf_',yrstr,'_narr_amdgulf.nc'];
ncfile = ['dswrf.narr.',name,'.',yrstr,'.nc'];
dswrf = nc_varget(ncfile,'DSWRF'); % W/m^2
% interpolation des donn???es ??? chaque heure
dswrf = interp(dswrf,3);
a = find(dswrf < 0.0);
dswrf(a) = 0.0;
% Remove negative values
dswrf(dswrf < 0.0) = 0.0;
ncfile = ['uswrf_',yrstr,'_narr_amdgulf.nc'];
ncfile = ['uswrf.narr.',name,'.',yrstr,'.nc'];
uswrf = nc_varget(ncfile,'USWRF'); % W/m^2
% interpolation des donn???es ??? chaque heure
uswrf = interp(uswrf,3);
ncfile = ['dlwrf_',yrstr,'_narr_amdgulf.nc'];
ncfile = ['dlwrf].narr.',name,'.',yrstr,'.nc'];
dlwrf = nc_varget(ncfile,'DLWRF'); % W/m^2
% interpolation des donn???es ??? chaque heure
dlwrf = interp(dlwrf,3);
ncfile = ['ulwrf_',yrstr,'_narr_amdgulf.nc'];
ncfile = ['ulwrf].narr.',name,'.',yrstr,'.nc'];
ulwrf = nc_varget(ncfile,'ULWRF'); % W/m^2
% interpolation des donn???es ??? chaque heure
ulwrf = interp(ulwrf,3);
ncfile = ['shtfl_',yrstr,'_narr_amdgulf.nc'];
ncfile = ['shtfl].narr.',name,'.',yrstr,'.nc'];
shtfl = nc_varget(ncfile,'SHTFL'); % W/m^2
% interpolation des donn???es ??? chaque heure
shtfl = interp(shtfl,3);
ncfile = ['lhtfl_',yrstr,'_narr_amdgulf.nc'];
ncfile = ['lhtfl].narr.',name,'.',yrstr,'.nc'];
lhtfl = nc_varget(ncfile,'LHTFL'); % W/m^2
% interpolation des donn???es ??? chaque heure
lhtfl = interp(lhtfl,3);
% Transmitted shortwave radiative flux
% that include the extinction due to the ice cover
% (Data from Canadian Ice Service)
% Canadian Ice Service
eval(['load cis_icec_',yrstr])
% ECMWF
ncfile = ['ci.',yrstr,'.nc'];
icec = nc_varget(ncfile,'CI');
% Indices over the Amundsen Gulf
iecmwf = [3 4 5];
jecmwf = [2 2 2];
swr = (dswrf - uswrf).*(1.0-icec);
for ii = 1:length(swr)
if swr(ii) < 0.0;
......
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