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: filename :
str
The name of a parameter file.
datatables :
numpy.ndarray
,numpy.recarray
orlist
of these.A NumPy record array containing data that can be copied into a
yanny
object.structnames :
str
orlist
ofstr
, optionalThe name(s) to give the structure(s) in the yanny file. Defaults to ‘MYSTRUCT0’.
enums :
dict
, optionalA dictionary containing enum information. See the documentation for the
dtype_to_struct()
method of the yanny object.hdr :
dict
, optionalA dictionary containing keyword/value pairs for the ‘header’ of the yanny file.
comments :
str
orlist
ofstr
, optionalA string containing comments that will be added to the start of the new file.
Returns: The
yanny
object resulting from writing the file.Raises: PydlutilsException
If
filename
already exists, or if the metadata are incorrect.