@@ -19,21 +19,22 @@ function NcFiles(feedback::Feedback,S::ModelSetup)
19
19
20
20
if S. parameters. output
21
21
22
- @unpack output_vars = S. parameters
22
+ @unpack output_vars,compression_level = S. parameters
23
+ P = S. parameters
23
24
@unpack x_u,x_v,x_T,x_q = S. grid
24
25
@unpack y_u,y_v,y_T,y_q = S. grid
25
26
26
27
@unpack run_id,runpath = feedback
27
28
28
- ncu = if " u" in output_vars nc_create (x_u,y_u," u" ,runpath," m/s" ," zonal velocity" ) else nothing end
29
- ncv = if " v" in output_vars nc_create (x_v,y_v," v" ,runpath," m/s" ," meridional velocity" ) else nothing end
30
- ncη = if " η" in output_vars nc_create (x_T,y_T," eta" ,runpath," m" ," sea surface height" ) else nothing end
31
- ncsst = if " sst" in output_vars nc_create (x_T,y_T," sst" ,runpath," 1" ," sea surface temperature" ) else nothing end
32
- ncq = if " q" in output_vars nc_create (x_q,y_q," q" ,runpath," 1/(ms)" ," potential vorticity" ) else nothing end
33
- ncζ = if " ζ" in output_vars nc_create (x_q,y_q," relvort" ,runpath," 1" ," relative vorticity" ) else nothing end
34
- ncdu = if " du" in output_vars nc_create (x_u,y_u," du" ,runpath," m^2/s^2" ," zonal velocity tendency" ) else nothing end
35
- ncdv = if " dv" in output_vars nc_create (x_v,y_v," dv" ,runpath," m^2/s^2" ," meridional velocity tendency" ) else nothing end
36
- ncdη = if " dη" in output_vars nc_create (x_T,y_T," deta" ,runpath," m^2/s" ," sea surface height tendency" ) else nothing end
29
+ ncu = if " u" in output_vars nc_create (x_u,y_u," u" ,runpath," m/s" ," zonal velocity" ,P ) else nothing end
30
+ ncv = if " v" in output_vars nc_create (x_v,y_v," v" ,runpath," m/s" ," meridional velocity" ,P ) else nothing end
31
+ ncη = if " η" in output_vars nc_create (x_T,y_T," eta" ,runpath," m" ," sea surface height" ,P ) else nothing end
32
+ ncsst = if " sst" in output_vars nc_create (x_T,y_T," sst" ,runpath," 1" ," sea surface temperature" ,P ) else nothing end
33
+ ncq = if " q" in output_vars nc_create (x_q,y_q," q" ,runpath," 1/(ms)" ," potential vorticity" ,P ) else nothing end
34
+ ncζ = if " ζ" in output_vars nc_create (x_q,y_q," relvort" ,runpath," 1" ," relative vorticity" ,P ) else nothing end
35
+ ncdu = if " du" in output_vars nc_create (x_u,y_u," du" ,runpath," m^2/s^2" ," zonal velocity tendency" ,P ) else nothing end
36
+ ncdv = if " dv" in output_vars nc_create (x_v,y_v," dv" ,runpath," m^2/s^2" ," meridional velocity tendency" ,P ) else nothing end
37
+ ncdη = if " dη" in output_vars nc_create (x_T,y_T," deta" ,runpath," m^2/s" ," sea surface height tendency" ,P ) else nothing end
37
38
38
39
for nc in (ncu,ncv,ncη,ncsst,ncq,ncζ,ncdu,ncdv,ncdη)
39
40
if nc != nothing
@@ -55,13 +56,16 @@ function nc_create( x::Array{T,1},
55
56
name:: String ,
56
57
path:: String ,
57
58
unit:: String ,
58
- long_name:: String ) where {T<: Real }
59
+ long_name:: String ,
60
+ P:: Parameter ) where {T<: Real }
61
+
62
+ @unpack compression_level = P
59
63
60
64
xdim = NcDim (" x" ,length (x),values= x)
61
65
ydim = NcDim (" y" ,length (y),values= y)
62
66
tdim = NcDim (" t" ,0 ,unlimited= true )
63
67
64
- var = NcVar (name,[xdim,ydim,tdim],t= Float32)
68
+ var = NcVar (name,[xdim,ydim,tdim],t= Float32,compress = compression_level )
65
69
tvar = NcVar (" t" ,tdim,t= Int32)
66
70
67
71
nc = NetCDF. create (joinpath (path,name* " .nc" ),[var,tvar],mode= NC_NETCDF4)
0 commit comments