Skip to content

Commit ce4c9d6

Browse files
committed
missing val for nc, output bugs removed
1 parent 0df1366 commit ce4c9d6

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/DefaultParameters.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595

9696
# OUTPUT OPTIONS
9797
output::Bool=false # netcdf output?
98-
output_vars::Array{String,1}=["u","v","η","sst","q","ζ"] # which variables to output? "du","dv","dη" also allowed
98+
output_vars::Array{String,1}=["u","v","η","sst"] # which variables to output? "du","dv","dη" also allowed
9999
output_dt::Real=6 # output time step [hours]
100100
outpath::String=pwd() # path to output folder
101101

@@ -239,7 +239,7 @@ Creates a Parameter struct with following options and default values
239239
240240
# OUTPUT OPTIONS
241241
output::Bool=false # netcdf output?
242-
output_vars::Array{String,1}=["u","v","η","sst","q","ζ"] # which variables to output? "du","dv","dη" also allowed
242+
output_vars::Array{String,1}=["u","v","η","sst"] # which variables to output? q,ζ,du,dv,dη also allowed.
243243
output_dt::Real=6 # output time step [hours]
244244
outpath::String=pwd() # path to output folder
245245

src/Output.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ function nc_create( x::Array{T,1},
6565
tvar = NcVar("t",tdim,t=Int32)
6666

6767
nc = NetCDF.create(joinpath(path,name*".nc"),[var,tvar],mode=NC_NETCDF4)
68-
NetCDF.putatt(nc,name,Dict("units"=>unit,"long_name"=>long_name))
68+
# add missing_value although irrelevant for ncview compatibility
69+
NetCDF.putatt(nc,name,Dict("units"=>unit,"long_name"=>long_name,"missing_value"=>-999999f0))
6970
return nc
7071
end
7172

@@ -107,10 +108,12 @@ function output_nc!(i::Int,
107108
NetCDF.putvar(ncs.sst,"sst",sst,start=[1,1,iout],count=[-1,-1,1])
108109
end
109110
if ncs.q != nothing
110-
@views q = Float32.(Diag.Vorticity)
111+
@views q = Float32.(Diag.Vorticity.q[haloη+1:end-haloη,haloη+1:end-haloη])
111112
NetCDF.putvar(ncs.q,"q",q,start=[1,1,iout],count=[-1,-1,1])
112113
end
113114
if ncs.ζ != nothing
115+
@unpack dvdx,dudy = Diag.Vorticity
116+
@unpack f_q = S.grid
114117
@views ζ = Float32.((dvdx[2:end-1,2:end-1]-dudy[2+ep:end-1,2:end-1])./abs.(f_q))
115118
NetCDF.putvar(ncs.ζ,"relvort",ζ,start=[1,1,iout],count=[-1,-1,1])
116119
end

0 commit comments

Comments
 (0)