[ncl-talk] copy a vector (1D) to one of the dimensions of 2D array
Greg Thompson
gthompsn at ucar.edu
Wed Jan 30 15:28:45 MST 2019
I am struggling (feeling dumb) that I cannot figure out how to write a
one-line efficient solution to copy a 1D vector of latitude to all the
columns of a 2D grid since the values (of latitude) are constant across my
grid in the X-direction.
So what I have is this
ny = 8
nx = 10
a = new( (/ny,nx/), float)
a = 0.
a(:, 0) = fspan(40., 42., ny)
do n = 1, nx-1
a(:, n) = a(:,0)
end do
but that DO-n loop is slow as nx grows large and I thought there was an
elegant solution in NCL to treat this array manipulation.
Any thoughts?
Thanks!!!
Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190130/05d21824/attachment.html>
More information about the ncl-talk
mailing list