classmethod Domain.fromconstructs(constructs, copy=False)[source]

Return a new domain containing the given metadata constructs.

The new domain acts as a view to the given constructs, i.e. changes to the domain, such as the addition or removal of a construct, will also affect the input Constructs instance.

New in version (cfdm): 1.7.0

constructs: Constructs

The constructs from which to create the new domain. Cell method and field ancillary constructs are ignored.

copy: bool, optional

If True then deep copy the metadata constructs prior to initialisation. By default the metadata constructs are not copied. Note that even when copy is True, the input Constructs container is not copied.


The domain created from a view of the constructs.


>>> f = cfdm.core.example_field(0)
>>> d = cfdm.core.Domain.fromconstructs(f.constructs)
>>> d
<Domain: {1, 5, 8}>
>>> d = cfdm.core.Domain.fromconstructs(f.constructs.copy())