cfdm.Data.filled¶
-
Data.
filled
(fill_value=None, inplace=False)[source]¶ Replace masked elements with a fill value.
New in version (cfdm): 1.8.7.0
- Parameters
- fill_value: scalar, optional
The fill value. By default the fill returned by
get_fill_value
is used, or if this is not set then the netCDF default fill value for the data type is used, as defined bynetCDF.default_fillvals
.- inplace:
bool
, optional If True then do the operation in-place and return
None
.
- Returns
Examples
>>> d = cfdm.Data([[1, 2, 3]]) >>> print(d.filled().array) [[1 2 3]] >>> d[0, 0] = cfdm.masked >>> print(d.filled().array) [-9223372036854775806 2 3] >>> d.set_fill_value(-99) >>> print(d.filled().array) [[-99 2 3]]