close all clear all % --- PLOT XUAN DAI SEP 2022 load BuoyData.mat % Location: 13.407694; 109.307244 time_sta=datenum(BuoyData.Time_UTC); time_sta=datenum(2019,1,1)+time_sta-1; %%%%% --- CURRENTS %%%% --- CURRENTS AT BUOY %%% --- At bottom V_bot_sta=BuoyData.V_bot; figure('position',[100 100 900 300]) subplot(4,1,1) h=plot(time_sta,V_bot_sta,time_sta,V_bot_sta); set(h,'linewidth',3) legend('data','model') text(time_sta(80),0.25,'Sep 2022','fontsize',14) ylabel('Bottom speed [m/s]','fontsize',7) axis([-Inf Inf 0 0.22]) datetick('x','dd/mm') grid on set(gca,'fontsize',14) % % --- Dir_bot_sta=BuoyData.Dir_bot; subplot(4,1,3) h=plot(time_sta,Dir_bot_sta,time_sta,Dir_bot_sta); set(h,'linewidth',3) legend('data','model') %text(time_sta(80),0.28,'Sep 2022','fontsize',14) ylabel('Bottom Dir [degree]','fontsize',7) axis([-Inf Inf 0 360]) datetick('x','dd/mm') grid on set(gca,'fontsize',14) %%% --- At surface V_surf_sta=BuoyData.V_surf; subplot(4,1,2) h=plot(time_sta,V_surf_sta,time_sta,V_surf_sta); set(h,'linewidth',3) legend('data','model') % text(time_sta(80),0.9,'Sep 2022','fontsize',14) ylabel('Surface speed [m/s]','fontsize',7) axis([-Inf Inf 0 0.22]) datetick('x','dd/mm') grid on set(gca,'fontsize',14) % % --- Dir_surf_sta=BuoyData.Dir_surf; subplot(4,1,4) h=plot(time_sta,Dir_surf_sta,time_sta,Dir_surf_sta); set(h,'linewidth',3) legend('data','model') % text(time_sta(80),0.9,'Sep 2022','fontsize',14) ylabel('Surface Dir [degree]','fontsize',7) xlabel('Time') axis([-Inf Inf 0 360]) datetick('x','dd/mm') grid on set(gca,'fontsize',14) export_fig -transparent Current_Sep2022.pdf %-------------------------------------------------------------------------------------------------------------------- %%%% --- CURRENTS from CROCO (copied from plot_currents.m) fname='croco_Y2022M09_out_avg_UV.nc'; finfo = ncinfo(fname); ncdisp(fname); %Display Contents of NetCDF File nc=netcdf(fname); % time_Data = ncread(fname,'time'); % % time = datenum(time_Data)+datenum(2019,1,1,0,0,0); % % % u_data = ncread(fname,'u',[1 0 0 0],[1 0 0 0]); % % for i=1:length(finfo.Variables) for i=1:4; vn = finfo.Variables(i).Name; x.(vn) = ncread(fname, vn); % The result is a structure disp(finfo.Variables(i).Name); end for i=7:8; vn = finfo.Variables(i).Name; y.(vn) = ncread(fname, vn); % The result is a structure disp(finfo.Variables(i).Name); end % % % u=nc{'u'}(:); % % u_Data = ncread(fname,'u'); % u=squeeze(mean(nc{'u'}(:))); % v=squeeze(mean(nc{'v'}(:))); % lon=nc{'lon_v'}(:); % lat=nc{'lat_v'}(:); % angle=nc{'angle'}(:); % h=nc{'h'}(:); % % zeta=squeeze(mean(nc{'zeta'}(:))); % close(nc) % [M L]=size(lon); % % cosa = cos(angle); % sina = sin(angle); % ur=u2rho_2d(u); % vr=v2rho_2d(v); % u = ur.*cosa - vr.*sina; % v = vr.*cosa + ur.*sina; % % minlon=104.0; maxlon=107.7; % minlat= 7.8; maxlat= 10.5; % res=0.07; % [LON LAT]=meshgrid(minlon:res:maxlon,minlat:res:maxlat); % U=griddata(lon,lat,u,LON,LAT); % V=griddata(lon,lat,v,LON,LAT); % % speed=sqrt(u.^2+v.^2); % D=h+zeta; % speed(D<0.4)=NaN; % ur(D<0.4)=NaN; % ur(D<0.4)=NaN; % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % hf = figure('pos',[500 500 500 500]); % axis tight; set(hf,'DoubleBuffer','on'); % m_proj('stereo','lat',9.3,'lon',105.8,'rad',1.7); % % cmin=0; cmax=0.2; nbcol=5; % cint=(cmax-cmin)/nbcol; % map=AdvancedColormap('wm',nbcol); % colormap(map); % % m_pcolor(lon,lat,speed); hold on % %m_contourf(lon,lat,speed,[cmin:cint:cmax]); % shading flat; colorbar; % hold on % %m_contour(lon,lat,h,[-0.4:100:100.2],'color',[0.7 0.7 0.7],'linewidth',3); % Vmax=max(max(sqrt(u.^2+v.^2))); % m_quiver(LON,LAT,U,V,5.*Vmax) % %m_streamslice(lon,lat,u,v,2) % caxis([cmin cmax]) % title(['CROCO residual currents'],'fontsize',11) % m_gshhs_f('patch','k') % m_grid('box','fancy','tickdir','in','fontsize',12); % hold off % export_fig -transparent currents.pdf % % return % % figure % pcolor(lon,lat,speed); hold on % colormap('cool') % shading flat % colorbar % quiver(lon,lat,u,v,2) % axis([108.3 108.47 15.75 15.95]) % caxis([0 1]) %-------------------------------------------------------------------------------------------------------------------- %%%%% --- WAVES Hs_sta=BuoyData.H; % fname='croco_Y2022M09_out_avg_UV.nc'; % nc=netcdf(fname); % Awave=nc{'hrm'}(:); % Hs_model=squeeze(Awave(:,:)); % close(nc) %Hs_mod=Hs_model'; %time_mod=time_model; % tend_mod=datenum(2017,10,1)+time_mod(end)-1; % % Hs_mod(end)=2*Hs_mod(end-1)-Hs_mod(end-2); % Hs_mod=interp1(time_mod,Hs_mod,time_sta,'pchip'); % % Hs_mod(time_sta>tend_mod)=NaN; % % % --- figure('position',[100 100 900 300]) subplot(3,1,1) h=plot(time_sta,Hs_sta,time_sta,Hs_sta); set(h,'linewidth',3) legend('data','model') text(time_sta(80),0.9,'Sep 2022','fontsize',14) ylabel('Hs [m]') axis([-Inf Inf 0.1 0.8]) datetick('x','dd/mm') grid on set(gca,'fontsize',14) % % T_sta=BuoyData.T; %T_mod=T_model'; %time_mod=time_model; % tend_mod=datenum(2017,10,1)+time_mod(end)-1; % % T_mod(end)=2*T_mod(end-1)-T_mod(end-2); % T_mod=interp1(time_mod,T_mod,time_sta,'pchip'); % % T_mod(time_sta>tend_mod)=NaN; % % % --- % figure('position',[100 100 900 400]) subplot(3,1,2) h=plot(time_sta,T_sta,time_sta,T_sta); set(h,'linewidth',3) legend('data','model') % text(time_sta(1),12.5,'Sep 2022','fontsize',14) ylabel('T [s]') axis([-Inf Inf 1 13]) datetick('x','dd/mm') grid on set(gca,'fontsize',14) % % % Dir_sta=BuoyData.Dir; %Dir_mod=Dir_model'; %time_mod=time_model; % tend_mod=datenum(2017,10,1)+time_mod(end)-1; % % Dir_mod(end)=2*Dir_mod(end-1)-Dir_mod(end-2); % Dir_mod=interp1(time_mod,Dir_mod,time_sta,'pchip'); % % Dir_mod(time_sta>tend_mod)=NaN; % % % --- % figure('position',[100 100 900 400]) subplot(3,1,3) h=plot(time_sta,Dir_sta,time_sta,Dir_sta); set(h,'linewidth',3) legend('data','model') % text(time_sta(1),140,'Sep 2022','fontsize',14) xlabel('Time') ylabel('Dir [degree]') axis([-Inf Inf 70 150]) datetick('x','dd/mm') grid on set(gca,'fontsize',14) % export_fig -transparent Wave_Sep2022.pdf % %-------------------------------------------------------- % % % % --- % % --- PLOT GC FEB/MAR 2017 % % load GC_Feb.mat % Hs_sta_feb=Hs_sta/sqrt(2)+0.1; % Hs_mod_feb=Hs_model'; % time_sta_feb=time_sta'; % time_mod_feb=time_model; % D=(time_mod_feb>28.4); % time_mod_feb(D)=[]; % Hs_mod_feb(D)=[]; % % %figure % %plot(time_sta_feb,Hs_sta_feb,time_mod_feb,Hs_mod_feb) % %legend('data','model') % xlabel('Time') % load GC_Mar.mat % Hs_sta_mar=Hs_sta; % Hs_mod_mar=Hs_model'; % time_sta_mar=time_sta'; % time_mod_mar=time_model; % % Hs_mod_mar(1)=[]; % time_mod_mar(1)=[]; % %Hs_sta_mar(time_sta_mar<3.8)=NaN; % % %figure % %plot(time_sta_mar,Hs_sta_mar,time_mod_mar,Hs_mod_mar) % %legend('data','model') % % time_sta_mar=time_sta_mar+27+1/24; % time_mod_mar=time_mod_mar+27+1/24; % % Hs_sta=cat(1,Hs_sta_feb,Hs_sta_mar); % Hs_mod=cat(1,Hs_mod_feb,Hs_mod_mar); % time_sta=cat(1,time_sta_feb,time_sta_mar); % time_mod=cat(1,time_mod_feb,time_mod_mar); % % Hs_mod=interp1(time_mod,Hs_mod,time_sta,'pchip'); % % time_sta=datenum(2017,2,1)+time_sta-1; % % % --- % %figure('position',[100 100 900 400]) % subplot(2,1,2) % h=plot(time_sta,Hs_sta,time_sta,Hs_mod); % set(h,'linewidth',3) % legend('data','model') % text(time_sta(1),1.75,'GO CONG - Feb-Mar 2017','fontsize',14) % ylabel('Hs [m]') % axis([-Inf Inf 0 2]) % datetick('x','dd/mm') % grid on % set(gca,'fontsize',14) % % % export_fig -transparent wave_valid_paper.pdf % % return % % %======================================================== % % % --- PLOT UMINH OCT 2016 % % load UM_Oct.mat % Hs_sta=Hs_sta; % Hs_mod=Hs_model'; % time_sta=time_sta'; % time_mod=time_model; % % tend_mod=datenum(2017,10,1)+time_mod(end)-1; % % Hs_mod(end)=2*Hs_mod(end-1)-Hs_mod(end-2); % Hs_mod=interp1(time_mod,Hs_mod,time_sta,'pchip'); % % time_sta=datenum(2017,10,1)+time_sta-1; % Hs_mod(time_sta>tend_mod)=NaN; % % % --- % %figure('position',[100 100 900 400]) % subplot(4,1,3) % h=plot(time_sta,Hs_sta,time_sta,Hs_mod); % set(h,'linewidth',3) % legend('data','model') % text(time_sta(1),1.75,'U-MINH - Oct 2016','fontsize',14) % axis([-Inf Inf 0 2]) % datetick('x','dd/mm') % grid on % set(gca,'fontsize',14) % % %---------------------------------------------------- % % --- PLOT UMINH FEB/MAR 2017 % % load UM_Feb.mat % Hs_sta_feb=Hs_sta; % Hs_mod_feb=Hs_model'; % time_sta_feb=time_sta'; % time_mod_feb=time_model; % D=(time_mod_feb>28.4); % time_mod_feb(D)=[]; % Hs_mod_feb(D)=[]; % 5 % %figure % %plot(time_sta_feb,Hs_sta_feb,time_mod_feb,Hs_mod_feb) % %legend('data','model') % % load UM_Mar.mat % Hs_sta_mar=Hs_sta; % Hs_mod_mar=Hs_model'; % time_sta_mar=time_sta'; % time_mod_mar=time_model; % % Hs_mod_mar(1)=[]; % time_mod_mar(1)=[]; % %Hs_sta_mar(time_sta_mar<3.8)=NaN; % % %figure % %plot(time_sta_mar,Hs_sta_mar,time_mod_mar,Hs_mod_mar) % %legend('data','5model') % % time_sta_mar=time_sta_mar+27+1/24; % time_mod_mar=time_mod_mar+27+1/24; % % Hs_sta=cat(1,Hs_sta_feb,Hs_sta_mar); % Hs_mod=cat(1,Hs_mod_feb,Hs_mod_mar); % time_sta=cat(1,time_sta_feb,time_sta_mar); % time_mod=cat(1,time_mod_feb,time_mod_mar); % % Hs_mod=interp1(time_mod,Hs_mod,time_sta,'pchip'); % % time_sta=datenum(2017,2,1)+time_sta-1; % % % --- % %figure('position',[100 100 900 400]) % subplot(4,1,4) % h=plot(time_sta,Hs_sta,time_sta,Hs_mod); % set(h,'linewidth',3) % legend('data','model') % text(time_sta(1),1.75,'U-MINH - Feb/Mar 2017','fontsize',14) % axis([-Inf Inf 0 2]) % datetick('x','dd/mm') % grid on % set(gca,'fontsize',14) % % %-------------------------