From fde355a7f2e810bb0e3e2a17cae80189d2b82d47 Mon Sep 17 00:00:00 2001 From: Alexander Barth Date: Sat, 9 Feb 2019 22:56:17 +0100 Subject: [PATCH] fix issue #22 --- src/NCDatasets.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/NCDatasets.jl b/src/NCDatasets.jl index 6f65a41b..c1684050 100644 --- a/src/NCDatasets.jl +++ b/src/NCDatasets.jl @@ -1406,12 +1406,17 @@ end function ncgen(io::IO,fname; newfname = "filename.nc") ds = Dataset(fname) + unlimited_dims = unlimited(ds.dim) print(io,"ds = Dataset(\"$(escape(newfname))\",\"c\")\n") print(io,"# Dimensions\n\n") for (d,v) in ds.dim - print(io,"ds.dim[\"$d\"] = $v\n") + if d in unlimited_dims + print(io,"ds.dim[\"$d\"] = Inf # unlimited dimension\n") + else + print(io,"ds.dim[\"$d\"] = $v\n") + end end print(io,"\n# Declare variables\n\n")