diff --git a/build/doctrees/Comparison_WERA-ADCP_Sept2013.doctree b/build/doctrees/Comparison_WERA-ADCP_Sept2013.doctree index ccee7ebbd44b5aee58b970ae501f83577d8ba8fc..47eab63e0abba6acb174c516ed258d975de11bbd 100644 Binary files a/build/doctrees/Comparison_WERA-ADCP_Sept2013.doctree and b/build/doctrees/Comparison_WERA-ADCP_Sept2013.doctree differ diff --git a/build/doctrees/WERAcalibration.doctree b/build/doctrees/WERAcalibration.doctree index b0f35335f13d9611bcfe783efd6d819f4b195e2b..e568f2085d762e15d8753e893e3281c19d67d9cf 100644 Binary files a/build/doctrees/WERAcalibration.doctree and b/build/doctrees/WERAcalibration.doctree differ diff --git a/build/doctrees/calibration.doctree b/build/doctrees/calibration.doctree index b36b149620a520f86e5f7d295373c2192f1a3c40..9f86160c4a05b98edafb5d560dd83716efa1580f 100644 Binary files a/build/doctrees/calibration.doctree and b/build/doctrees/calibration.doctree differ diff --git a/build/doctrees/environment.pickle b/build/doctrees/environment.pickle index 41bb17ccc0e0b97c1c55ee28259f9a5584fe5576..2746100e939cc74723d0ee9c0ff23d2873cf4b98 100644 Binary files a/build/doctrees/environment.pickle and b/build/doctrees/environment.pickle differ diff --git a/build/html/WERAcalibration.html b/build/html/WERAcalibration.html index cf20f4ce111fcf736e14a81b5b341d0f33e097af..c001742349a3508ad5dfbb4b09ce3d728b7e8cd0 100644 --- a/build/html/WERAcalibration.html +++ b/build/html/WERAcalibration.html @@ -1,126 +1,794 @@ - - - - - - - - WERA calibrations — documentation_HFR_analysis 0.0.1 documentation - - - - - - - - - - - - - - - -
-
-
-
+ + + + + WERAcalibration

Contents

clear all
+close all
+
+%cd('/home/bandma01/Documents/WERAs/')
+cd('/home/bandma01/hfr-data-processing/calibrations/')
+
+% site = 'PAO';
+site = 'PAB';
+cd(site)
+
+% system
+for sys = 1:2
+
    if sys == 1
+        systm = 'Helzel';
+    elseif sys == 2
+        systm = 'Flament';
+    end
+
+    clear J I E Phase calib_file calib_hr calib_jd calib_min calib_time calib_value
+    clear calib_year d data delta_phase_obs delta_phase_th gps_data index_timecalib
+    clear theta_pairs
+
+    if strcmp(site,'PAO') == 1
+
+        load('HelzelPAO_Track_29-OCT-14 183138.mat')
+
+    elseif strcmp(site,'PAB') == 1
+
+        if strcmp(systm,'Helzel') == 1
+            load('HelzelPAB_Track_30-OCT-14 175446.mat')
+        elseif strcmp(systm,'Flament') == 1
+            load('FlamentPAB_Track_30-OCT-14 182008.mat')
+        end
+
+    end
+

phases and time of calibration

    if strcmp(site,'PAO') == 1
+        cd('2014302')
+    elseif strcmp(site,'PAB') == 1
+        cd('2014303')
+    end
+
+    % list files
+    clear d
+    d = dir('*.mat');       % returns a structure with name, date, bytes, isdir, datenum
+    Nfiles = length(d);     % nombre de fichiers a analyser
+
+
+    % look at the names of files and extract information
+    for c = 1:Nfiles
+        calib_year(c) = str2double(d(c).name(1:4));
+        calib_jd(c) = str2double(d(c).name(5:7));
+        calib_hr(c) = str2double(d(c).name(8:9));
+        calib_min(c) = str2double(d(c).name(10:11));
+
+        load(d(c).name,'phase')
+
+        Phase(:,c) = phase;
+    end
+    clear phase
+
+    delta_phase_obs = modsym(diff(Phase,1),180);
+
+    To = datenum(2014,01,01,0,0,0);
+
+    % add 20 sec to center calibration time
+    calib_time = To + calib_jd -1 + calib_hr./24 + calib_min/24/60 + 20/24/3600;
+    % datevec(calib_time)
+
+    if strcmp(site,'PAO') == 1
+        % calib time 2min34sec late wrt GPS
+        calib_time = calib_time + 2/24/60 + 34/24/3600;
+    end
+

separate between calibrations made with Helzel's system and Pierre's system

date of new calibration files Helzel 2014-10-30 16:52 to 17:54 Flament 2014-10-30 17:55 to 18:20

    T1 = datenum(2014,10,30,17,59,00);
+
+
+    clear J
+    if strcmp(systm,'Helzel') == 1
+        J = find(calib_time > T1);
+    elseif strcmp(systm,'Flament') == 1
+        J = find(calib_time > T1);
+    end
+
+    %remove unwanted data to avoid confusion!
+    calib_year(J)=[];
+    calib_jd(J)=[];
+    calib_hr(J)=[];
+    calib_min(J)=[];
+    Phase(:,J)=[];
+    delta_phase_obs(:,J)=[];
+    calib_time(J)=[];
+    d(J)=[];
+    clear c Nfiles
+
+    %+++++++++++++++++++++++++++++++++++++++++
+    % for each calibration file  (series# 1)
+    %+++++++++++++++++++++++++++++++++++++++++
+    for calib_file = 1:length(calib_time)
+
+        time_calib = calib_time(calib_file);
+
+        % find corresponding file in gps data
+        clear I
+        I = find(data(:,1) > time_calib);
+        % take closest point for now
+        I = I(1);
+
+        % datevec(data(I,1))
+        % datevec(time_calib)
+
+        index_timecalib(calib_file) = I;
+    end
+
+    % check
+    % datevec(data(index_timecalib,1))
+
+    % isolate gps calibration data
+    gps_data = data(index_timecalib,:); % time lat lon
+
+    figure(1)
+    hold on
+    h1=plot(gps_data(:,2),gps_data(:,3),'.');
+    grid on
+        if strcmp(systm,'Helzel') == 1
+            set(h1,'marker','.','color','b')
+        elseif strcmp(systm,'Flament') == 1
+            set(h1,'marker','x','color','k')
+        end
+
+    % load antenna coordinates
+    cd ..
+    load([site '_Rx_coords.mat'])
+
+    hold on
+    plot(lon,lat,'x')
+    grid on
+    title(['site = ' site ])
+

theoretical values

wavelength

    lambda = 3E8/16.15E6;
+
+
+    % initialize variables
+    theta_pairs = nan(11,length(gps_data));
+
+    % for each gps point
+    for pt = 1:length(gps_data)
+
+        % compute distance between GPS and antennas
+        for ant = 1:12
+            clear E W
+            [E,W] = lonlat2km(gps_data(pt,2),gps_data(pt,3),lon(ant),lat(ant));
+            ddist = sqrt(E.^2+W.^2);
+            r(ant) = ddist*1000;    %meters
+        end
+
+
+
+        %for each pair of antennas
+        for p = 1:11
+
+            %delta_r
+            delta_r(p) = r(p+1) - r(p);
+
+            % theoretical phase
+            delta_phase_th(p,pt) = modsym((delta_r(p)*360./lambda),180);
+
+
+            % position of middle of pairs
+            clear lon_mid lat_mid
+            lon_mid = (lon(p+1)+lon(p))/2;
+            lat_mid = (lat(p+1)+lat(p))/2;
+
+            % distance between middle of pair and one of the antenna in the pair
+            %         clear E W
+            %         [E,W] = lonlat2km(lon_mid,lat_mid,lon(p),lat(p));
+            %         ddist = sqrt(E.^2+W.^2);
+            %         a(p) = ddist*1000;    %meters
+
+            % distance between middle of pair and GPS pt
+            clear ddsit phasAng
+            [ddist,phasAng] = sw_dist([gps_data(pt,3) lat_mid],[gps_data(pt,2) lon_mid],'km');
+            r_mid(p) = ddist*1000;    %meters
+            zeta(p) = phasAng;
+
+
+            % distance between pair of antennas
+            clear ddsit phasAng
+            [ddist,phasAng] = sw_dist([lat(p) lat(p+1)],[lon(p) lon(p+1)],'km');
+            phi(p) = phasAng;
+
+
+            % azimuth
+            theta_pairs(p,pt) = modsym(zeta(p)-phi(p)+90,180);
+            %rad2deg(theta_pairs)
+        end
+
+
+    end
+
+    figure(1)
+    legend('gps','antennas','location','southeast')
+    xlabel('longitude')
+    ylabel('latitude')
+
+
+    % for each pair of antenna
+    for p = 1:11
+        figure(p+1)
+        h2=plot(theta_pairs(p,:),delta_phase_th(p,:),'x');
+        hold on
+        h3=plot(theta_pairs(p,:),-delta_phase_obs(p,:),'or');
+        grid on
+        xlabel('incidence (degrees)')
+        ylabel('phase difference (degrees)')
+        legend('theoretical','observed','location','best')
+        title([site ' - antennas ' num2str(p) '-' num2str(p+1)])
+
+        if strcmp(systm,'Helzel') == 1
+            set(h2,'color','b')
+            set(h3,'color','r','marker','o')
+        elseif strcmp(systm,'Flament') == 1
+            set(h2,'color','k','marker','*')
+            set(h3,'color','r','marker','sq','markerfacecolor','r')
+        end
+
+
+        % compute calibration value for antennas pairs
+        calib_value(p) = nanmean(modsym(-delta_phase_obs(p,:)-delta_phase_th(p,:),180),2);
+
+
+         % compute calibration value for each antenna
+        phi_ant(p+1,sys) = sum(calib_value);
+
+    end
+
+    P=ones(16,3);
+    P(13:16,:)=0;
+    P(1:12,3)=phi_ant(:,1);
+
+
+    % save file (we only keep results from Helzel
+    if strcmp(site,'PAO') == 1
+        dlmwrite('calibration_pao_29OCT2014.wera',P,'delimiter','\t','precision','%.7f')
+    elseif strcmp(site,'PAB') == 1
+        dlmwrite('calibration_pab_30OCT2014.wera',P,'delimiter','\t','precision','%.7f')
+    end
+
+
+    figure(13)
+    hold on
+    h4=plot(calib_value,'.-');
+    grid on
+    xlabel('pairs of antennas')
+    ylabel({'phase difference between','theoretical and observed values (degrees)'})
+    title(site)
+
+        if strcmp(systm,'Helzel') == 1
+            set(h4,'color','b')
+        elseif strcmp(systm,'Flament') == 1
+            set(h4,'color','k')
+            legend('Helzel','Flament','location','southeast')
+        end
+
+
+     figure(14)
+     hold on
+     h5=plot([1:12],phi_ant(:,sys),'r');
+     grid on
+         if strcmp(systm,'Helzel') == 1
+            set(h5,'marker','o')
+         elseif strcmp(systm,'Flament') == 1
+            set(h5,'marker','sq','markerfacecolor','r')
+            legend('Helzel','Flament','location','southeast')
+         end
+    xlabel('antenna number')
+    ylabel('calibration phase to be applied (degrees)')
+    title(site)
+
+    if strcmp(site,'PAO') == 1
+       break
+    end
+
end
+
+%add current calibration phases
+if strcmp(site,'PAO') == 1
+    load calibration_pao.wera
+    figure(14)
+    plot([1:12],calibration_pao(1:12,3),'b.-')
+    legend('Helzel','original calibration','location','northwest')
+elseif strcmp(site,'PAB') == 1
+    load calibration_pab.wera
+    figure(14)
+    plot([1:12],calibration_pab(1:12,3),'b.-')
+    legend('Helzel','Flament','original calibration','location','southeast')
+end
+
+
+
+
+
+
+% save figures
+save_flag = 1;
+
+figdir = ('/home/bandma01/Dropbox/UQAR/MEOPAR_Marion/figures/WERAcalibration');
+cd(figdir)
+
+fig_hdl = figure(1);
+if save_flag
+    fname = ['configuration_' site '_calibrations'];
+    fig_w = 8;%cm
+    fig_h = 5;%cm
+    set(fig_hdl,'PaperUnits','centimeters')
+    set(fig_hdl,'PaperPosition',[0 0 fig_w fig_h])
+    set(fig_hdl, 'PaperSize', [fig_w fig_h]);
+    print(fig_hdl,'-dpng','-r500',fname)
+    %crop([fname '.png'])
+end
+
+
+
+
+for i = 2:12
+    fig_hdl = figure(i);
+    if save_flag
+        fname = ['Phases_' site '_pair' num2str(i-1) '-' num2str(i)];
+        fig_w = 8;%cm
+        fig_h = 5;%cm
+        set(fig_hdl,'PaperUnits','centimeters')
+        set(fig_hdl,'PaperPosition',[0 0 fig_w fig_h])
+        set(fig_hdl, 'PaperSize', [fig_w fig_h]);
+        print(fig_hdl,'-dpng','-r500',fname)
+        %         crop([fname '.png'])
+    end
+end
+
+
+
+fig_hdl = figure(13);
+if save_flag
+    fname = ['PhaseDifference_' site '_calibrations'];
+    fig_w = 8;%cm
+    fig_h = 5;%cm
+    set(fig_hdl,'PaperUnits','centimeters')
+    set(fig_hdl,'PaperPosition',[0 0 fig_w fig_h])
+    set(fig_hdl, 'PaperSize', [fig_w fig_h]);
+    print(fig_hdl,'-dpng','-r500',fname)
+    %         crop([fname '.png'])
+end
+
+fig_hdl = figure(14);
+if save_flag
+    fname = ['PhaseCalibration_' site];
+    fig_w = 8;%cm
+    fig_h = 5;%cm
+    set(fig_hdl,'PaperUnits','centimeters')
+    set(fig_hdl,'PaperPosition',[0 0 fig_w fig_h])
+    set(fig_hdl, 'PaperSize', [fig_w fig_h]);
+    print(fig_hdl,'-dpng','-r500',fname)
+    %         crop([fname '.png'])
+end
+
\ No newline at end of file diff --git a/build/html/WERAcalibration.png b/build/html/WERAcalibration.png new file mode 100644 index 0000000000000000000000000000000000000000..0820f5a83cc086082216e9bcbb65ec09a3140fa1 Binary files /dev/null and b/build/html/WERAcalibration.png differ diff --git a/build/html/WERAcalibration_01.png b/build/html/WERAcalibration_01.png new file mode 100644 index 0000000000000000000000000000000000000000..77d39198b415df9811df352b05fd4d6808348cb9 Binary files /dev/null and b/build/html/WERAcalibration_01.png differ diff --git a/build/html/WERAcalibration_02.png b/build/html/WERAcalibration_02.png new file mode 100644 index 0000000000000000000000000000000000000000..621604eb8035b8cc2c84441eaa7868a89d3b7b98 Binary files /dev/null and b/build/html/WERAcalibration_02.png differ diff --git a/build/html/WERAcalibration_03.png b/build/html/WERAcalibration_03.png new file mode 100644 index 0000000000000000000000000000000000000000..51a3e6b3bb37e59e0b768e063c7aed3c2d5670c4 Binary files /dev/null and b/build/html/WERAcalibration_03.png differ diff --git a/build/html/WERAcalibration_04.png b/build/html/WERAcalibration_04.png new file mode 100644 index 0000000000000000000000000000000000000000..fcf895cd33ddde6da174987e79b87549d17fea2e Binary files /dev/null and b/build/html/WERAcalibration_04.png differ diff --git a/build/html/WERAcalibration_05.png b/build/html/WERAcalibration_05.png new file mode 100644 index 0000000000000000000000000000000000000000..89e62d94b2837d5fd85e14623b2a79038f5a4b41 Binary files /dev/null and b/build/html/WERAcalibration_05.png differ diff --git a/build/html/WERAcalibration_06.png b/build/html/WERAcalibration_06.png new file mode 100644 index 0000000000000000000000000000000000000000..0f3e792cc93bdb416530e2b00263ed7ecd121fc2 Binary files /dev/null and b/build/html/WERAcalibration_06.png differ diff --git a/build/html/WERAcalibration_07.png b/build/html/WERAcalibration_07.png new file mode 100644 index 0000000000000000000000000000000000000000..b4137250feff2b521306b6a22d94fae6639069dc Binary files /dev/null and b/build/html/WERAcalibration_07.png differ diff --git a/build/html/WERAcalibration_08.png b/build/html/WERAcalibration_08.png new file mode 100644 index 0000000000000000000000000000000000000000..7a2f793fafdde6f885366e6c5f7992623b5ba476 Binary files /dev/null and b/build/html/WERAcalibration_08.png differ diff --git a/build/html/WERAcalibration_09.png b/build/html/WERAcalibration_09.png new file mode 100644 index 0000000000000000000000000000000000000000..3f53f50edaf0366badab808e204e3a51bb0e9b3a Binary files /dev/null and b/build/html/WERAcalibration_09.png differ diff --git a/build/html/WERAcalibration_10.png b/build/html/WERAcalibration_10.png new file mode 100644 index 0000000000000000000000000000000000000000..5658a0b2700c125420472c9c002c98eff76af578 Binary files /dev/null and b/build/html/WERAcalibration_10.png differ diff --git a/build/html/WERAcalibration_11.png b/build/html/WERAcalibration_11.png new file mode 100644 index 0000000000000000000000000000000000000000..117e69585f62f345bf46e97d09037400e595f3ea Binary files /dev/null and b/build/html/WERAcalibration_11.png differ diff --git a/build/html/WERAcalibration_12.png b/build/html/WERAcalibration_12.png new file mode 100644 index 0000000000000000000000000000000000000000..3a7ee5a79b4bb1fcc92656c1c9524b1a154caeb3 Binary files /dev/null and b/build/html/WERAcalibration_12.png differ diff --git a/build/html/WERAcalibration_13.png b/build/html/WERAcalibration_13.png new file mode 100644 index 0000000000000000000000000000000000000000..3d2dd2bd82fc9b32fc9931654a114f4050527547 Binary files /dev/null and b/build/html/WERAcalibration_13.png differ diff --git a/build/html/WERAcalibration_14.png b/build/html/WERAcalibration_14.png new file mode 100644 index 0000000000000000000000000000000000000000..3ac7436f88689d0318260f066ead48a5344b6b44 Binary files /dev/null and b/build/html/WERAcalibration_14.png differ diff --git a/build/html/WERAcalibration_15.png b/build/html/WERAcalibration_15.png new file mode 100644 index 0000000000000000000000000000000000000000..8a26528c2fb92870a1e3d3efe9c14bbe3b949868 Binary files /dev/null and b/build/html/WERAcalibration_15.png differ diff --git a/build/html/WERAcalibration_16.png b/build/html/WERAcalibration_16.png new file mode 100644 index 0000000000000000000000000000000000000000..f143d86806a3d1196b0d3e42e134926024517895 Binary files /dev/null and b/build/html/WERAcalibration_16.png differ diff --git a/build/html/WERAcalibration_17.png b/build/html/WERAcalibration_17.png new file mode 100644 index 0000000000000000000000000000000000000000..7d57ec5f35b40e5b45cc12e565e083a72f553672 Binary files /dev/null and b/build/html/WERAcalibration_17.png differ diff --git a/build/html/WERAcalibration_18.png b/build/html/WERAcalibration_18.png new file mode 100644 index 0000000000000000000000000000000000000000..6cae80bb0067a3e84b9baebdbf44c9db7acf2940 Binary files /dev/null and b/build/html/WERAcalibration_18.png differ diff --git a/build/html/WERAcalibration_19.png b/build/html/WERAcalibration_19.png new file mode 100644 index 0000000000000000000000000000000000000000..8d28191b29b6a088b0eab8b528424e09d963acaa Binary files /dev/null and b/build/html/WERAcalibration_19.png differ diff --git a/build/html/WERAcalibration_20.png b/build/html/WERAcalibration_20.png new file mode 100644 index 0000000000000000000000000000000000000000..fbf508653b869dc90fba115ef6bb9404688c6a38 Binary files /dev/null and b/build/html/WERAcalibration_20.png differ diff --git a/build/html/WERAcalibration_21.png b/build/html/WERAcalibration_21.png new file mode 100644 index 0000000000000000000000000000000000000000..908066aedec236b3065650ccea661f0f89a37976 Binary files /dev/null and b/build/html/WERAcalibration_21.png differ diff --git a/build/html/WERAcalibration_22.png b/build/html/WERAcalibration_22.png new file mode 100644 index 0000000000000000000000000000000000000000..3e852f567d83df8b85be3a9d76d68297176940e0 Binary files /dev/null and b/build/html/WERAcalibration_22.png differ diff --git a/build/html/WERAcalibration_23.png b/build/html/WERAcalibration_23.png new file mode 100644 index 0000000000000000000000000000000000000000..4958c8ca098a1bbc2ad1cc86f8fc1042e36d79d4 Binary files /dev/null and b/build/html/WERAcalibration_23.png differ diff --git a/build/html/WERAcalibration_24.png b/build/html/WERAcalibration_24.png new file mode 100644 index 0000000000000000000000000000000000000000..5f3bd1196a6d7085dc24798a67b5e1e4671b43db Binary files /dev/null and b/build/html/WERAcalibration_24.png differ diff --git a/build/html/WERAcalibration_25.png b/build/html/WERAcalibration_25.png new file mode 100644 index 0000000000000000000000000000000000000000..9a1e6f8c3b3548a5d91fc78f28a75c728d8397eb Binary files /dev/null and b/build/html/WERAcalibration_25.png differ diff --git a/build/html/WERAcalibration_26.png b/build/html/WERAcalibration_26.png new file mode 100644 index 0000000000000000000000000000000000000000..ea42368099c412eda65e1fc4fc4fde5b3d1310e4 Binary files /dev/null and b/build/html/WERAcalibration_26.png differ diff --git a/build/html/WERAcalibration_27.png b/build/html/WERAcalibration_27.png new file mode 100644 index 0000000000000000000000000000000000000000..05e28ec6671d184eb636240265e08024fb7e7a9d Binary files /dev/null and b/build/html/WERAcalibration_27.png differ diff --git a/build/html/WERAcalibration_28.png b/build/html/WERAcalibration_28.png new file mode 100644 index 0000000000000000000000000000000000000000..f80a13716343e7d6a9134a6947b12105793eaf65 Binary files /dev/null and b/build/html/WERAcalibration_28.png differ diff --git a/build/html/WERAcalibration_29.png b/build/html/WERAcalibration_29.png new file mode 100644 index 0000000000000000000000000000000000000000..b79ec52b9550c9970370dfc873203a5fef4590f6 Binary files /dev/null and b/build/html/WERAcalibration_29.png differ diff --git a/build/html/WERAcalibration_30.png b/build/html/WERAcalibration_30.png new file mode 100644 index 0000000000000000000000000000000000000000..ff0302e93a032a9c453c7192ec66b30628862183 Binary files /dev/null and b/build/html/WERAcalibration_30.png differ diff --git a/build/html/_sources/Comparison_WERA-ADCP_Sept2013.txt b/build/html/_sources/Comparison_WERA-ADCP_Sept2013.txt index 473d8193d8aed5a8ecbd079235109c0b5dcf811b..856acf68bd388872a38219b5de130f16eba480fd 100644 --- a/build/html/_sources/Comparison_WERA-ADCP_Sept2013.txt +++ b/build/html/_sources/Comparison_WERA-ADCP_Sept2013.txt @@ -37,7 +37,7 @@ Steps of the algorithm: For each index, we load the corresponding HFR file (i.e. 20132440000_pao.mat). Each file contains a grid (X,Y) with radial currents at each grid point (Ur), a corresponding time vector (t) and the angle and distance from the site (theta,r). -.. figure:: ../../figures/RadialVelocities/ADCP/Radial_ADCPbin2_HFR_PAO_version5_Sept2013.png +.. figure:: figures/Radial_ADCPbin2_HFR_PAO_version5_Sept2013.png :align: center Hourly radial currents from ADCP bin 2 and HFR WERA at PAO - September 2013 diff --git a/build/html/_sources/WERAcalibration.txt b/build/html/_sources/WERAcalibration.txt index 293093ccf666202f6bffa2d8b6364b41cee86aec..136cf525113b89803602d05ac647c4e8538f6f2c 100644 --- a/build/html/_sources/WERAcalibration.txt +++ b/build/html/_sources/WERAcalibration.txt @@ -1,27 +1,376 @@ -WERA calibrations -=================== +WERAcalibration.m +******************* +clear all +close all -In March 2015, we used data collected in September 2013 to compare old and new calibrations in order to know which ones we should use for the on-going analysis of currents data. +%cd('/home/bandma01/Documents/WERAs/') +cd('/home/bandma01/hfr-data-processing/calibrations/') +% site = 'PAO'; +site = 'PAB'; +cd(site) -PAP1 +% system +for sys = 1:2 + + if sys == 1 + systm = 'Helzel'; + elseif sys == 2 + systm = 'Flament'; + end + + clear J I E Phase calib_file calib_hr calib_jd calib_min calib_time calib_value + clear calib_year d data delta_phase_obs delta_phase_th gps_data index_timecalib + clear theta_pairs + + if strcmp(site,'PAO') == 1 + + load('HelzelPAO_Track_29-OCT-14 183138.mat') + + elseif strcmp(site,'PAB') == 1 + + if strcmp(systm,'Helzel') == 1 + load('HelzelPAB_Track_30-OCT-14 175446.mat') + elseif strcmp(systm,'Flament') == 1 + load('FlamentPAB_Track_30-OCT-14 182008.mat') + end + + end + + + %% phases and time of calibration + if strcmp(site,'PAO') == 1 + cd('2014302') + elseif strcmp(site,'PAB') == 1 + cd('2014303') + end + + % list files + clear d + d = dir('*.mat'); % returns a structure with name, date, bytes, isdir, datenum + Nfiles = length(d); % nombre de fichiers a analyser + + + % look at the names of files and extract information + for c = 1:Nfiles + calib_year(c) = str2double(d(c).name(1:4)); + calib_jd(c) = str2double(d(c).name(5:7)); + calib_hr(c) = str2double(d(c).name(8:9)); + calib_min(c) = str2double(d(c).name(10:11)); + + load(d(c).name,'phase') + + Phase(:,c) = phase; + end + clear phase + + delta_phase_obs = modsym(diff(Phase,1),180); + + To = datenum(2014,01,01,0,0,0); + + % add 20 sec to center calibration time + calib_time = To + calib_jd -1 + calib_hr./24 + calib_min/24/60 + 20/24/3600; + % datevec(calib_time) + + if strcmp(site,'PAO') == 1 + % calib time 2min34sec late wrt GPS + calib_time = calib_time + 2/24/60 + 34/24/3600; + end + + %% separate between calibrations made with Helzel's system and Pierre's system + % date of new calibration files + % Helzel 2014-10-30 16:52 to 17:54 + % Flament 2014-10-30 17:55 to 18:20 + T1 = datenum(2014,10,30,17,59,00); + + + clear J + if strcmp(systm,'Helzel') == 1 + J = find(calib_time > T1); + elseif strcmp(systm,'Flament') == 1 + J = find(calib_time > T1); + end + + %remove unwanted data to avoid confusion! + calib_year(J)=[]; + calib_jd(J)=[]; + calib_hr(J)=[]; + calib_min(J)=[]; + Phase(:,J)=[]; + delta_phase_obs(:,J)=[]; + calib_time(J)=[]; + d(J)=[]; + clear c Nfiles + + %+++++++++++++++++++++++++++++++++++++++++ + % for each calibration file (series# 1) + %+++++++++++++++++++++++++++++++++++++++++ + for calib_file = 1:length(calib_time) + + time_calib = calib_time(calib_file); + + % find corresponding file in gps data + clear I + I = find(data(:,1) > time_calib); + % take closest point for now + I = I(1); + + % datevec(data(I,1)) + % datevec(time_calib) + + index_timecalib(calib_file) = I; + end + + % check + % datevec(data(index_timecalib,1)) + + % isolate gps calibration data + gps_data = data(index_timecalib,:); % time lat lon + + figure(1) + hold on + h1=plot(gps_data(:,2),gps_data(:,3),'.'); + grid on + if strcmp(systm,'Helzel') == 1 + set(h1,'marker','.','color','b') + elseif strcmp(systm,'Flament') == 1 + set(h1,'marker','x','color','k') + end + + % load antenna coordinates + cd .. + load([site '_Rx_coords.mat']) + + hold on + plot(lon,lat,'x') + grid on + title(['site = ' site ]) + + + %% theoretical values + % wavelength + lambda = 3E8/16.15E6; + + + % initialize variables + theta_pairs = nan(11,length(gps_data)); + + % for each gps point + for pt = 1:length(gps_data) + + % compute distance between GPS and antennas + for ant = 1:12 + clear E W + [E,W] = lonlat2km(gps_data(pt,2),gps_data(pt,3),lon(ant),lat(ant)); + ddist = sqrt(E.^2+W.^2); + r(ant) = ddist*1000; %meters + end + + + + %for each pair of antennas + for p = 1:11 + + %delta_r + delta_r(p) = r(p+1) - r(p); + + % theoretical phase + delta_phase_th(p,pt) = modsym((delta_r(p)*360./lambda),180); + + + % position of middle of pairs + clear lon_mid lat_mid + lon_mid = (lon(p+1)+lon(p))/2; + lat_mid = (lat(p+1)+lat(p))/2; + + % distance between middle of pair and one of the antenna in the pair + % clear E W + % [E,W] = lonlat2km(lon_mid,lat_mid,lon(p),lat(p)); + % ddist = sqrt(E.^2+W.^2); + % a(p) = ddist*1000; %meters + + % distance between middle of pair and GPS pt + clear ddsit phasAng + [ddist,phasAng] = sw_dist([gps_data(pt,3) lat_mid],[gps_data(pt,2) lon_mid],'km'); + r_mid(p) = ddist*1000; %meters + zeta(p) = phasAng; + + + % distance between pair of antennas + clear ddsit phasAng + [ddist,phasAng] = sw_dist([lat(p) lat(p+1)],[lon(p) lon(p+1)],'km'); + phi(p) = phasAng; + + + % azimuth + theta_pairs(p,pt) = modsym(zeta(p)-phi(p)+90,180); + %rad2deg(theta_pairs) + end + + + end + + figure(1) + legend('gps','antennas','location','southeast') + xlabel('longitude') + ylabel('latitude') + + + % for each pair of antenna + for p = 1:11 + figure(p+1) + h2=plot(theta_pairs(p,:),delta_phase_th(p,:),'x'); + hold on + h3=plot(theta_pairs(p,:),-delta_phase_obs(p,:),'or'); + grid on + xlabel('incidence (degrees)') + ylabel('phase difference (degrees)') + legend('theoretical','observed','location','best') + title([site ' - antennas ' num2str(p) '-' num2str(p+1)]) + + if strcmp(systm,'Helzel') == 1 + set(h2,'color','b') + set(h3,'color','r','marker','o') + elseif strcmp(systm,'Flament') == 1 + set(h2,'color','k','marker','*') + set(h3,'color','r','marker','sq','markerfacecolor','r') + end + + + % compute calibration value for antennas pairs + calib_value(p) = nanmean(modsym(-delta_phase_obs(p,:)-delta_phase_th(p,:),180),2); -.. topic:: PAP1 - - RadialConfigs_PAP1_20121213_WAPM_MUSIC402002_5Dsmooth - from 2012-12-13 to 2013-02-01 19:50 UTC + + % compute calibration value for each antenna + phi_ant(p+1,sys) = sum(calib_value); + + end + + P=ones(16,3); + P(13:16,:)=0; + P(1:12,3)=phi_ant(:,1); + - RadialConfigs_PAP1_20130201_BAPM_MUSIC402002_nosmooth - from 2013-02-01 19:50 UTC to now + % save file (we only keep results from Helzel + if strcmp(site,'PAO') == 1 + dlmwrite('calibration_pao_29OCT2014.wera',P,'delimiter','\t','precision','%.7f') + elseif strcmp(site,'PAB') == 1 + dlmwrite('calibration_pab_30OCT2014.wera',P,'delimiter','\t','precision','%.7f') + end + + + figure(13) + hold on + h4=plot(calib_value,'.-'); + grid on + xlabel('pairs of antennas') + ylabel({'phase difference between','theoretical and observed values (degrees)'}) + title(site) + + if strcmp(systm,'Helzel') == 1 + set(h4,'color','b') + elseif strcmp(systm,'Flament') == 1 + set(h4,'color','k') + legend('Helzel','Flament','location','southeast') + end + + + figure(14) + hold on + h5=plot([1:12],phi_ant(:,sys),'r'); + grid on + if strcmp(systm,'Helzel') == 1 + set(h5,'marker','o') + elseif strcmp(systm,'Flament') == 1 + set(h5,'marker','sq','markerfacecolor','r') + legend('Helzel','Flament','location','southeast') + end + xlabel('antenna number') + ylabel('calibration phase to be applied (degrees)') + title(site) + + if strcmp(site,'PAO') == 1 + break + end +end + +%add current calibration phases +if strcmp(site,'PAO') == 1 + load calibration_pao.wera + figure(14) + plot([1:12],calibration_pao(1:12,3),'b.-') + legend('Helzel','original calibration','location','northwest') +elseif strcmp(site,'PAB') == 1 + load calibration_pab.wera + figure(14) + plot([1:12],calibration_pab(1:12,3),'b.-') + legend('Helzel','Flament','original calibration','location','southeast') +end + + + + + + +% save figures +save_flag = 1; + +figdir = ('/home/bandma01/Dropbox/UQAR/MEOPAR_Marion/figures/WERAcalibration'); +cd(figdir) + +fig_hdl = figure(1); +if save_flag + fname = ['configuration_' site '_calibrations']; + fig_w = 8;%cm + fig_h = 5;%cm + set(fig_hdl,'PaperUnits','centimeters') + set(fig_hdl,'PaperPosition',[0 0 fig_w fig_h]) + set(fig_hdl, 'PaperSize', [fig_w fig_h]); + print(fig_hdl,'-dpng','-r500',fname) + %crop([fname '.png']) +end + + + + +for i = 2:12 + fig_hdl = figure(i); + if save_flag + fname = ['Phases_' site '_pair' num2str(i-1) '-' num2str(i)]; + fig_w = 8;%cm + fig_h = 5;%cm + set(fig_hdl,'PaperUnits','centimeters') + set(fig_hdl,'PaperPosition',[0 0 fig_w fig_h]) + set(fig_hdl, 'PaperSize', [fig_w fig_h]); + print(fig_hdl,'-dpng','-r500',fname) + % crop([fname '.png']) + end +end -.. topic:: STF2 - - RadialConfigs_STF2_20121220_BAPM_MUSIC402002_nosmooth - from 2012-12-20 to 2013-02-06 12:00 UTC - RadialConfigs_PAP1_20130201_BAPM_MUSIC402002_nosmooth - from 2013-02-01 19:50 UTC to now +fig_hdl = figure(13); +if save_flag + fname = ['PhaseDifference_' site '_calibrations']; + fig_w = 8;%cm + fig_h = 5;%cm + set(fig_hdl,'PaperUnits','centimeters') + set(fig_hdl,'PaperPosition',[0 0 fig_w fig_h]) + set(fig_hdl, 'PaperSize', [fig_w fig_h]); + print(fig_hdl,'-dpng','-r500',fname) + % crop([fname '.png']) +end +fig_hdl = figure(14); +if save_flag + fname = ['PhaseCalibration_' site]; + fig_w = 8;%cm + fig_h = 5;%cm + set(fig_hdl,'PaperUnits','centimeters') + set(fig_hdl,'PaperPosition',[0 0 fig_w fig_h]) + set(fig_hdl, 'PaperSize', [fig_w fig_h]); + print(fig_hdl,'-dpng','-r500',fname) + % crop([fname '.png']) +end diff --git a/build/html/_sources/calibration.txt b/build/html/_sources/calibration.txt index c4f561f5329bcae12a13893f212cd4be9009e1af..4d698810f6dc8ac24cad4e6900f9b1cd70102dae 100644 --- a/build/html/_sources/calibration.txt +++ b/build/html/_sources/calibration.txt @@ -10,7 +10,7 @@ CODAR **POINTE-AU-PERE:** *********************** -Please see notes from field work on `2013-02-01`_ +Please see notes from field work on `2013-02-01`_. .. _2013-02-01: http://demeter.uqar.ca/submesoscale/index.php/Pap @@ -67,6 +67,94 @@ To generate the new Antenna diagram: WERA ##### +Go to the **"Submesoscale"** `wiki`_ and click on "useful links" under **Outils**, then "WERA HF Radar Software - Fortran Programs Documentation". Here we find which Fortran program we need to use to do what we want. + +.. _wiki: http://demeter.uqar.ca/submesoscale/index.php/Accueil + + +.. topic:: Objectives + + We need to "remove wrong calibration data and apply new ones", so we need to use Modify_WERA_SORT. + + + + +Steps to generate new calibration file +***************************************** + + #. loggin to the wera server wera@132.215.11.14 + #. cd etc/ + +In this folder, we find the original calibration files: + - calibration_pab.wera + - calibration_pao.wera + +If we look at what the content of the calibration file: + - cat calibration_pab.wera + +the phase is given in the 3rd column. + + +On 2014-10-29 (PAO) and 2014_10-30 (PAB), calibrations were undertaken in the field. + +Calibration data are stored in: + - /hfr-data-processing/calibrations/PAB/2014303 every minute from 16:53 to 17:55 + - /hfr-data-processing/calibrations/PAO/2014302 every minute from 17:46 to 18:23 + +While the calibrations were running, tracks were recorded with an instrument belonging to Helzel (PAO and PAB) as well as with an instrument belonging to Flament (PAB). So for PAB we are going to be able to compare the two. + +The tracks can be found in : + - /hfr-data-processing/calibrations/PAO/HelzelPAO_Track_29-OCT-14 183138.gpx + - /hfr-data-processing/calibrations/PAB/HelzelPAB_Track_30-OCT-14 175446.gpx + - /hfr-data-processing/calibrations/PAB/FlamentPAB_Track_30-OCT-14 182008.gpx + +We use the routine **GPS_gpx2mat.m** to convert .gpx files into .mat files. +We use the routine **WERA_AntennaCoord_txt2mat.m** to transform the .txt files with antennas'coordinates to .mat files. +We use the routine **WERAphase_txt2mat.m** to convert the .txt files containing phases into .mat files. + +The routine **WERAcalibration.m** is available at this `page`_. + +.. _page: WERAcalibration.html + + +All the Matlab routines are located in ~/hfr-data-processing/calibrations/. + + + + + +Re-processing of radial currents with new phases +*************************************************** + +For the all month of September 2013, we are going to generate new files using the new calibration phases. + +Post-processing of WERA radial currents is documented `here`_. + +.. _here: WERAprocessing.html + +For example, let us see what we have to do to generate radial currents at PAO using the new calibration phases for september 1st, 2013 (Julian day 244): + +Data in the ~/data1/PAO/2013244/raw/ folder are converted in .SORT and .RFI in the ~/data1/PAO/2013244/results/ folder using the **do_process_SORT_pol** shell script. These files are generated using the "original" calibration phases. + + + +First we need to change the original .SORT and .RFI files and save them to .SORT0 and .RFI0 to save them for future reference. This is done with the shell script **changeName.sh** located in /hfr-data-processing/postprocessing/wera/. + +.SORT====> .SORT0 (generated with original calibration) +.RFI ====> .RFI0 + + + + +as well as 2 symbolic links to point towards which file is the calibration to remove (with link calibration.wera.remove) and which file is the calibration to use (with link calibration.wera.apply). + + +If we look at what the content of the calibration file is: + * cat calibration_pab.wera + +We want to compare the value of the phase given in the 3rd column with the one that we compute. + + COMPARISON OLD/NEW WERA CALIBRATIONS ************************************** diff --git a/build/html/calibration.html b/build/html/calibration.html index 95d82c72e3b32b0a0c37a31439208400080edc06..529ed7fd7b32ebe122b7460479a954199b69b1ed 100644 --- a/build/html/calibration.html +++ b/build/html/calibration.html @@ -55,7 +55,7 @@

CODAR

POINTE-AU-PERE:

-

Please see notes from field work on 2013-02-01

+

Please see notes from field work on 2013-02-01.

Starting 2013-02-01: Change of frequency due to a misreading in the frequency permits...

    @@ -108,6 +108,77 @@

WERA

+

Go to the “Submesoscale” wiki and click on “useful links” under Outils, then “WERA HF Radar Software - Fortran Programs Documentation”. Here we find which Fortran program we need to use to do what we want.

+
+

Objectives

+

We need to “remove wrong calibration data and apply new ones”, so we need to use Modify_WERA_SORT.

+
+
+

Steps to generate new calibration file

+
+
    +
  1. loggin to the wera server wera@132.215.11.14
  2. +
  3. cd etc/
  4. +
+
+
+
In this folder, we find the original calibration files:
+
    +
  • calibration_pab.wera
  • +
  • calibration_pao.wera
  • +
+
+
If we look at what the content of the calibration file:
+
    +
  • cat calibration_pab.wera
  • +
+
+
+

the phase is given in the 3rd column.

+

On 2014-10-29 (PAO) and 2014_10-30 (PAB), calibrations were undertaken in the field.

+
+
Calibration data are stored in:
+
    +
  • /hfr-data-processing/calibrations/PAB/2014303 every minute from 16:53 to 17:55
  • +
  • /hfr-data-processing/calibrations/PAO/2014302 every minute from 17:46 to 18:23
  • +
+
+
+

While the calibrations were running, tracks were recorded with an instrument belonging to Helzel (PAO and PAB) as well as with an instrument belonging to Flament (PAB). So for PAB we are going to be able to compare the two.

+
+
The tracks can be found in :
+
    +
  • /hfr-data-processing/calibrations/PAO/HelzelPAO_Track_29-OCT-14 183138.gpx
  • +
  • /hfr-data-processing/calibrations/PAB/HelzelPAB_Track_30-OCT-14 175446.gpx
  • +
  • /hfr-data-processing/calibrations/PAB/FlamentPAB_Track_30-OCT-14 182008.gpx
  • +
+
+
+

We use the routine GPS_gpx2mat.m to convert .gpx files into .mat files. +We use the routine WERA_AntennaCoord_txt2mat.m to transform the .txt files with antennas’coordinates to .mat files. +We use the routine WERAphase_txt2mat.m to convert the .txt files containing phases into .mat files.

+

The routine WERAcalibration.m is available at this page.

+

All the Matlab routines are located in ~/hfr-data-processing/calibrations/.

+
+
+

Re-processing of radial currents with new phases

+

For the all month of September 2013, we are going to generate new files using the new calibration phases.

+

Post-processing of WERA radial currents is documented here.

+

For example, let us see what we have to do to generate radial currents at PAO using the new calibration phases for september 1st, 2013 (Julian day 244):

+

Data in the ~/data1/PAO/2013244/raw/ folder are converted in .SORT and .RFI in the ~/data1/PAO/2013244/results/ folder using the do_process_SORT_pol shell script. These files are generated using the “original” calibration phases.

+

First we need to change the original .SORT and .RFI files and save them to .SORT0 and .RFI0 to save them for future reference. This is done with the shell script changeName.sh located in /hfr-data-processing/postprocessing/wera/.

+

.SORT====> .SORT0 (generated with original calibration) +.RFI ====> .RFI0

+

as well as 2 symbolic links to point towards which file is the calibration to remove (with link calibration.wera.remove) and which file is the calibration to use (with link calibration.wera.apply).

+
+
If we look at what the content of the calibration file is:
+
    +
  • cat calibration_pab.wera
  • +
+
+
+

We want to compare the value of the phase given in the 3rd column with the one that we compute.

+

COMPARISON OLD/NEW WERA CALIBRATIONS

In March 2015, we used data collected in September 2013 to compare old and new calibrations in order to know which ones we should use for the on-going analysis of currents data.

@@ -142,6 +213,8 @@ Superimposed are the 48-h averages
  • WERA
  • diff --git a/build/html/index.html b/build/html/index.html index 51120d34dfaabde0efeb5832c9c711035a7f3a41..fbd0c1512f7aa765deeef9808166b08a6c179aaf 100644 --- a/build/html/index.html +++ b/build/html/index.html @@ -64,6 +64,8 @@
  • WERA
  • diff --git a/build/html/searchindex.js b/build/html/searchindex.js index a0886b431851b820aec49ae8a74114e2262b98a0..cd3cee19d0edbad509371595350178ba648a185c 100644 --- a/build/html/searchindex.js +++ b/build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({envversion:42,terms:{all:[0,9,3,6],reprocess:6,correl:0,marion:[],follow:[9,3],disk:9,row:[],content:[9,6],misread:6,demet:[],matlab:[0,3],under:0,unzip:3,everi:[7,3],projet:3,volum:9,spectratoprocess:9,cyan:0,tri:3,hour:[7,3],hfrmat:3,measpattern:9,pleas:6,direct:[],past:9,download:[7,3],index:0,what:[9,3],compar:[0,6],section:1,advanc:9,cell:[],hourli:[0,3,6],conduct:3,"new":7,can:9,codar2:9,codar1:9,gener:[7,3,6],here:0,water:8,modifi:[],"200px":0,search:[],idealpattern:9,hfr_data_process:3,permit:6,chang:[9,6],via:[0,3],pap1_css_:9,lawrenc:8,modul:[],"_ascii":7,apm:6,total:[0,3],select:0,from:[7,3],pere:[],websit:3,music:[9,6],seasonderadialsetup:6,postprocess:[],stage:3,rad2tot:3,more:1,sort:7,relat:1,flag:9,retriev:9,currentscombin:[],setup:9,work:[1,3,6],whatev:[],deg:9,heur:7,download_codar_rt:3,uncheck:9,surfac:0,radial_comparison:0,check_up:[],newcalibr:7,radialvelocompa_sept2013_hfr_adcp_wera_adcpcorrected_v2:0,uqar:[1,7,9],verifi:0,csv:3,config:9,mat:[0,7,3,9],after:[0,9],spot:8,diagram:[9,6],befor:[0,9],meopar:[0,1,7],attent:9,date:[7,6],data:[],averag:[0,3,6],youwish:[],spectra:9,correspond:0,element:[],allow:0,cs4:9,order:[8,6],oper:6,move:[9,3],lst:7,same:0,estuari:8,paramet:[0,9],thumb:0,hfr_lsle_20150817t170000z:3,iml:0,onc:9,lsle:[7,8],main:1,thei:[],dai:[9,7],now:[],name:0,each:[0,7,3,8],found:7,reprocess_ogsl_hfr_treat:3,xlp:[9,6],crontab:3,year:7,extract:0,orient:0,open:[9,6],research:[],categori:[],vector:0,red:0,bathymetri:0,gridwithnan_adcp:0,org:7,care:9,angl:0,filter:[9,6],caption:[],radialconfigs_stf2_20130206_bapm_music402002_nosmooth:[],onto:0,origin:9,rang:0,do_process_sort_pol:7,currentshfrwithaverageexport:3,sometim:9,compsnewcalib_radialvelo_adcp_pao_sept2013:0,miss:9,given:0,script:[0,7,3],system:[7,3],spectraseri:9,saint:8,store:[0,9],shell:[7,3],travail:3,option:[],season:[],copi:[9,3,6],specifi:0,part:1,than:[0,7],png:0,stf:[9,3],provid:3,dispers:1,remov:9,structur:0,project:[0,1],were:8,posit:0,minut:[0,3],submesoscal:[],hfr:[],comput:[0,3],adcp_pao_version5adcpcorrected_newcalibrations_v2:0,julian:7,raw:7,"20d":9,have:[9,7],need:9,ismer:1,min:3,superimpos:[0,6],note:6,also:9,ideal:9,which:6,data1:7,data2:7,sure:9,seasond:9,marin:1,ogsl_hfr_treat:3,deploi:8,phase:9,everyth:9,doe:[9,3],azimuth:0,left:0,radial2uv:9,find:[0,1,7],fichier:0,onli:[0,9],locat:[7,3],delet:9,should:[7,6],theme:[],analyz:0,folder:[9,7],u_mean_adcp:0,local:9,info:1,variou:8,get:[0,9],yadcp:0,ssh:[7,3],adcp:[],version5_pao_ol_nofullc:7,ascii2mat:3,organ:1,contain:0,rfi:7,ftp_transfer:7,see:6,result:[0,7,3],"55min":3,patt:6,forecast:1,figur:0,between:1,theta:0,betwen:0,extent:7,subfold:7,bodi:[],last:3,umean_adcp_v:0,umean_adcp_u:0,april:7,"15min":0,improv:1,whole:0,load:0,point:[],css_:9,period:0,walk:6,header:9,drogu:8,diff:0,boat:6,coupl:1,come:9,loggin:[9,7],due:6,been:9,compon:0,much:7,interest:[0,9],download_wera_rt:3,imag:[],convert:[7,3],coordin:0,togeth:3,look:0,observ:3,loop:[9,6],metric:6,site:[0,1,3,6,9,7],archiv:[9,3],zonal:0,ascii:3,pap:[9,3,6],media:[0,7],make:[0,9],dyndn:7,pab:[0,7,3],meridion:0,fill:9,pao:[0,7,3,6],http:3,webserv:3,closest:0,patt_pap1_2012_12_15:6,radialconfigs_pap1_20130201_bapm_music402002_20dsmooth:9,php:[],lower:8,appropri:9,kept:3,hfr_process:3,know:6,exampl:[0,9,7],thi:[0,1,3,8],choos:0,model:1,bandet:[],usual:0,distanc:0,identifi:7,calibr:[],had:8,desktop:9,instrument:8,add:9,radialconfig:[9,6],els:[],save:9,approxim:3,bin:[0,7,6],march:[9,6],format:3,grid:[0,3],weraprocess:[],radiallst2uv:7,measur:9,like:[],hfrdata:3,rangeadcp:0,spectraprocess:9,server:[7,3,9],collect:6,either:0,output:[1,7,6],page:1,www:3,right:0,old:[],codarprocess:[],back:9,sampl:8,home:[7,3],rsync:7,txt:9,per:7,seagatewireless:[0,7],estim:0,run:[0,7,3,9,6],radial:[],step:[0,1,6],ruv:[9,3],"20132440000_pao":0,simpler:7,comparison:[],about:1,bandma01:[0,7],column:8,codar_wera_ogsl:3,degre:0,srv:3,mean:0,routin:3,within:0,automat:9,vr_adcp_proj:0,weather:[],your:[],span:[],log:3,transfer:9,transform:9,avail:[0,3],start:[9,6],yyyyjjj:7,line:9,adcpbin2vspaosept2013:0,patt_pap1_2014_01_14_1154_nosmooth:9,codardata:9,smooth:[9,6],displai:3,until:6,ruv2mat:3,below:1,crad_pol_lst:7,"export":3,radialconfigs_pap1_20130201_bapm_music402002_nosmooth:[9,6],creat:9,"48h":0,"int":[],file:[0,7,3,9,6],pap1:[],check:[],ur_adcp_proj:0,antenna:[9,6],field:[1,6],other:1,you:[1,7,9],trash:9,drift:[0,1],meaning:0,xadcp:0,algorithm:0,directori:[3,6],htdoc:3,orientationpaosept2013:0,buoi:[1,8],depth:8,matfil:3,time:0},objtypes:{},objnames:{},filenames:["Comparison_WERA-ADCP_Sept2013","index","20130826","CurrentsCombination","20130830","20130515","calibration","WERAprocessing","20140506","CODARprocessing"],titles:["Comparison WERA and ADCP radial velocities September 2013","Welcome to the documentation of High Frequency Radars (CODAR and WERA)","Experiment on August 26, 2013","Current combination and OGSL data feed","Experiment on August 20, 2013","Experiment on May 15, 2013","Calibrations","WERA radial currents processing","Experiment on May 06, 2014","CODAR radial currents processing"],objects:{},titleterms:{feed:3,calibr:6,old:6,point:6,process:[9,7],direct:0,indic:[],high:1,radar:1,tabl:[],pap1:[],check:[],august:[2,4],from:6,welcom:1,pere:6,current:[7,3,9],quasi:[],saint:6,conduct:[],"new":6,lsle:[],document:1,codar:[1,9,6],realtim:[],analysi:[],postprocess:1,comparison:[0,6],ogsl:3,stf2:[],adcp:0,mai:[5,8],post:[],now:6,data:3,radialconfigs_stf2_20121220_bapm_music402002_nosmooth:[],utc:6,experi:[1,2,5,8,4],radialconfigs_pap1_20121213_wapm_music402002_5dsmooth:[],frequenc:1,veloc:0,hfr:0,list:[],documentation_hfr_analysi:[],wera:[0,1,7,6],combin:3,radial:[0,9,7],flavi:6,septemb:0}}) \ No newline at end of file +Search.setIndex({envversion:42,terms:{all:[0,10,8,3,6],reprocess:6,month:6,correl:0,marion:[],follow:[10,3],disk:10,paperposit:8,row:[],content:[10,6],misread:6,middl:8,demet:[],program:6,matlab:[0,3,6],under:[0,6],time_calib:8,unzip:3,everi:[7,3,6],wera_antennacoord_txt2mat:6,projet:3,print:8,configuration_:8,volum:10,spectratoprocess:10,cyan:0,tri:3,hour:[7,3],hfrmat:3,modify_wera_sort:6,measpattern:10,datenum:8,"2min34sec":8,dir:8,pleas:6,direct:[],crop:8,past:10,download:[7,3],"_submesoscal":[],click:6,index:0,what:[10,3,6],compar:[0,6],section:1,advanc:10,abl:6,cell:[],hourli:[0,3,6],conduct:[],"new":7,can:[10,6],codar2:10,codar1:10,gener:[7,3],lon_mid:8,here:[0,6],water:9,let:6,modifi:[],legend:8,valu:[8,6],"200px":0,search:[],datevec:8,idealpattern:10,precis:8,hfr_data_process:3,permit:6,chang:[10,6],pierr:8,via:[0,3],theta_pair:8,pap1_css_:10,appli:[8,6],approxim:3,"_ascii":7,"3e8":8,apm:6,marker:8,dispers:1,fig_h:8,select:0,plot:8,from:7,pere:[],two:6,websit:3,music:[10,6],seasonderadialsetup:6,postprocess:[],stage:3,rad2tot:3,more:1,sort:[7,6],flamentpab_track_30:[8,6],ylabel:8,flag:10,hold:8,sw_dist:8,retriev:10,currentscombin:[],analys:8,setup:10,work:[1,3,6],cat:6,whatev:[],deg:10,heur:7,want:6,download_codar_rt:3,uncheck:10,surfac:0,end:8,radial_comparison:0,check_up:[],newcalibr:7,radialvelocompa_sept2013_hfr_adcp_wera_adcpcorrected_v2:0,uqar:[1,8,7,10],verifi:0,csv:3,config:10,str2doubl:8,mat:[0,8,3,6,10,7],after:[0,10],spot:9,diagram:[10,6],befor:[0,10],wrong:6,meopar:[0,1,7],attent:10,date:[8,7,6],data:[],averag:[0,3,6],youwish:[],confus:8,spectra:10,correspond:[0,8],element:[],inform:8,allow:0,cs4:10,lambda:8,order:[9,6],oper:6,move:[10,3],meter:8,lst:7,same:0,estuari:9,nombr:8,paramet:[0,10],thumb:0,hfr_lsle_20150817t170000z:3,iml:0,late:8,lonlat2km:8,wrt:8,onc:10,total:[0,3],lsle:[7,9],main:1,isdir:8,them:6,"return":8,thei:[],dai:[10,7,6],initi:8,systm:8,"break":8,now:[],name:[0,8],separ:8,each:[0,7,8,3,9],found:[7,6],reprocess_ogsl_hfr_treat:3,xlp:[10,6],fig_hdl:8,crontab:3,year:7,wavelength:8,extract:[0,8],orient:0,out:[],variabl:8,"3rd":6,open:[10,6],research:[],categori:[],vector:0,calib:8,calib_fil:8,red:0,fig_w:8,bathymetri:0,differ:8,gridwithnan_adcp:0,org:7,"byte":8,care:10,angl:0,unwant:8,keep:8,filter:[10,6],caption:[],length:8,radialconfigs_stf2_20130206_bapm_music402002_nosmooth:[],onto:0,first:6,origin:[10,8,6],softwar:6,rang:0,do_process_sort_pol:[7,6],currentshfrwithaverageexport:3,number:8,sometim:10,compsnewcalib_radialvelo_adcp_pao_sept2013:0,lat:8,done:6,lat_mid:8,miss:10,given:[0,6],script:[0,7,3,6],system:[7,8,3],spectraseri:10,saint:9,gpx:6,store:[0,10,6],shell:[7,3,6],travail:3,option:[],season:[],calib_hr:8,copi:[10,3,6],specifi:0,part:1,than:[0,7],png:[0,8],center:8,stf:[10,3],provid:3,remov:[10,8,6],delta_phase_th:8,structur:[0,8],project:[0,1],xlabel:8,were:[9,6],posit:[0,8],minut:[0,3,6],toward:6,submesoscal:6,seri:8,latitud:8,hfr:[],comput:[0,8,3,6],adcp_pao_version5adcpcorrected_newcalibrations_v2:0,julian:[7,6],ant:8,raw:[7,6],"20d":10,have:[10,7,6],need:[10,6],ismer:1,calib_min:8,min:3,centimet:8,superimpos:[0,6],note:6,also:10,ideal:10,gps_data:8,take:8,which:6,data1:[7,6],data2:7,sure:10,track:6,calibration_pao_29oct2014:8,seasond:10,marin:1,ogsl_hfr_treat:3,deploi:9,phase:10,everyth:10,clear:8,doe:[10,3],azimuth:[0,8],left:0,radial2uv:10,calib_year:8,gps_gpx2mat:6,find:[0,1,8,7,6],fichier:[0,8],onli:[0,10,8],locat:[7,8,3,6],calibration_pao:[8,6],phasedifference_:8,calibration_pab:[8,6],should:[7,6],theme:[],analyz:0,elseif:8,folder:[10,7,6],u_mean_adcp:0,local:10,oct:[8,6],info:1,calib_tim:8,flament:[8,6],variou:9,get:[0,10],yadcp:0,ssh:[7,3],adcp:[],version5_pao_ol_nofullc:7,index_timecalib:8,ascii2mat:3,organ:1,helzelpao_track_29:[8,6],contain:[0,6],rfi:[7,6],wiki:6,set:8,incid:8,ftp_transfer:7,matlab_analysi:[],see:6,sec:8,result:[0,7,8,3,6],close:8,"55min":3,best:8,patt:6,rad2deg:8,delta_phase_ob:8,forecast:1,figur:[0,8],between:[1,8],theta:0,betwen:0,"15e6":8,isol:8,southeast:8,extent:7,subfold:7,bodi:[],last:3,delimit:8,helzel:[8,6],umean_adcp_v:0,umean_adcp_u:0,april:7,calibration_pab_30oct2014:8,caibrat:[],"15min":0,improv:1,whole:0,load:[0,8],point:[],color:8,had:9,period:0,walk:6,header:10,drogu:9,diff:[0,8],zeta:8,boat:6,coupl:1,instrument:[9,6],come:10,loggin:[10,7,6],due:6,been:10,compon:0,much:7,interest:[0,10],download_wera_rt:3,delet:10,imag:[],radialconfig:[10,6],convert:[7,3,6],coordin:[0,8,6],togeth:3,calib_valu:8,"_calibr":8,look:[0,8,6],"_pair":8,"while":6,observ:[8,3],loop:[10,6],metric:6,site:[0,1,8,3,6,10,7],archiv:[10,3],zonal:0,ascii:3,rfi0:6,pap:[10,3,6],dataconvers:[],etc:6,media:[0,7],make:[0,10],belong:6,sqrt:8,pab:[0,7,8,3,6],meridion:0,northwest:8,meopar_marion:8,num2str:8,pao:[0,7,8,3,6],phi:8,http:3,webserv:3,closest:[0,8],patt_pap1_2012_12_15:6,sort0:6,radialconfigs_pap1_20130201_bapm_music402002_20dsmooth:10,php:[],lower:9,appropri:10,kept:3,hfr_process:3,well:6,exampl:[0,10,7,6],thi:[0,1,3,9,6],choos:0,undertaken:6,model:1,bandet:[],usual:0,distanc:[0,8],identifi:7,ddist:8,calibr:[],dyndn:7,css_:10,wee:[],ur_adcp_proj:0,theoret:8,desktop:10,fortran:6,add:[10,8],lawrenc:9,els:[],save:[10,8,6],modul:[],bin:[0,7,6],march:[10,6],fname:8,format:3,phasang:8,grid:[0,8,3],know:6,radiallst2uv:7,paperunit:8,measur:10,"_rx_coord":8,like:[],hfrdata:3,rangeadcp:0,spectraprocess:10,server:[7,3,10,6],collect:6,either:0,output:[1,7,6],page:[1,6],r500:8,www:3,right:0,old:[],codarprocess:[],"1st":6,back:10,weraphase_txt2mat:6,sampl:9,home:[7,8,3],rsync:7,txt:[10,6],dlmwrite:8,markerfacecolor:8,avoid:8,"2014_10":6,per:7,seagatewireless:[0,7],estim:0,phases_:8,outil:6,refer:6,run:[0,7,3,10,6],accueil:[],radial:[],delta_r:8,modsym:8,step:0,ruv:[10,3],"20132440000_pao":0,simpler:7,comparison:[],about:1,nanmean:8,bandma01:[0,8,7],column:[9,6],codar_wera_ogsl:3,strcmp:8,degre:[0,8],srv:3,mean:0,routin:[3,6],figdir:8,within:0,automat:10,pair:8,vr_adcp_proj:0,weather:[],phasecalibration_:8,your:[],helzelpab_track_30:[8,6],span:[],log:3,transfer:10,lon:8,transform:[10,6],changenam:6,avail:[0,3,6],start:[10,6],r_mid:8,link:6,yyyyjjj:7,line:10,adcpbin2vspaosept2013:0,patt_pap1_2014_01_14_1154_nosmooth:10,codardata:10,made:8,save_flag:8,smooth:[10,6],displai:3,until:6,ruv2mat:3,record:6,below:1,sum:8,crad_pol_lst:7,"export":3,radialconfigs_pap1_20130201_bapm_music402002_nosmooth:[10,6],creat:10,"48h":0,"int":[],ddsit:8,dpng:8,file:[0,7,3,10],pap1:[],check:[],fill:10,antenna:[10,8,6],titl:8,nan:8,weraprocess:[],field:[1,6],other:1,futur:6,papers:8,you:[1,7,10],trash:10,relat:1,symbol:6,drift:[0,1],meaning:0,dropbox:8,calib_jd:8,xadcp:0,longitud:8,phi_ant:8,nfile:8,algorithm:0,directori:[3,6],htdoc:3,orientationpaosept2013:0,buoi:[1,9],depth:9,matfil:3,time:[0,8]},objtypes:{},objnames:{},filenames:["Comparison_WERA-ADCP_Sept2013","index","20130826","CurrentsCombination","20130830","20130515","calibration","WERAprocessing","WERAcalibration","20140506","CODARprocessing"],titles:["Comparison WERA and ADCP radial velocities September 2013","Welcome to the documentation of High Frequency Radars (CODAR and WERA)","Experiment on August 26, 2013","Current combination and OGSL data feed","Experiment on August 20, 2013","Experiment on May 15, 2013","Calibrations","WERA radial currents processing","WERAcalibration.m","Experiment on May 06, 2014","CODAR radial currents processing"],objects:{},titleterms:{feed:3,calibr:6,old:6,point:6,process:[10,7,6],direct:0,indic:[],high:1,radar:1,file:6,tabl:[],pap1:[],check:[],from:6,welcom:1,pere:6,current:[7,3,10,6],quasi:[],postprocess:1,conduct:[],weracalibr:8,"new":6,lsle:[],document:1,codar:[1,10,6],realtim:[],analysi:[],saint:6,august:[2,4],comparison:[0,6],gener:6,object:6,ogsl:3,step:6,stf2:[],adcp:0,phase:6,post:[],now:6,data:3,radialconfigs_stf2_20121220_bapm_music402002_nosmooth:[],utc:6,experi:[1,2,5,9,4],radialconfigs_pap1_20121213_wapm_music402002_5dsmooth:[],frequenc:1,veloc:0,hfr:0,list:[],documentation_hfr_analysi:[],wera:[0,1,7,6],combin:3,mai:[5,9],radial:[0,10,7,6],flavi:6,septemb:0}}) \ No newline at end of file diff --git a/source/Comparison_WERA-ADCP_Sept2013.rst b/source/Comparison_WERA-ADCP_Sept2013.rst index 473d8193d8aed5a8ecbd079235109c0b5dcf811b..856acf68bd388872a38219b5de130f16eba480fd 100644 --- a/source/Comparison_WERA-ADCP_Sept2013.rst +++ b/source/Comparison_WERA-ADCP_Sept2013.rst @@ -37,7 +37,7 @@ Steps of the algorithm: For each index, we load the corresponding HFR file (i.e. 20132440000_pao.mat). Each file contains a grid (X,Y) with radial currents at each grid point (Ur), a corresponding time vector (t) and the angle and distance from the site (theta,r). -.. figure:: ../../figures/RadialVelocities/ADCP/Radial_ADCPbin2_HFR_PAO_version5_Sept2013.png +.. figure:: figures/Radial_ADCPbin2_HFR_PAO_version5_Sept2013.png :align: center Hourly radial currents from ADCP bin 2 and HFR WERA at PAO - September 2013 diff --git a/source/WERAcalibration.rst b/source/WERAcalibration.rst new file mode 100644 index 0000000000000000000000000000000000000000..136cf525113b89803602d05ac647c4e8538f6f2c --- /dev/null +++ b/source/WERAcalibration.rst @@ -0,0 +1,376 @@ +WERAcalibration.m +******************* + +clear all +close all + +%cd('/home/bandma01/Documents/WERAs/') +cd('/home/bandma01/hfr-data-processing/calibrations/') + +% site = 'PAO'; +site = 'PAB'; +cd(site) + +% system +for sys = 1:2 + + if sys == 1 + systm = 'Helzel'; + elseif sys == 2 + systm = 'Flament'; + end + + clear J I E Phase calib_file calib_hr calib_jd calib_min calib_time calib_value + clear calib_year d data delta_phase_obs delta_phase_th gps_data index_timecalib + clear theta_pairs + + if strcmp(site,'PAO') == 1 + + load('HelzelPAO_Track_29-OCT-14 183138.mat') + + elseif strcmp(site,'PAB') == 1 + + if strcmp(systm,'Helzel') == 1 + load('HelzelPAB_Track_30-OCT-14 175446.mat') + elseif strcmp(systm,'Flament') == 1 + load('FlamentPAB_Track_30-OCT-14 182008.mat') + end + + end + + + %% phases and time of calibration + if strcmp(site,'PAO') == 1 + cd('2014302') + elseif strcmp(site,'PAB') == 1 + cd('2014303') + end + + % list files + clear d + d = dir('*.mat'); % returns a structure with name, date, bytes, isdir, datenum + Nfiles = length(d); % nombre de fichiers a analyser + + + % look at the names of files and extract information + for c = 1:Nfiles + calib_year(c) = str2double(d(c).name(1:4)); + calib_jd(c) = str2double(d(c).name(5:7)); + calib_hr(c) = str2double(d(c).name(8:9)); + calib_min(c) = str2double(d(c).name(10:11)); + + load(d(c).name,'phase') + + Phase(:,c) = phase; + end + clear phase + + delta_phase_obs = modsym(diff(Phase,1),180); + + To = datenum(2014,01,01,0,0,0); + + % add 20 sec to center calibration time + calib_time = To + calib_jd -1 + calib_hr./24 + calib_min/24/60 + 20/24/3600; + % datevec(calib_time) + + if strcmp(site,'PAO') == 1 + % calib time 2min34sec late wrt GPS + calib_time = calib_time + 2/24/60 + 34/24/3600; + end + + %% separate between calibrations made with Helzel's system and Pierre's system + % date of new calibration files + % Helzel 2014-10-30 16:52 to 17:54 + % Flament 2014-10-30 17:55 to 18:20 + T1 = datenum(2014,10,30,17,59,00); + + + clear J + if strcmp(systm,'Helzel') == 1 + J = find(calib_time > T1); + elseif strcmp(systm,'Flament') == 1 + J = find(calib_time > T1); + end + + %remove unwanted data to avoid confusion! + calib_year(J)=[]; + calib_jd(J)=[]; + calib_hr(J)=[]; + calib_min(J)=[]; + Phase(:,J)=[]; + delta_phase_obs(:,J)=[]; + calib_time(J)=[]; + d(J)=[]; + clear c Nfiles + + %+++++++++++++++++++++++++++++++++++++++++ + % for each calibration file (series# 1) + %+++++++++++++++++++++++++++++++++++++++++ + for calib_file = 1:length(calib_time) + + time_calib = calib_time(calib_file); + + % find corresponding file in gps data + clear I + I = find(data(:,1) > time_calib); + % take closest point for now + I = I(1); + + % datevec(data(I,1)) + % datevec(time_calib) + + index_timecalib(calib_file) = I; + end + + % check + % datevec(data(index_timecalib,1)) + + % isolate gps calibration data + gps_data = data(index_timecalib,:); % time lat lon + + figure(1) + hold on + h1=plot(gps_data(:,2),gps_data(:,3),'.'); + grid on + if strcmp(systm,'Helzel') == 1 + set(h1,'marker','.','color','b') + elseif strcmp(systm,'Flament') == 1 + set(h1,'marker','x','color','k') + end + + % load antenna coordinates + cd .. + load([site '_Rx_coords.mat']) + + hold on + plot(lon,lat,'x') + grid on + title(['site = ' site ]) + + + %% theoretical values + % wavelength + lambda = 3E8/16.15E6; + + + % initialize variables + theta_pairs = nan(11,length(gps_data)); + + % for each gps point + for pt = 1:length(gps_data) + + % compute distance between GPS and antennas + for ant = 1:12 + clear E W + [E,W] = lonlat2km(gps_data(pt,2),gps_data(pt,3),lon(ant),lat(ant)); + ddist = sqrt(E.^2+W.^2); + r(ant) = ddist*1000; %meters + end + + + + %for each pair of antennas + for p = 1:11 + + %delta_r + delta_r(p) = r(p+1) - r(p); + + % theoretical phase + delta_phase_th(p,pt) = modsym((delta_r(p)*360./lambda),180); + + + % position of middle of pairs + clear lon_mid lat_mid + lon_mid = (lon(p+1)+lon(p))/2; + lat_mid = (lat(p+1)+lat(p))/2; + + % distance between middle of pair and one of the antenna in the pair + % clear E W + % [E,W] = lonlat2km(lon_mid,lat_mid,lon(p),lat(p)); + % ddist = sqrt(E.^2+W.^2); + % a(p) = ddist*1000; %meters + + % distance between middle of pair and GPS pt + clear ddsit phasAng + [ddist,phasAng] = sw_dist([gps_data(pt,3) lat_mid],[gps_data(pt,2) lon_mid],'km'); + r_mid(p) = ddist*1000; %meters + zeta(p) = phasAng; + + + % distance between pair of antennas + clear ddsit phasAng + [ddist,phasAng] = sw_dist([lat(p) lat(p+1)],[lon(p) lon(p+1)],'km'); + phi(p) = phasAng; + + + % azimuth + theta_pairs(p,pt) = modsym(zeta(p)-phi(p)+90,180); + %rad2deg(theta_pairs) + end + + + end + + figure(1) + legend('gps','antennas','location','southeast') + xlabel('longitude') + ylabel('latitude') + + + % for each pair of antenna + for p = 1:11 + figure(p+1) + h2=plot(theta_pairs(p,:),delta_phase_th(p,:),'x'); + hold on + h3=plot(theta_pairs(p,:),-delta_phase_obs(p,:),'or'); + grid on + xlabel('incidence (degrees)') + ylabel('phase difference (degrees)') + legend('theoretical','observed','location','best') + title([site ' - antennas ' num2str(p) '-' num2str(p+1)]) + + if strcmp(systm,'Helzel') == 1 + set(h2,'color','b') + set(h3,'color','r','marker','o') + elseif strcmp(systm,'Flament') == 1 + set(h2,'color','k','marker','*') + set(h3,'color','r','marker','sq','markerfacecolor','r') + end + + + % compute calibration value for antennas pairs + calib_value(p) = nanmean(modsym(-delta_phase_obs(p,:)-delta_phase_th(p,:),180),2); + + + % compute calibration value for each antenna + phi_ant(p+1,sys) = sum(calib_value); + + end + + P=ones(16,3); + P(13:16,:)=0; + P(1:12,3)=phi_ant(:,1); + + + % save file (we only keep results from Helzel + if strcmp(site,'PAO') == 1 + dlmwrite('calibration_pao_29OCT2014.wera',P,'delimiter','\t','precision','%.7f') + elseif strcmp(site,'PAB') == 1 + dlmwrite('calibration_pab_30OCT2014.wera',P,'delimiter','\t','precision','%.7f') + end + + + figure(13) + hold on + h4=plot(calib_value,'.-'); + grid on + xlabel('pairs of antennas') + ylabel({'phase difference between','theoretical and observed values (degrees)'}) + title(site) + + if strcmp(systm,'Helzel') == 1 + set(h4,'color','b') + elseif strcmp(systm,'Flament') == 1 + set(h4,'color','k') + legend('Helzel','Flament','location','southeast') + end + + + figure(14) + hold on + h5=plot([1:12],phi_ant(:,sys),'r'); + grid on + if strcmp(systm,'Helzel') == 1 + set(h5,'marker','o') + elseif strcmp(systm,'Flament') == 1 + set(h5,'marker','sq','markerfacecolor','r') + legend('Helzel','Flament','location','southeast') + end + xlabel('antenna number') + ylabel('calibration phase to be applied (degrees)') + title(site) + + if strcmp(site,'PAO') == 1 + break + end + +end + +%add current calibration phases +if strcmp(site,'PAO') == 1 + load calibration_pao.wera + figure(14) + plot([1:12],calibration_pao(1:12,3),'b.-') + legend('Helzel','original calibration','location','northwest') +elseif strcmp(site,'PAB') == 1 + load calibration_pab.wera + figure(14) + plot([1:12],calibration_pab(1:12,3),'b.-') + legend('Helzel','Flament','original calibration','location','southeast') +end + + + + + + +% save figures +save_flag = 1; + +figdir = ('/home/bandma01/Dropbox/UQAR/MEOPAR_Marion/figures/WERAcalibration'); +cd(figdir) + +fig_hdl = figure(1); +if save_flag + fname = ['configuration_' site '_calibrations']; + fig_w = 8;%cm + fig_h = 5;%cm + set(fig_hdl,'PaperUnits','centimeters') + set(fig_hdl,'PaperPosition',[0 0 fig_w fig_h]) + set(fig_hdl, 'PaperSize', [fig_w fig_h]); + print(fig_hdl,'-dpng','-r500',fname) + %crop([fname '.png']) +end + + + + +for i = 2:12 + fig_hdl = figure(i); + if save_flag + fname = ['Phases_' site '_pair' num2str(i-1) '-' num2str(i)]; + fig_w = 8;%cm + fig_h = 5;%cm + set(fig_hdl,'PaperUnits','centimeters') + set(fig_hdl,'PaperPosition',[0 0 fig_w fig_h]) + set(fig_hdl, 'PaperSize', [fig_w fig_h]); + print(fig_hdl,'-dpng','-r500',fname) + % crop([fname '.png']) + end +end + + + +fig_hdl = figure(13); +if save_flag + fname = ['PhaseDifference_' site '_calibrations']; + fig_w = 8;%cm + fig_h = 5;%cm + set(fig_hdl,'PaperUnits','centimeters') + set(fig_hdl,'PaperPosition',[0 0 fig_w fig_h]) + set(fig_hdl, 'PaperSize', [fig_w fig_h]); + print(fig_hdl,'-dpng','-r500',fname) + % crop([fname '.png']) +end + +fig_hdl = figure(14); +if save_flag + fname = ['PhaseCalibration_' site]; + fig_w = 8;%cm + fig_h = 5;%cm + set(fig_hdl,'PaperUnits','centimeters') + set(fig_hdl,'PaperPosition',[0 0 fig_w fig_h]) + set(fig_hdl, 'PaperSize', [fig_w fig_h]); + print(fig_hdl,'-dpng','-r500',fname) + % crop([fname '.png']) +end diff --git a/source/calibration.rst b/source/calibration.rst index c4f561f5329bcae12a13893f212cd4be9009e1af..4d698810f6dc8ac24cad4e6900f9b1cd70102dae 100644 --- a/source/calibration.rst +++ b/source/calibration.rst @@ -10,7 +10,7 @@ CODAR **POINTE-AU-PERE:** *********************** -Please see notes from field work on `2013-02-01`_ +Please see notes from field work on `2013-02-01`_. .. _2013-02-01: http://demeter.uqar.ca/submesoscale/index.php/Pap @@ -67,6 +67,94 @@ To generate the new Antenna diagram: WERA ##### +Go to the **"Submesoscale"** `wiki`_ and click on "useful links" under **Outils**, then "WERA HF Radar Software - Fortran Programs Documentation". Here we find which Fortran program we need to use to do what we want. + +.. _wiki: http://demeter.uqar.ca/submesoscale/index.php/Accueil + + +.. topic:: Objectives + + We need to "remove wrong calibration data and apply new ones", so we need to use Modify_WERA_SORT. + + + + +Steps to generate new calibration file +***************************************** + + #. loggin to the wera server wera@132.215.11.14 + #. cd etc/ + +In this folder, we find the original calibration files: + - calibration_pab.wera + - calibration_pao.wera + +If we look at what the content of the calibration file: + - cat calibration_pab.wera + +the phase is given in the 3rd column. + + +On 2014-10-29 (PAO) and 2014_10-30 (PAB), calibrations were undertaken in the field. + +Calibration data are stored in: + - /hfr-data-processing/calibrations/PAB/2014303 every minute from 16:53 to 17:55 + - /hfr-data-processing/calibrations/PAO/2014302 every minute from 17:46 to 18:23 + +While the calibrations were running, tracks were recorded with an instrument belonging to Helzel (PAO and PAB) as well as with an instrument belonging to Flament (PAB). So for PAB we are going to be able to compare the two. + +The tracks can be found in : + - /hfr-data-processing/calibrations/PAO/HelzelPAO_Track_29-OCT-14 183138.gpx + - /hfr-data-processing/calibrations/PAB/HelzelPAB_Track_30-OCT-14 175446.gpx + - /hfr-data-processing/calibrations/PAB/FlamentPAB_Track_30-OCT-14 182008.gpx + +We use the routine **GPS_gpx2mat.m** to convert .gpx files into .mat files. +We use the routine **WERA_AntennaCoord_txt2mat.m** to transform the .txt files with antennas'coordinates to .mat files. +We use the routine **WERAphase_txt2mat.m** to convert the .txt files containing phases into .mat files. + +The routine **WERAcalibration.m** is available at this `page`_. + +.. _page: WERAcalibration.html + + +All the Matlab routines are located in ~/hfr-data-processing/calibrations/. + + + + + +Re-processing of radial currents with new phases +*************************************************** + +For the all month of September 2013, we are going to generate new files using the new calibration phases. + +Post-processing of WERA radial currents is documented `here`_. + +.. _here: WERAprocessing.html + +For example, let us see what we have to do to generate radial currents at PAO using the new calibration phases for september 1st, 2013 (Julian day 244): + +Data in the ~/data1/PAO/2013244/raw/ folder are converted in .SORT and .RFI in the ~/data1/PAO/2013244/results/ folder using the **do_process_SORT_pol** shell script. These files are generated using the "original" calibration phases. + + + +First we need to change the original .SORT and .RFI files and save them to .SORT0 and .RFI0 to save them for future reference. This is done with the shell script **changeName.sh** located in /hfr-data-processing/postprocessing/wera/. + +.SORT====> .SORT0 (generated with original calibration) +.RFI ====> .RFI0 + + + + +as well as 2 symbolic links to point towards which file is the calibration to remove (with link calibration.wera.remove) and which file is the calibration to use (with link calibration.wera.apply). + + +If we look at what the content of the calibration file is: + * cat calibration_pab.wera + +We want to compare the value of the phase given in the 3rd column with the one that we compute. + + COMPARISON OLD/NEW WERA CALIBRATIONS **************************************