diff --git a/src/NCDatasets.jl b/src/NCDatasets.jl index f4816a6b..38566893 100644 --- a/src/NCDatasets.jl +++ b/src/NCDatasets.jl @@ -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 diff --git a/src/netcdf_c.jl b/src/netcdf_c.jl index f00a23e2..17e28db9 100644 --- a/src/netcdf_c.jl +++ b/src/netcdf_c.jl @@ -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