-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhyperpar_ass_prop_coupled.jl
60 lines (44 loc) · 2.45 KB
/
hyperpar_ass_prop_coupled.jl
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
# This scripts stores the hyperpars used in the uncoupled propoal particle filters scenarios
# It also includes the used proposal functions, and parameters used in propoal functions
using Gen
Nx = 32 # number of nodes
Nt = 200 # Assuming Nt is your total number of timesteps
start_ass_time = 100 # warm-up period
# The model error parameters are tuned for better performance
# These parameters are given in main scripts
# std_atm_sys = 0.1 # assumed model error for atm states
# std_ocea_sys = 0.1 # assumed model error for ocea states
# Initial conditions for Atmos and Ocean
# It incluedes all initial values for Nx grids
# These parameters are same as synthetic_truth generation parameters
mu_atm_ini = 0.0
mu_ocea_ini = 0.0
std_atm_ini = 1.0
std_ocea_ini = 1.0
std_atm_obs = 0.3
std_ocea_obs = 0.3
time_window = 1
std_proposal_atm = 0.005 # This the random error added during resampling for atm states
std_proposal_ocea = 0.005 # This the random error added during resampling for ocean states
import Distributions
# This function is used as proposal function to rejunavate particles before the second updating setp.
# I set this function separately because we have a warm-up period in the data assimilation experiment settings.
# Proposal_atm is used in estimating atm states to generate ocean particles
# @gen function proposal_function_ini(prev_trace, T)
# for i in 1:1:Nx
# {(:initial_v => i => :ocea_ini)} ~ normal(prev_trace[(:initial_v=>i=>:ocea_ini)], abs(std_proposal_atm * prev_trace[(:initial_v=>i=>:ocea_ini)]))
# {(:initial_u => i => :atm_ini)} ~ normal(prev_trace[(:initial_u=>i=>:atm_ini)], abs(std_proposal_ocea * prev_trace[(:initial_u=>i=>:atm_ini)]))
# for tt in 1:T-1
# {(:chain => tt => :v => i => :v)} ~ normal(prev_trace[(:chain=>tt=>:v=>i=>:v)], abs(std_proposal_atm * prev_trace[(:chain=>tt=>:v=>i=>:v)]))
# {(:chain => tt => :u => i => :u)} ~ normal(prev_trace[(:chain=>tt=>:u=>i=>:u)], abs(std_proposal_ocea * prev_trace[(:chain=>tt=>:u=>i=>:u)]))
# end
# end
# end
@gen function proposal_function(prev_trace, T)
for i in 1:1:Nx
for tt in T:1:T
{(:chain => tt => :v => i => :v)} ~ normal(prev_trace[(:chain=>tt=>:v=>i=>:v)], abs(std_proposal_atm * prev_trace[(:chain=>tt=>:v=>i=>:v)]))
{(:chain => tt => :u => i => :u)} ~ normal(prev_trace[(:chain=>tt=>:u=>i=>:u)], abs(std_proposal_ocea * prev_trace[(:chain=>tt=>:u=>i=>:u)]))
end
end
end