Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2d fields #73

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 32 additions & 13 deletions src/ECCOtour.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1531,25 +1531,43 @@ function write(vars::Dict{String,Array{Float32,3}},
end

"""
function writeregularpoles(vars::Dict{String,Array{Float32,2}},γ,pathout,filesuffix,filelog,λC,lonatts,ϕC,latatts,z,depthatts)
function write(vars::Dict{String,Array{Float32,2}},params,γ,pathout,filesuffix,filelog,gridatts)
"""
function writeregularpoles(vars::Dict{String,Array{Float32,2}},γ,pathout,filesuffix,filelog,λC,lonatts,ϕC,latatts,z,depthatts)
function write(vars::Dict{String,Array{Float32,2}},
params::RegularpolesParameters,
γ::MeshArrays.gcmgrid,
pathout,
filesuffix,
filelog,
gridatts)

for (varname,varvals) in vars
if varname[1] == 'E'
println(varname)
# Some names are a little inconsistent
# Useful to pull meta-data from these locations
if varname == "EVELMASS"
field = "UE_VEL_C"
elseif varname[1] == 'N'
elseif varname == "NVELMASS"
field = "VN_VEL_C"
elseif varname[1] == 'W'
elseif varname == "WVELMASS"
field = "WVEL"
elseif varname[end] == 'N'
elseif varname == "oceTAUN"
field = "oceTAUY"
elseif varname[end] == 'E'
elseif varname == "oceTAUE"
field = "oceTAUX"
elseif varname == "GM_PsiN"
field = "GM_PsiY"
elseif varname == "GM_PsiE"
field = "GM_PsiX"
else
field = varname
end
fieldDict = read_available_diagnostics(field,filename=filelog)

if varname == "p"
fieldDict = Dict("fldname" => "p","title" => "standard pressure", "units" => "dbar", "levs" => length(z))
else
fieldDict = read_available_diagnostics(field,filename=filelog)
end

# make a directory for this output
pathoutdir = pathout*varname*"/"
Expand All @@ -1567,14 +1585,15 @@ function writeregularpoles(vars::Dict{String,Array{Float32,2}},γ,pathout,filesu
fileout,
varname,
"lon",
λC,
lonatts,
params.λC,
gridatts.lon,
"lat",
ϕC,
latatts,
params.ϕC,
gridatts.lat,
atts = varatts,
t = NC_FLOAT
t = NC_FLOAT # Float32
)

#varvals = 2.(varvals) #convert back to single precision: handled above L1517
ncwrite(varvals, fileout, varname)
end
Expand Down
Loading