-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPart_4_Ex_1.m
More file actions
76 lines (65 loc) · 2.8 KB
/
Part_4_Ex_1.m
File metadata and controls
76 lines (65 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
%% DA with covariance localization
% As we saw in previous DA exercises, the EnKF uses the information contained
% in ensemble statistics to disaggregate TWS vertically and horizontally. However,
% these ensemble statistics might sometimes lead to spurious correlations, especially
% when small ensemble sizes are used (Hamil et al., 2001). For example, grid cells
% located far away from each other might appear to be correlated, when in reality
% we would expect no correlations between them.
%
% Covariance localization aims to avoid this problem by dampening correlations
% between grid cells located far away.
%% Setting up of DA
% For this model run, we will use the similar settings as the previous DA experiment.
% Additionally, we will only perform a processing for 2007-2008 so that the process
% is quicker.
clc, clear all;
addpath(genpath('./Codes/')); dbstop if error;
load("Config_DA.mat");
config.run.todate = '2008-12-31'
%%
% We will turn on the switch for covariance localization and provide the filename
% of the localization matrix
config.DAOptions.Localization = 1;
config.DAOptions.OtherData.rhoLocalization = 'Data/03_DA_Files_50km/OPTIONAL_rho_localization/Rho_localization_matrix_300_km.mat';
%%
% Let us also create a new folder to store the results. *Copy-paste the missing
% code from previous exercises.*
config.states.directory = 'Model_States_Output/03_DA_States_Loc/ens%n/';
config.summary.directory = 'Model_States_Output/03_DA_States_Loc/Summary/';
% Make new directory and copy initialization files
%%%%%%%%%%% TO BE FILLED %%%%%%%%%%%%%%%
%% DA run
% The DA is now run exactly as the non-localized EnKF. Functions integrated
% in |Main06_performDA| will be in charge of applying covariance localization.
% *Please copy-paste the DA scripts from exercise 3.*
% Define start and end dates
%%%%%%%%%%% TO BE FILLED %%%%%%%%%%%%%%%
% Create array of epochs were DA should be performed
%%%%%%%%%%% TO BE FILLED %%%%%%%%%%%%%%%
for i = 1:(length(t_array)-1)
fprintf('Processing month number %d out of %d\n',i,length(t_array)-1)
% Set beginning and ending time for monthly run
%%%%%%%%%%% TO BE FILLED %%%%%%%%%%%%%%%
% Perform run for each ensemble member
%%%%%%%%%%% TO BE FILLED %%%%%%%%%%%%%%%
% DA update step
%%%%%%%%%%% TO BE FILLED %%%%%%%%%%%%%%%
%% Monthly EnKF
%%%%%%%%%%% TO BE FILLED %%%%%%%%%%%%%%%
end
%% Result extraction
% *Copy-paste the missing code from previous exercises.*
% Result extraction
%%%%%%%%%%% TO BE FILLED %%%%%%%%%%%%%%%
%% Visualization
F_visualizeEx6(config);
%% Reflection questions
%%
% # How does covariance localization modify the ensemble covariance matrix?
%%
%%
% # Why are TWS time series different when covariance localization is used?
%%
%%
% # What can be the benefits and drawbacks of implementing localization?
%%