Skip to content

Commit

Permalink
Remove workaround for NCDatasets issue (fixed in v0.14.2) (#84)
Browse files Browse the repository at this point in the history
Issue in NCDatasets v0.13 (probably) - v0.14.1 caused failure, now fixed in v0.14.2
Alexander-Barth/NCDatasets.jl#246
"v0.14 cannot create variable from an Int64 array with missing values"

Update Project.toml [compat] to require either v0.12 or >= v0.14.2
  • Loading branch information
sjdaines authored Feb 10, 2024
1 parent 776f0de commit 42eb426
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
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

0 comments on commit 42eb426

Please sign in to comment.