def upload ( self, channel, sl, imarray ):

    with closing ( ocpcadb.OCPCADB(self.proj) ) as self.db:
      
      for y in range ( 0 , self._yimgsz+1, self.ycubedim ):
        for x in range ( 0, self._ximgsz+1, self.xcubedim ):

          # zindex
          key = ocplib.XYZMorton ( [x/self.xcubedim, y/self.ycubedim, (sl-self.startslice)/self.zcubedim] )

          # Create a channel cube
          cube = imagecube.ImageCube16 ( self.cubedims )
          
          xmin = x
          ymin = y
          xmax = min ( self._ximgsz, x + self.xcubedim )
          ymax = min ( self._yimgsz, y + self.ycubedim )
          zmin = 0
          zmax = min ( sl + self.zcubedim, self.endslice + 1 )

          # data for this key
          cube.data[0:zmax-zmin,0:ymax-ymin,0:xmax-xmin] = imarray[zmin:zmax,ymin:ymax, xmin:xmax]
          print cube.data.shape
          #import pdb;pdb.set_trace()
          self.db.putChannelCube(key, channel, self.resolution, cube)
      
        print " Commiting at x={}, y={}, z={}".format(x, y, sl)
        self.db.conn.commit()
Transfer the array to the database
dataset/ETHPy150Open neurodata/ndstore/ingest/raju/rajuchannel.py/RajuIngest.upload