Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 9be27745 authored by gmorvan's avatar gmorvan
Browse files

Fix for ERA5 waves preprocessing

parent 79ed182e
No related branches found
No related tags found
1 merge request!7First commits for the dev_newcopernicus branch
function interp_ERA5(ATMO_dir,Y,M,Roa,interp_method,...
lon1,lat1,lonwave1,latwave1,mask1,maskwave1,tin,...
lon1,lat1,lonwave1,latwave1,mask1,maskwave1,maskwave2,tin,...
nc_frc, nc_blk,lon,lat,angle,tout, add_waves)
%
% Read the local ERA5 files and perform the space interpolations
......@@ -171,7 +171,7 @@ if add_waves == 1
nc=netcdf([ATMO_dir,vname,'_Y',num2str(Y),'M',num2str(M),'.nc'],'r');
pwave=squeeze(nc{vname}(tin,:,:));
close(nc);
pwave=get_missing_val(lonwave1,latwave1,maskwave1.*pwave,nan,Roa,nan);
pwave=get_missing_val(lonwave1,latwave1,maskwave2.*pwave,nan,Roa,nan);
pwave=interp2(lonwave1,latwave1,pwave,lon,lat,interp_method);
end
%
......
......@@ -98,10 +98,21 @@ if add_waves == 1
maskwave(maskwave ~= missvalue_wave ) = 1;
maskwave(maskwave == missvalue_wave ) = NaN ;
close(nc);
% fix: PP1D doesn t have the same mask than SWH
filein2=[ERA5_dir,'PP1D_Y',num2str(Ymin),'M',num2str(Mmin),'.nc'];
nc=netcdf(filein2);
maskwave2=squeeze(nc{'PP1D'}(1,:,:));
missvalue_wave2 = ncreadatt(filein2,'PP1D','missing_value');
maskwave2(maskwave2 ~= missvalue_wave2 ) = 1;
maskwave2(maskwave2 == missvalue_wave2 ) = NaN ;
close(nc);
%
else
lon1wave = NaN;
lat1wave = NaN;
maskwave = NaN;
maskwave2 = NaN;
end
......@@ -191,10 +202,10 @@ for Y=Ymin:Ymax
% %
% % Add the waves
% %
if makefrc==1 && add_waves==1
disp(['Add waves data'])
disp(['=============='])
end
if makefrc==1 && add_waves==1
disp(['Add waves data'])
disp(['=============='])
end
% %
% %
% % Add the tides
......@@ -266,7 +277,7 @@ for Y=Ymin:Ymax
aa0=tndx-(itolap-aa);
end
interp_ERA5(ERA5_dir,Ym,Mm,Roa,interp_method,lon1,lat1,lon1wave,lat1wave, ...
mask,maskwave,aa0,nc_frc,nc_blk,lon,lat,angle,aa,add_waves)
mask,maskwave,maskwave2,aa0,nc_frc,nc_blk,lon,lat,angle,aa,add_waves)
end
%######################################################################
%
......@@ -284,7 +295,7 @@ for Y=Ymin:Ymax
disp(['Step: ',num2str(tndx),' of ',num2str(tlen0)])
end
interp_ERA5(ERA5_dir,Y,M,Roa,interp_method,lon1,lat1,lon1wave,lat1wave,...
mask,maskwave,tndx,nc_frc,nc_blk,lon,lat,angle,tndx+itolap,add_waves)
mask,maskwave,maskwave2,tndx,nc_frc,nc_blk,lon,lat,angle,tndx+itolap,add_waves)
end
disp(' ')
......@@ -344,7 +355,7 @@ for Y=Ymin:Ymax
disp(['tin=',num2str(tin)])
end
interp_ERA5(ERA5_dir,Yp,Mp,Roa,interp_method,lon1,lat1,lon1wave,lat1wave,...
mask,maskwave,tin,nc_frc,nc_blk,lon,lat,angle,tout,add_waves)
mask,maskwave,maskwave2,tin,nc_frc,nc_blk,lon,lat,angle,tout,add_waves)
end;
%
% Close the CROCO forcing files
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment