libera_utils.io.netcdf.field_fill_value#

libera_utils.io.netcdf.field_fill_value(variable: Variable, *, source: str) → float | int#

Return a field’s own _FillValue attribute.

The fill sentinel comes from the file rather than a hard-coded value, so a field with none raises rather than being masked with a guess. Pass it to apply_fill_and_valid_range() when netCDF4’s automatic masking is off.

Parameters:
  • variable (netCDF4.Variable) – The field being read.

  • source (str) – Name used in the error message (reader key and file).

Returns:

The _FillValue attribute, as stored.

Return type:

float or int

Raises:

ValueError – If the field has no _FillValue attribute.