Skip to content

Means to read datasets from CDL as a string input #337

@davidhassell

Description

@davidhassell

(Copied more or less verbatim from NCAS-CMS/cf-python#171)

We agreed it would be useful to support a way to read-in field constructs from CDL supplied as a string, rather than defined in a file, the latter of which is the only means currently supported. (Naturally CDL is the only format we support that can be provided as a string.)

This could be handy if, say, a user had CDL copied to clipboard and they wanted to work with it interactively with cf, since they could just paste it into a string in their Python session without having to save it to a file outside of the session.

An intuitive way to enable this would be a keyword argument such as cdl_string to cfdm.read to indicate, when True, that the input argument is a str of valid CDL rather than the path to a file, as standard, i.e:

cfdm.read(string, cdl_string=True)

where the default would of course be False.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dataset readRelating to reading datasetsenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions