cf.Field.fill_value

Field.fill_value(default=None)[source]

Return the data array missing data value.

This is the value of the missing_value CF property, or if that is not set, the value of the _FillValue CF property, else if that is not set, None. In the last case the default numpy missing data value for the array’s data type is assumed if a missing data value is required.

Parameters:
default : optional

If the missing value is unset then return this value. By default, default is None. If default is the special value 'netCDF' then return the netCDF default value appropriate to the data array’s data type is used. These may be found as follows:

>>> import netCDF4
>>> print netCDF4.default_fillvals    
Returns:
out :

The missing data value, or the value specified by default if one has not been set.

Examples:
>>> f.fill_value()
None
>>> f._FillValue = -1e30
>>> f.fill_value()
-1e30
>>> f.missing_value = 1073741824
>>> f.fill_value()
1073741824
>>> del f.missing_value
>>> f.fill_value()
-1e30
>>> del f._FillValue
>>> f.fill_value()
None
>>> f,dtype
dtype('float64')
>>> f.fill_value(default='netCDF')
9.969209968386869e+36
>>> f._FillValue = -999
>>> f.fill_value(default='netCDF')
-999