cfdm.display_data¶
- cfdm.display_data(*arg)[source]¶
Control the display of data elements.
If True then show the first and last data elements (and possibly others, depending on the data shape) when displaying data via a
dumpmethod, or viareprandstr. This can take a long time if the data elements need an expensive computation, possibly including a slow read from local or remote disk, to find the display values.If False then do not show such data elements, unless data elements have been previously cached, thereby avoiding a potentially high computational cost.
Note that whenever data values are displayed, they are cached for fast future retrieval.
Added in version (cfdm): 1.13.0.0
See also
- Parameters:
- Returns:
ConstantThe value prior to the change, or the current value if no new value was specified.
Examples
>>> cfdm.display_data() <Constant: True> >>> print(cfdm.display_data()) True >>> bool(cfdm.display_data()) True >>> cfdm.display_data().value True
>>> old = cfdm.display_data(False) >>> cfdm.display_data() <Constant: False> >>> cfdm.display_data(old) <Constant: True> >>> cfdm.display_data() <Constant: True>
Use as a context manager:
>>> print(cfdm.display_data()) True >>> with cfdm.display_data(False): ... print(cfdm.display_data()) ... False >>> print(cfdm.display_data()) True