Commit b1b9e8db authored by Jordi's avatar Jordi
Browse files

Figures of SMOS experiment.

parent f4aa7f57
Loading
Loading
Loading
Loading
+48 −11
Original line number Diff line number Diff line
clear, clc

nicefig
figures = 'lai-fapar-2'; % 'full', 'gf', 'gf_gg', 'mr', 'mr_gg', 'lai-fapar', 'lai-fapar-2', 'numerical';
% figures = 'lai-fapar-2'; % 'full', 'gf', 'gf_gg', 'mr', 'mr_gg', 'lai-fapar', 'lai-fapar-2', 'numerical';
figures = 'smos';

switch figures
    case {'full', 'lai-fapar', 'lai-fapar-2'}
        % Using _MOD data
        load ../matlab/model_SPARC_results_GG_nlf_1_mr_0.00_20200622_2006.mat
        load results/SPARC_results_GG_nlf_1_mr_0.00_20200622_2006.mat
        % Using _VGT data
        % load ../matlab/model_SPARC_results_GG_nlf_1_mr_0.00_20200625_1224.mat
        % load results/SPARC_results_GG_nlf_1_mr_0.00_20200625_1224.mat
    case 'gf'
        % SIM results
        % load ../results/predictions_gap_filling.mat
    case 'gf_gg'
        % New GG results
        load ../matlab/model_SPARC_results_range_2009_2014_GG_nlf_1_mr_0.00_20200626_0920.mat
        load results/SPARC_results_range_2009_2014_GG_nlf_1_mr_0.00_20200626_0920.mat
    case 'mr'
        % load ../results/predictions_missing_rate_0.90.mat
    case 'mr_gg'
        load ../matlab/model_SPARC_results_GG_nlf_1_mr_0.90_20200626_0928.mat
        load results/SPARC_results_GG_nlf_1_mr_0.90_20200626_0928.mat
    case 'numerical'
        % Look at the end of this script
        load ../matlab/model_SPARC_results_range_2009_2010_GG_nlf_1_mr_0.00_20200626_1544.mat
        load results/SPARC_results_range_2009_2010_GG_nlf_1_mr_0.00_20200626_1544.mat
    case 'smos'
        % load results/SMOS_results_SIM_site_DAHRA_nlf_1_sensors_3_20200720_1703.mat
        % load results/SMOS_results_SIM_site_DAHRA_nlf_3_sensors_3_20200720_1729.mat
        load '../../../2020 SMOS/AutocorKerData/gapFilling_REMEDHUS.mat' ...
            utc_ref SM_both SM_ascat SM_amsr2
        % input/output
        X = utc_ref;
        Y = [SM_both SM_ascat SM_amsr2];
        my = nanmean(Y);
        Y = Y - repmat(my, size(Y,1), 1);
        load results/SMOS_results_SIM_site_REMEDHUS_nlf_3_sensors_3_20200720_1942.mat
    otherwise
        error(['Unknown figures mode ' figures])
end
@@ -300,13 +312,15 @@ switch figures
        for i = 1:length(lai)
            xc = lai(i) + 2*sqrt(vp_lai(i)) * sint;
            yc = fapar(i) + 2*sqrt(vp_fapar(i)) * cost;
            fill(xc, yc, [0.6, 0.6, 0.6], 'LineStyle', 'none', 'FaceAlpha', 0.01);
            %fill(xc, yc, [0.6, 0.6, 0.6], 'LineStyle', 'none', 'FaceAlpha', 0.01);
            fill(xc, yc, [1, 1, 1], 'LineStyle', '-', 'FaceAlpha', 0.01, ...
                'EdgeColor', [0, 0, 0.6], 'EdgeAlpha', 0.05);
        end
        % Draw data, prediction and linear model
        % plot(data_lai, data_fapar, 'x', 'MarkerSize', 16)
        plot(lai, fapar, 'k.', 'MarkerSize', 16)
        plot(model1_x, model1_y, 'r-', 'LineWidth', 2)
        plot(model2_x, model2_y, 'r-', 'LineWidth', 2)
        plot(lai, fapar, '.', 'Color', [0, 0, 0.6], 'MarkerSize', 16)
        plot(model1_x, model1_y, 'r--', 'LineWidth', 2)
        plot(model2_x, model2_y, 'r--', 'LineWidth', 2)
        %plot(model3_x, model3_y, 'r-', 'LineWidth', 2)
        xlim([-1,6]), ylim([-0.1,1.2])
        xlabel('LAI [m^2/m^2] (Spain)'), ylabel('fAPAR (Spain)')
@@ -319,7 +333,7 @@ switch figures
        print -dpng ../figures/FigRes2_gg2.png
        
    case 'numerical'        
        files = dir('../matlab/model_SPARC_results_range_2009_*_GG_*.mat');
        files = dir('../matlab/SPARC_results_range_2009_*_GG_*.mat');
        for f = files'
            % disp(f.name)
            load(sprintf('../matlab/%s', f.name))
@@ -334,6 +348,29 @@ switch figures
            end
            fprintf(' \\\\\n');
        end
        
    case 'smos'
        figure(1), clf
        cm = get(gca, 'colororder');
        for i = 1:3
            subplot(3,1,i), hold on
            plot(Xtrain{i}, Ytrain{i}+my(i), '.', 'MarkerSize', 12, 'Color', cm(2,:))
            plot(Xtest{i}, mu{nlf+i}+my(i), 'k-')
            pv(Xtest{i}, mu{i+nlf}+my(i), varsigma{i+nlf})
            axis tight, grid on
            datetick keeplimits, hold off
        end
        figure(2), clf
        for i = 1:3
            subplot(3,1,i), hold on
            plot(Xtrain{i}, Ytrain{i}+my(i), '.', 'MarkerSize', 12, 'Color', cm(2,:))
            plot(Xtest{i}, mu{nlf+i}+my(i), 'k-')
            pv(Xtest{i}, mu{i+nlf}+my(i), varsigma{i+nlf})
            axis tight
            xlim([datenum('2012-05-01'), datenum('2012-10-31')]), grid on
            datetick keeplimits, hold off
        end
        legend('Data', 'Prediction')
end

shg