Skip to content

Commit

Permalink
Merge pull request #255 from Sbozzolo/master
Browse files Browse the repository at this point in the history
Throw informative error for unsupported vtype
  • Loading branch information
Alexander-Barth authored Apr 10, 2024
2 parents d85c6ca + 8f452ad commit 4793a53
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/cfvariable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ function defVar(ds::NCDataset,name::SymbolOrString,vtype::DataType,dimnames;
typeid = nc_def_vlen(ds.ncid, typename, ncType[eltype(vtype)])
else
# base-type
haskey(ncType, vtype) || error("$vtype not supported")
ncType[vtype]
end

Expand Down
2 changes: 2 additions & 0 deletions test/test_writevar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ ds = NCDataset(filename,"c")
defDim(ds,"lon",sz[1])
defDim(ds,"lat",sz[2])

# vartype not supported
@test_throws ErrorException defVar(ds,"var-DT",DateTime,("lon","lat"))

# variables
for T in [UInt8,Int8,UInt16,Int16,UInt32,Int32,UInt64,Int64,Float32,Float64]
Expand Down

0 comments on commit 4793a53

Please sign in to comment.