Skip to content

Commit

Permalink
for arrays when the CF transformation does not change the element typ…
Browse files Browse the repository at this point in the history
…e to avoid the allocation of a new array
  • Loading branch information
Alexander-Barth committed Sep 2, 2024
1 parent 00eca36 commit ba34d89
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cfvariable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@ end
return CFtransformdata!(out,data,fv,scale_factor,add_offset,time_origin,time_factor,maskingvalue)
end

# for arrays when the CF transformation does not change the element type
# to avoid the allocation of a new array
@inline function CFtransformdata(data::AbstractArray{T,N},fv,scale_factor,add_offset,time_origin,time_factor,maskingvalue,::Type{T}) where {T,N}
return CFtransformdata!(data,data,fv,scale_factor,add_offset,time_origin,time_factor,maskingvalue)
end

@inline function CFtransformdata(
data::AbstractArray{T,N},fv::Tuple{},scale_factor::Nothing,
add_offset::Nothing,time_origin::Nothing,time_factor::Nothing,maskingvalue,::Type{T}) where {T,N}
Expand Down

0 comments on commit ba34d89

Please sign in to comment.