-
Notifications
You must be signed in to change notification settings - Fork 0
/
mdapack.m.template
118 lines (110 loc) · 4.43 KB
/
mdapack.m.template
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
clear variables;
clear import;
close all;
% Configures multiple runs of MDAPACK with differing sets of parameters
% make sure that the model binaries are on the search path
addpath(strcat(pwd,filesep,'bin'));
% Typically unused, can be used to explicitly set the seed to create
% exactly reproducible results
s1=RandStream('mt19937ar','seed',1);
s2=RandStream('mt19937ar','seed',2);
s3=RandStream('mt19937ar','seed',3);
% build averaging Gaussian measurement operator
% width = 2.0;
% mDim = 4;
% nDim = 1024;
% avgGaussH = tools.avgGauss(nDim, mDim, width);
width = 2.0;
mDim = 20;
nDim = 40;
avgGaussH = tools.avgGauss(nDim, mDim, width);
%% 1) Choose representation, model and model parameters
parameters.representation = { ...
% @(model) representations.Ensemble(model, ...
% 'ensSize', 3 ...
% ) ...
@(model) representations.PCE( ...
model, ...
'pceOrder', 3, ...
'sampleSize', 10000) ... % also used to compute quantiles
};
parameters.model = {... % bind all parameters of the model generator call
% @() models.RandomWalk('evidenceNoiseRng', s2, 'modelNoiseRng', s1)
% @() models.Lorenz1996(...
% 'measurementSchedule' , 10:2:120, ... % 10 days mixing, 110 days assimilation
% 'tEnd', 150, ... % 30 days forecast period
% 'measurementDimension', mDim, ...
% 'measurementStdDev', 0.1, ...
% 'deterministicDimension', nDim ...
% )
% 'measurementOperator', @(x) models.Lorenz1984.customMeasurementOperator(x, avgGaussH) ...
% @() models.Lorenz1963(...
% 'tStep', 0.05, ...
% 'measurementSchedule' , 4:2:100, ...
% 'measurementError', 0.5, ...
% 'plot2dDim', 1 ...
% )...
@() models.Lorenz1984(...
'tStep', 0.25, ...
'measurementSchedule' , 10:2:100, ...
'measurementStdDev', 0.000000000000000000001, ...
'plot2dDim', 1, ...
'plotMode', '2d', ...
'tEnd', 120, ...
'rndStream', s1 ...
)...
% 'measurementOperator', @(x) models.Lorenz1984.customMeasurementOperator(x,[1,1,-1]), ...
% @() models.Advection(...
% 'deterministicDimension', 1024, ...
% 'decorrelationLength', 20.0,...
% 'measurementDimension', 4, ...
% 'measurementFreq', 5, ...
% 'tCount', 300, ...
% 'measurementStdDev', 0.1, ...
% 'rndStream', s1 ...
% )...
% @() models.AdvectionNoise(...
% 'deterministicDimension', 1024, ...
% 'decorrelationLength', 20.0,...
% 'decorrelationLengthSmall', 8.0,...
% 'noiseLevel', 0.04,...
% 'measurementDimension', 4, ...
% 'measurementFreq', 5, ...
% 'tCount', 300, ...
% 'measurementStdDev', 0.1, ...
% 'rndStream', s1 ...
% )...
% 'measurementOperator', @(x) models.Lorenz1984.customMeasurementOperator(x, avgGaussH) ...
};
%
%% 2) Choose method and method parameters
parameters.method = {...
% @()filters.Pajonk.AREnKF()
@()filters.Pajonk.SPCU()
% @()filters.Pajonk.MHF('nsamples', 1000, 'proposalStdDev', 0.2)
% @()filters.Pajonk.KF()
% @()filters.Evensen.SqrtEnKF()
% @()filters.Evensen.EnKF()
% @()filters.Pajonk.AREnKF('screening','gain','transformation_wavelet_enabled', true)
% 'normalization_fourier_enabled',true, ...
% 'normalization_gridPoint_enabled',true ...
% ...
};
%% 3) Set global parameters and run
parameters.visualize = {true}; % output live graphics?
parameters.progress = {true}; % output progress information to console?
parameters.nRuns = {1}; % number of runs (to create statistics, requires the use of controllers.multiRun)
parameters.statistics = {true}; % compute statistics over the NRUNS or store all runs?
parameters.stat_spectrum = {false}; % compute SVD of ensemble for results? (normally not necessary)
parameters.stat_mean = {true}; % store mean? (this is typically the "best guess")
parameters.stat_relErrors = {true}; % store RMSE/relErr?
parameters.stat_var = {true}; % store variance? (crude measure for the "uncertainty")
parameters.stat_summary = {false}; % store quantiles 0.025, 0.25, 0.5, 0.75, 0.975?
parameters.stat_truth = {true}; % store truth?
% ... and off we go. Interesting here: set the output file name format. You
% can use any input parameter name in {} to have it replaced by the
% respective value. WARNING: only works when the value can be translated
% to a string!
%
% tools.batchcall(parameters, @controllers.multiRun, 'results/current/test.mat');
results = tools.batchcall(parameters, @controllers.singleRun);