From 490c62e3a662d7d74ad1c118ab5cbe6f626d6cd4 Mon Sep 17 00:00:00 2001 From: meggart Date: Fri, 3 Jan 2025 13:40:57 +0100 Subject: [PATCH] make subranges default read strategy --- Project.toml | 2 +- src/NetCDF.jl | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 73d5858..1eda4af 100644 --- a/Project.toml +++ b/Project.toml @@ -3,7 +3,7 @@ uuid = "30363a11-5582-574a-97bb-aa9a979735b9" keywords = ["NetCDF", "IO"] license = "MIT" desc = "NetCDF file reading and writing" -version = "0.12.0" +version = "0.12.1" [deps] DiskArrays = "3c3547ce-8d99-4f5e-a174-61eb10b00ae3" diff --git a/src/NetCDF.jl b/src/NetCDF.jl index 57c009f..24ec82a 100644 --- a/src/NetCDF.jl +++ b/src/NetCDF.jl @@ -229,7 +229,13 @@ getchunksize(v::NcVar) = getchunksize(haschunks(v),v) getchunksize(::Chunked, v::NcVar) = GridChunks(v,reverse(map(Int64,v.chunksize))) getchunksize(::Unchunked, v::NcVar) = estimate_chunksize(v) eachchunk(v::NcVar) = getchunksize(v) -haschunks(v::NcVar) = all(iszero,v.chunksize) ? Unchunked(SubRanges()) : Chunked() +function haschunks(v::NcVar) + if all(iszero,v.chunksize) + Unchunked(SubRanges()) + else + Chunked(SubRanges()) + end +end """ NcVar(name::AbstractString,dimin::Union{NcDim,Array{NcDim,1}}