libera_utils.io.netcdf.field_valid_range#
- libera_utils.io.netcdf.field_valid_range(variable: Variable, *, source: str) tuple[float, float]#
Return a field’s own
valid_rangeattribute.The range comes from the file rather than a hard-coded value, so a range the producer revises is applied as distributed, and a field with none raises rather than being checked against a guess. The pair is returned in the file’s order, which may be descending;
apply_fill_and_valid_range()accepts either order.- Parameters:
variable (netCDF4.Variable) – The field being read.
source (str) – Name used in the error message (reader key and file).
- Returns:
The two
valid_rangevalues, as floats.- Return type:
- Raises:
ValueError – If the field has no
valid_rangeattribute, or it does not hold two values.