Increasing dimensionality

From: Jan Ploski <Jan.Ploski_at_nyahnyahspammersnyahnyah>
Date: Thu, 29 Nov 2007 15:47:13 +0100

Hello,

Is there a simple way to increase the dimensionality of a variable?

For example, I have this function:

; Inserts a time dimension with size = 1 into a 2d variable.
;
function insert_time_dim2d(v)
local d, nv
begin
    d = dimsizes(v)
    nv = new((/ 1, d(0), d(1) /), typeof(v), "No_FillValue")
    nv(0,:,:) = v
    return nv
end

I'd like it to be independent from the dimensionality of the input
variable v. Is there some smart way to implement the nv(0,..) = v
assignment then or do would I have to use loops to copy each element
individually?

Best regards,
Jan Ploski
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Nov 29 2007 - 07:47:13 MST

This archive was generated by hypermail 2.2.0 : Fri Nov 30 2007 - 10:55:49 MST