From 4d91c2904073cee0d3d4dcfc5c971b9bd2fde525 Mon Sep 17 00:00:00 2001 From: Daines Date: Sat, 10 Feb 2024 10:24:28 +0000 Subject: [PATCH] Remove workaround for NCDatasets issue (fixed in v0.14.2) Issue in NCDatasets v0.13 (probably) - v0.14.1 caused failure, now 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" Update Project.toml [compat] to require either v0.12 or >= v0.14.2 --- Project.toml | 2 +- src/OutputWriters.jl | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Project.toml b/Project.toml index 4cf7079..fd5ad76 100644 --- a/Project.toml +++ b/Project.toml @@ -39,7 +39,7 @@ ForwardDiff = "0.10" Infiltrator = "1.0" JLD2 = "0.4" MultiFloats = "1.0" -NCDatasets = "0.12, 0.13, 0.14" +NCDatasets = "0.12, 0.14.2" NLsolve = "4.5" PALEOboxes = "0.21.17" RecipesBase = "1.2" diff --git a/src/OutputWriters.jl b/src/OutputWriters.jl index 645855e..be0b15b 100644 --- a/src/OutputWriters.jl +++ b/src/OutputWriters.jl @@ -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