PyDL:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- pydl v1.0.0-rc2 »
- SDSS Utilities (`pydl.pydlutils`) »
- write_ndarray_to_yanny

# write_ndarray_to_yanny

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

  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` or `list` of these.

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

    structnames `str` or `list` of `str`, 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` 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.