Ejemplo n.º 1
0
def binwrite(out, data, byteorder='little_endian', append=False, sequential=False):
    """
    Create a binary data file from an array variable.
    
    :param out: (*string or EndianDataOutputStream*) File path or data output stream.
    :param data: (*array_like*) A numeric array variable of any dimensionality.
    :param byteorder: (*string*) Byte order. ``little_endian`` or ``big_endian``.
    :param append: (*boolean*) Append to an existing file or not. Only valid when ``out``
        is file path.
    :param sequential: (*boolean*) If write binary data as sequential - Fortran
    """
    if isinstance(out, basestring):
        ArrayUtil.saveBinFile(out, data.asarray(), byteorder, append, sequential)
    else:
        ArrayUtil.writeBinFile(out, data.asarray(), byteorder, sequential)
Ejemplo n.º 2
0
def binwrite(fn,
             data,
             byteorder='little_endian',
             append=False,
             sequential=False):
    """
    Create a binary data file from an array variable.
    
    :param fn: (*string*) Path needed to locate binary file.
    :param data: (*array_like*) A numeric array variable of any dimensionality.
    :param byteorder: (*string*) Byte order. ``little_endian`` or ``big_endian``.
    :param append: (*boolean*) Append to an existing file or not.
    :param sequential: (*boolean*) If write binary data as sequential - Fortran
    """
    ArrayUtil.saveBinFile(fn, data.asarray(), byteorder, append, sequential)