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

Remove workaround for NCDatasets issue (fixed in v0.14.2) #84

Merged
merged 2 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ForwardDiff = "0.10"
Infiltrator = "1.0"
JLD2 = "0.4"
MultiFloats = "1.0, 2.0"
NCDatasets = "0.12, 0.13, 0.14"
NCDatasets = "0.12, 0.14.2"
NLsolve = "4.5"
PALEOboxes = "0.21.17"
RecipesBase = "1.2"
Expand Down
8 changes: 2 additions & 6 deletions src/OutputWriters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1237,15 +1237,11 @@ end
function subdomain_to_netcdf!(ds, name::AbstractString, subdom::PB.Grids.InteriorSubdomain)
NCDatasets.defDim(ds, "subdomain_"*name, length(subdom.indices))

# v = NCDatasets.defVar(ds, "subdomain_"*name, subdom.indices .- 1, ("subdomain_"*name,)) # convert to zero based

# workaround for issue in NCDatasets v0.14 (and probably in v0.13 as well)
# NB: issue in NCDatasets v0.13 (probably) - v0.14.1 causes failure, fixed in v0.14.2
# https://github.com/Alexander-Barth/NCDatasets.jl/issues/246
# "v0.14 cannot create variable from an Int64 array with missing values"


si32_zerobased = [ismissing(i) ? missing : Int32(i-1) for i in subdom.indices]
v = NCDatasets.defVar(ds, "subdomain_"*name, si32_zerobased, ("subdomain_"*name,)) # convert to zero based
v = NCDatasets.defVar(ds, "subdomain_"*name, subdom.indices .- 1, ("subdomain_"*name,)) # convert to zero based
v.attrib["subdomain_type"] = "InteriorSubdomain"
end

Expand Down
Loading