-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgen_domain.m
42 lines (33 loc) · 1.23 KB
/
gen_domain.m
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
n = 8;
Nens = 100;
fv = -9999999;
fname = 'domain.nc';
delete(fname)
nccreate(fname,'mask','Dimensions',{'x',n},'FillValue',fv);
nccreate(fname,'lon','Dimensions',{'x'},'FillValue',fv);
nccreate(fname,'lat','Dimensions',{'x'},'FillValue',fv);
nccreate(fname,'z','Dimensions',{'x'},'FillValue',fv);
nccreate(fname,'part','Dimensions',{'x'},'FillValue',fv);
nccreate(fname,'ens','Dimensions',{'x',n,'ensemble',Nens},'FillValue',fv);
ncwrite(fname,'mask',ones(n,1))
ncwrite(fname,'lon',[1:n]')
ncwrite(fname,'lat',zeros(n,1))
ncwrite(fname,'z',zeros(n,1))
ncwrite(fname,'part',[1:n]')
E = repmat([1:n]',[1 Nens]) + 0.01 * randn(n,Nens);
ncwrite(fname,'ens',E)
obsfname = 'obs1.nc';
m = 1;
delete(obsfname)
nccreate(obsfname,'mask','Dimensions',{'x',m},'FillValue',fv);
nccreate(obsfname,'lon','Dimensions',{'x'},'FillValue',fv);
nccreate(obsfname,'lat','Dimensions',{'x'},'FillValue',fv);
nccreate(obsfname,'z','Dimensions',{'x'},'FillValue',fv);
nccreate(obsfname,'rmse','Dimensions',{'x'},'FillValue',fv);
nccreate(obsfname,'var1','Dimensions',{'x'},'FillValue',fv);
ncwrite(obsfname,'mask',ones(m,1))
ncwrite(obsfname,'lon',[4]')
ncwrite(obsfname,'lat',zeros(m,1))
ncwrite(obsfname,'z',zeros(m,1))
ncwrite(obsfname,'rmse',1)
ncwrite(obsfname,'var1',1)