Skip to content

Commit

Permalink
Added separate Ye calculator (outside of DA)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonKing93 committed Nov 21, 2019
1 parent 3ba48dd commit e7aa83c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
32 changes: 32 additions & 0 deletions 4. DA Analyses/@dash/calculateYe.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
function[Ye] = calculateYe( M, F )
%% Calculates Ye for a given ensemble and set of PSMs without conducting
% any data assimilation.
%
% Ye = dash.calculateYe( M, F )
% Calculate Ye values.
%
% ----- Inputs -----
%
% M: A model ensemble (nState x nEns), or a scalar ensemble object.
%
% F: A set of forward models
%
% ----- Outputs -----
%
% Ye: A set of Ye values

% Initialize an empty Kalman Filter, just to error check M and F
kalmanFilter( M, ones(size(F)), ones(size(F)), F );

% Preallocate
nObs = size(F,1);
nEns = size(M,2);
Ye = NaN( nObs, nEns );

% Generate model estimates
for d = 1:numel(F)
Mpsm = M( F{d}.H, : );
Ye(d,:) = dash.processYeR( F{d}, Mpsm, 1, NaN, d );
end

end
3 changes: 3 additions & 0 deletions 4. DA Analyses/@dash/dash.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
% Error check Ye and R generation on the fly without crashing the analysis
[Ye, R, use] = processYeR( F, Mpsm, R, t, d );

% Calculate Ye without running a data assimilation
Ye = calculateYe( M, F );

end

end

0 comments on commit e7aa83c

Please sign in to comment.