Skip to content

to_dataset lossy #1047

@tdimiduk

Description

@tdimiduk

I am looking at saving a DataArray to netcdf. This appears to require turning into a dataset. However, the conversion to and from datasets appears to be lossy.

d = DataArray(...)
n = d.to_dataset().to_array()

looses attrs and the name of the DataArray gets moved to a "variable" coordinate.

I can manually add the attrs to the created dataset, but it seems like they should either be transfered by default, or have an option to preserve them. Is there a reason this is not done?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions