Skip to content

Commit

Permalink
try to save attributes of the type Vector{Any}
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Apr 23, 2024
1 parent 3e10da2 commit 6735b42
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/netcdf_c.jl
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,11 @@ function nc_put_att(ncid::Integer,varid::Integer,name::SymbolOrString,data::Vect
nc_put_att(ncid,varid,name,ncType[T],data)
end

function nc_put_att(ncid::Integer,varid::Integer,name::SymbolOrString,data::Vector{Any})
T = promote_type(typeof.(data)...)
nc_put_att(ncid,varid,name,ncType[T],data)
end

# convert e.g. ranges to vectors
function nc_put_att(ncid::Integer,varid::Integer,name::SymbolOrString,data::AbstractVector)
nc_put_att(ncid,varid,name,Vector(data))
Expand Down

0 comments on commit 6735b42

Please sign in to comment.