.. meta:: :description: Code snippets Numpy Array create channel How to create a Channel from a Numpy Array ========================================== In this example, a Channel is created from a Numpy array. Importing the Numpy package and creating the array:: import numpy as np # Creating the data matrix: initialization with a specific data type newNumpyArrayMatrix = np.zeros([4, 5, 6], dtype='int32') # Making a cross in the data newNumpyArrayMatrix[2, :, 3] = 5 newNumpyArrayMatrix[2, 2, :] = 5 Creating the Channel from the array:: from ORSModel import createChannelFromNumpyArray newChannel = createChannelFromNumpyArray(newNumpyArrayMatrix) .. warning:: The method *createChannelFromNumpyArray* accepts only these Numpy data types: *np.int8*, *np.uint8*, *np.int16*, *np.uint16*, *np.int32*, *np.uint32* and *np.float32*. Note that the Numpy method *astype* can be used to convert the data type of a matrix, for example:: aFloat64Matrix = np.zeros([4, 5, 6]) aFloat32Matrix = aFloat64Matrix.astype(np.float32) Setting optional properties:: newChannel.setTitle('My dataset') Using a *publish* to make the application aware of this new dataset:: newChannel.publish()