Open sjdaines opened 5 months ago
Looking at the code, https://github.com/Alexander-Barth/NCDatasets.jl/blob/354de308b31c27eac66f1de0ca37d0bad15147a7/src/netcdf_c.jl#L566C1-L577C1
this is intentional, so is this a netcdf limitation? (int64 is netcdf4 only, not available with netcdf3 https://docs.unidata.ucar.edu/nug/current/md_types.html)
(if so, perhaps should be added to Corner cases doc?)
Yes, in NetCDF 3 and NetCDF 3 (classic format), Int64
are not supported and in the NetCDF CF convention prior to 1.9 they are not allowed.
https://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#_data_types https://cfconventions.org/Data/cf-conventions/cf-conventions-1.9/cf-conventions.html#_data_types
Since CF 1.9 they are part of the standard. I agree that this should be documented, but I am also open to reconsider the current approach. Since Int64
is the default integer on many platforms, the potential of breaking code is unfortunately quite high.
Does your code, need to store integer larger than typemax(Int32)
or it is rather the unexpected type change which is the issue?
Describe the bug
A Julia Int64 (or Vector{Int64}) attribute is written to netcdf as Int32
(tested with NetCDF dataset attributes, not tried NetCDF variable attributes)
Edit: see comment below, looks like this is an intentional conversion to deal with a netcdf limitation?
To Reproduce
Expected behavior
Int64 attributes should remain as Int64
Environment
using Pkg; Pkg.status(mode=PKGMODE_MANIFEST)
Full output
In case of an error, please paste the full error message and stack trace.