-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into sphinx-documentation
keeping sphinx-branch upto date with master
- Loading branch information
Showing
43 changed files
with
2,258 additions
and
1,439 deletions.
There are no files selected for viewing
202 changes: 120 additions & 82 deletions
202
assimilation_code/modules/assimilation/adaptive_inflate_mod.f90
Large diffs are not rendered by default.
Oops, something went wrong.
281 changes: 188 additions & 93 deletions
281
assimilation_code/modules/assimilation/filter_mod.dopplerfold.f90
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
function beta = change_GA_IG(mode, var) | ||
|
||
% Routine to change the Gaussian prior into an inverse gamma (IG). | ||
% The Gaussian prior is represented by a mode (:= mean) and a variance; var | ||
|
||
|
||
%% DART software - Copyright UCAR. This open source software is provided | ||
% by UCAR, "as is", without charge, subject to all terms of use at | ||
% http://www.image.ucar.edu/DAReS/DART/DART_download | ||
% | ||
|
||
% Computation savers | ||
var_p = zeros(1, 3); | ||
var_p(1) = var; | ||
for i = 2:3 | ||
var_p(i) = var_p(i-1)*var; | ||
end | ||
|
||
mode_p = zeros(1, 9); | ||
mode_p(1) = mode; | ||
for i = 2:9 | ||
mode_p(i) = mode_p(i-1)*mode; | ||
end | ||
|
||
% Calculate the rate parameter for IG distribution. | ||
% It's a function of both the prior mean and variannce, | ||
% obtained as a "real" solution to a cubic polynomial. | ||
AA = mode_p(4) * sqrt((var_p(2) + 47*var*mode_p(2) + 3*mode_p(4)) / var_p(3)); | ||
BB = 75*var_p(2)*mode_p(5); | ||
CC = 21*var*mode_p(7); | ||
DD = var_p(3)*mode_p(3); | ||
EE = (CC + BB + DD + mode_p(9) + 6*sqrt(3)*AA*var_p(3)) / var_p(3); | ||
|
||
beta = (7*var*mode + mode_p(3))/(3*var) + ... | ||
EE^(1/3)/3 + mode_p(2)*(var_p(2) + 14*var*mode_p(2) + ... | ||
mode_p(4)) / (3*var_p(2)*EE^(1/3)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function enh_density = enh_compute_new_density(dist_2, sigma_p_2, sigma_o_2, alpha, beta, gamma_corr, lambda, ens_size) | ||
|
||
%% DART software - Copyright UCAR. This open source software is provided | ||
% by UCAR, "as is", without charge, subject to all terms of use at | ||
% http://www.image.ucar.edu/DAReS/DART/DART_download | ||
% | ||
|
||
% Compute probability of this lambda being correct | ||
exp_prior = - beta / lambda; | ||
|
||
% Compute probability that observation would have been observed given this lambda | ||
fac1 = (1 + gamma_corr * (sqrt(lambda) - 1.0))^2; | ||
fac2 = -1 / ens_size; | ||
if fac1 < abs(fac2), fac2 = 0; end | ||
|
||
theta = sqrt( (fac1+fac2) * sigma_p_2 + sigma_o_2 ); | ||
exp_like = - 0.5 * dist_2 / theta^2; | ||
|
||
% Compute the updated probability density for lambda | ||
enh_density = beta^alpha / gamma(alpha) * lambda^(- alpha - 1) / ... | ||
(sqrt(2.0 * pi) * theta) * exp(exp_like + exp_prior); | ||
|
Oops, something went wrong.