cf.display_data¶
- cf.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
>>> cf.display_data() <CF Constant: True> >>> print(cf.display_data()) True >>> bool(cf.display_data()) True >>> cf.display_data().value True
>>> old = cf.display_data(False) >>> cf.display_data() <CF Constant: False> >>> cf.display_data(old) <CF Constant: True> >>> cf.display_data() <CF Constant: True>
Use as a context manager:
>>> print(cf.display_data()) True >>> with cf.display_data(False): ... print(cf.display_data()) ... False >>> print(cf.display_data()) True