You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a String variable is written using NCDatasets, a warning is printed.
The warning makes sense as String is a variable-length data type, but as there does not seem to be anything to do about it, it is unhelpful.
The warning comes from DiskArrays.jl, but posting here as I'm guessing that the solution may be some sort of special handling for String here. Maybe a specialised version of setindex_disk!(), like
functionsetindex_disk!(a::NCDatasets.Variable{String, 0, NCDataset{Nothing, Missing}}, v::AbstractArray, i...)
setindex_disk_nobatch!(a,v,i)
v
end
?
To Reproduce
using NCDatasets
f =NCDataset("test.nc", "c")
v =defVar(f, "foo", String, ())
v[] ="bar"
prints
┌ Warning: Can not determine size of element type. Using DiskArrays.fallback_element_size[] =100 bytes
└ @ DiskArrays ~/.julia/packages/DiskArrays/ny95C/src/chunks.jl:354
┌ Warning: Can not determine size of element type. Using DiskArrays.fallback_element_size[] =100 bytes
└ @ DiskArrays ~/.julia/packages/DiskArrays/ny95C/src/chunks.jl:354
Thank you for your complete issue report! I agree that the warning is annoying (it should be displayed only once with this commit JuliaIO/DiskArrays.jl@324867c ).
But is the DiskArrays.setindex_disk! function not part of the private API of DiskArrays ?
Maybe a change in DiskArrays would be more appropriate. For example, if the user sets the fallback_element_size via Preferences.jl then DiskArrays would consider that as a signal that the users knows they are doing? This would "solve" the issue not only for NCDatasets but for all users of DiskArrays. A user could still override per-script DiskArrays.fallback_element_size[].
Describe the bug
If a
String
variable is written usingNCDatasets
, a warning is printed.The warning makes sense as
String
is a variable-length data type, but as there does not seem to be anything to do about it, it is unhelpful.The warning comes from DiskArrays.jl, but posting here as I'm guessing that the solution may be some sort of special handling for
String
here. Maybe a specialised version ofsetindex_disk!()
, like?
To Reproduce
prints
Expected behavior
The string is written with no warning.
Environment
versioninfo()
using Pkg; Pkg.status(mode=PKGMODE_MANIFEST)
Full output
In case of an error, please paste the full error message and stack trace.
The text was updated successfully, but these errors were encountered: