title: Initialize slices of memoryview in cython from numpy.ndarray
body: <p>I am trying to initialize a slice (not not whole) of a memoryview. Suppose that I have memoryview <code>A</code> as an attribute of a class (Extension Type)</p>
  
  <pre><code>from cython.view cimport array as cvarray
  
  N = 1000
  cdef double[:,:,::1] A = cvarray(shape=(2,N,N),itemsize=sizeof(double),format='d')
  </code></pre>
  
  <p>Now, I am trying to initialize it in a <code>cdef</code> function. I have no problem initializing the whole memoryview like this</p>
  
  <pre><code># From elsewhere we have loaded a numpy.ndarray B of size (2,N,N)
  A[:,:,:] = B
  </code></pre>
  
  <p>This is fine when the initializer <code>B</code> is 3D array <code>(2,N,N)</code> so that we do not have to <em>slice</em> <code>A</code>. But now, the problem is here: suppose that I have 2D arrays <code>B1</code> and <code>B2</code> of size (N,N), and trying to initialize as</p>
  
  <pre><code>A[0,:,:] = B1
  A[1,:,:] = B2
  </code></pre>
  
  <p>This gives me the following error:</p>
  
  <pre><code>TypeError: only length-1 arrays can be converted to Python scalars
  </code></pre>
  
  <p>Of course I can copy all data one-by-one from <code>B1</code> and <code>B2</code> to <code>A</code>, but this would not be efficient. This process is in a loop and the size <code>N</code> is large. <code>B1</code> and <code>B2</code> come form loading <em>netcdf</em> files as <code>numpy.ndarray</code> type.</p>
  
  <p>Also, I am defining <code>A</code> to be as a <em>memoryview</em> so that somewhere else in the code I can use <code>nogil</code> functions over accessing <code>A</code>.</p>
  
  <p>I am wondering if there is an efficient way to initialize the memoryview as above, or at least, somehow play with pointers of <code>B1</code> and <code>B2</code> and put them together into an iterable array. Thanks.</p>