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