Skip to content

Commit

Permalink
rename nc_get_vars to nc_get_vars!
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Nov 28, 2018
1 parent 4b8c588 commit dc0f9fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/NCDatasets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ end
function Base.getindex(v::Variable{T,N},indexes::TR...) where {T,N} where TR <: Union{StepRange{Int,Int},UnitRange{Int}}
start,count,stride,jlshape = ncsub(indexes[1:ndims(v)])
data = Array{T,N}(undef,jlshape)
nc_get_vars(v.ncid,v.varid,start,count,stride,data)
nc_get_vars!(v.ncid,v.varid,start,count,stride,data)
return data
end

Expand Down
16 changes: 8 additions & 8 deletions src/netcdf_c.jl
Original file line number Diff line number Diff line change
Expand Up @@ -732,29 +732,29 @@ function nc_put_vars(ncid::Integer,varid::Integer,startp,countp,stridep,op)
end


function nc_get_vars(ncid::Integer,varid::Integer,startp,countp,stridep,ip::Array{Char,N}) where N
function nc_get_vars!(ncid::Integer,varid::Integer,startp,countp,stridep,ip::Array{Char,N}) where N
tmp = Array{UInt8,N}(undef,size(ip))
nc_get_vars(ncid,varid,startp,countp,stridep,tmp)
nc_get_vars!(ncid,varid,startp,countp,stridep,tmp)
ip[:] = convert(Array{Char,1},tmp[:])
end

function nc_get_vars(ncid::Integer,varid::Integer,startp,countp,stridep,ip::Array{String,N}) where N
function nc_get_vars!(ncid::Integer,varid::Integer,startp,countp,stridep,ip::Array{String,N}) where N
tmp = Array{Ptr{UInt8},N}(undef,size(ip))
nc_get_vars(ncid,varid,startp,countp,stridep,tmp)
nc_get_vars!(ncid,varid,startp,countp,stridep,tmp)
ip[:] = unsafe_string.(tmp)
end

function nc_get_vars(ncid::Integer,varid::Integer,startp,countp,stridep,ip::Array{Vector{T},N}) where {T,N}
function nc_get_vars!(ncid::Integer,varid::Integer,startp,countp,stridep,ip::Array{Vector{T},N}) where {T,N}
tmp = Array{NCDatasets.nc_vlen_t{T},N}(undef,size(ip))
nc_get_vars(ncid,varid,startp,countp,stridep,tmp)
nc_get_vars!(ncid,varid,startp,countp,stridep,tmp)

for i in eachindex(tmp)
ip[i] = unsafe_wrap(Vector{T},tmp[i].p,(tmp[i].len,))
end
end

function nc_get_vars(ncid::Integer,varid::Integer,startp,countp,stridep,ip)
@debug "nc_get_vars: $startp,$countp,$stridep"
function nc_get_vars!(ncid::Integer,varid::Integer,startp,countp,stridep,ip)
@debug "nc_get_vars!: $startp,$countp,$stridep"
check(ccall((:nc_get_vars,libnetcdf),Cint,(Cint,Cint,Ptr{Cint},Ptr{Cint},Ptr{Cint},Ptr{Nothing}),ncid,varid,startp,countp,stridep,ip))
end

Expand Down

0 comments on commit dc0f9fe

Please sign in to comment.