write_ndarray_to_yanny

pydl.pydlutils.yanny.write_ndarray_to_yanny(filename, datatables, structnames=None, enums=None, hdr=None, comments=None)[source]

Converts a NumPy record array into a new FTCL/yanny file.

Returns a new yanny object corresponding to the file.

Parameters
filenamestr

The name of a parameter file.

datatablesnumpy.ndarray, numpy.recarray or list of these.

A NumPy record array containing data that can be copied into a yanny object.

structnamesstr or list of str, optional

The name(s) to give the structure(s) in the yanny file. Defaults to ‘MYSTRUCT0’.

enumsdict, optional

A dictionary containing enum information. See the documentation for the dtype_to_struct() method of the yanny object.

hdrdict, optional

A dictionary containing keyword/value pairs for the ‘header’ of the yanny file.

commentsstr or list of str, optional

A string containing comments that will be added to the start of the new file.

Returns
yanny

The yanny object resulting from writing the file.

Raises
PydlutilsException

If filename already exists, or if the metadata are incorrect.